toolchain icon indicating copy to clipboard operation
toolchain copied to clipboard

Linker fails with R_ARC_SDA32_ME for hs6x

Open BrunoASMauricio opened this issue 1 year ago • 2 comments

When linking against metaware libraries (-lmw), the GNU linker throws out the following error against sbrk.o and tlsctorg.o:

arc64-elf-ld: error: linker symbol __SDATA_BEGIN__ not found
arc64-elf-ld: final link failed: bad value

The relocations causing the fault are

000000000004  001a0000001e R_ARC_SDA32_ME    0000000000000000 __mwheap_cur + 0
...
000000000092  001a0000001e R_ARC_SDA32_ME    0000000000000000 __mwheap_cur + 0

BrunoASMauricio avatar Jul 07 '23 10:07 BrunoASMauricio

Most probably we need update our default linker scripts with SDA related sections and symbols.

claziss avatar Jul 07 '23 12:07 claziss

Adding the following in ld/emulparams/arc64elf64.sh seems to solve this issue but now I get a similar one to issue https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues/570

SDATA_START_SYMBOLS='__SDATA_BEGIN__ = . + 0x100;'

Only after that other issue is fixed can I run tests and make sure this is indeed a fix (all other .sdata seems to be already present)

BrunoASMauricio avatar Jul 07 '23 13:07 BrunoASMauricio