summaryrefslogtreecommitdiff
path: root/ldso/ldso/arc
AgeCommit message (Collapse)Author
2018-10-27ARC: Accommodate TLS fix in BinutilsEvgeniy Didin
[1] fixes clash of TLS variables on ARC and since LD now calculates relocations a bit different now we need to update dynamic loader as well otherwise relocs will be calculated improperly. Note this is an ABI change and should go in-line with corresponding ARC tools. That said either arc-2018.09 (to be released in few weeks) or the next version of upstream Binutils (2.32) are required for normal TLS work on ARC. Testcase: ----------------------------------8<------------------------------- #include <stdio.h> int foo3(void); int foo1(void); #ifdef _SHARED int foo1(){ static __thread int val3=1; val3 += 2; return val3; } #elif _SHARED2 int foo3(){ static __thread int val2=0; val2 += 2; return val2; } #else int main(){ printf("foo1 = %d \n", foo1()); printf("foo3 = %d \n", foo3()); return 0; } #endif --------------------------------->8--------------------------------------- The result shoud be: ----8<---- foo1 = 3 foo3 = 2 ---->8---- Commands to build artefacts: ----------------------------------------8<------------------------------- arc-linux-gcc -fPIE -ffunction-sections -fdata-sections -pthread -Os \ -fPIC -o testtls.o -D_SHARED -c tst.c arc-linux-gcc -fPIE -ffunction-sections -fdata-sections -pthread -Os \ -fPIC -o testtls2.o -D_SHARED2 -c tst.c arc-linux-gcc -shared -o libtesttls.so testtls.o testtls2.o -lm -Os arc-linux-gcc tst.c -o tst.out -L./ -ltesttls -Os -fPIE --------------------------------->8--------------------------------------- Add path to libtesttls.so file to LD_LIBRARY_PATH before runnig tst.out application. [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=714e9a954a2e4123dcb26bb8da850e1344de4f5f Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Evgeniy Didin <didin@synopsys.com> CC: Cupertino Miranda <cmiranda@synopsys.com> CC: Vineet Gupta <vgupta@synopsys.com> CC: Waldemar Brodkorb <wbx@uclibc-ng.org>
2018-06-29ldso/arc: fix LD_DEBUG segv when printing R_ARC_NONEVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2017-04-08ldso/arc: fix debug printsVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2017-01-15ARC: ldso: don't use _DYNAMIC@gotpc construct #2Vineet Gupta
This removes _DYNAMIC@gotpc from elf_machine_load_address() This is a seperate commit to callout the fact that old code was actually broken but was NOT caught since it never gets called (and will never be) since ld.so only calls it if kernel doesn't pass AT_BASE auxvt, which is not true for Linux. if (!auxvt[AT_BASE].a_un.a_val) auxvt[AT_BASE].a_un.a_val = elf_machine_load_address(); So while the intent was to remove _DYNAMIC@gotpc construct, we need to come up with something which works. The build time address computation of .dynamic which works well is: - "ld %1, [pcl, _DYNAMIC@gotpc] \n" + "ld %1, [pcl, _GLOBAL_OFFSET_TABLE_@pcl] \n" However the runtime address of .dynamic can only be generated with "add %0, pcl, _DYNAMIC@pcl \n" which unfortunately is what is currently broken as it is converted to i_GLOBAL_OFFSET_TABLE_t and thus refers to runtime address of .got and not .dyanmic Thus we resort to using an arbit symbol _dl_start at the expense of an extra GOT entry and a bogus R_ARC_NONE relo in ldso itself which now needs to be ignored. Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2017-01-15ARC: ldso: don't use _DYNAMIC@gotpc construct #1Vineet Gupta
This converts elf_machine_dynamic() to not use the _DYNAMIC@xx construct which was historically converted by assembler into _GLOBAL_OFFSET_TABLE Now that "hack" is being removed from assembler, we need to make sure that no code relies on that magic "conversion". Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2017-01-14ldso: do not resolve relocations for debug, dig them up when debuggingWaldemar Brodkorb
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2016-07-31ARC: Update relocation syntax for old-thread model codeAndrew Burgess
This commit reverses a change introduced in commit 20554a78a9bba that split some of the ARC code into two based on whether uClibc was configured with native threads or not. The native thread code was updated to use the relocation syntax of modern binutils, while the non-native code path used a syntax only accepted in older versions of binutils. The problem with this is that the choice of old binutils or not is orthogonal to the choice of native threads or not, and so, inevitably a user with a recent version of binutils can make the choice to configure uClibc with non-native thread support, and run into code that will not assemble. The solution is either to abandon support for the old tools completely, or to add a new compile time flag for ARC that is set when the version of binutils being used is old; this new flag would allow the old relocation structure to be selected. In this commit I have simply dropped support for older versions of the tools.
2016-07-31ARC: Support R_ARC_JMP_SLOT relocations during bootstrapAndrew Burgess
This commit adds support for R_ARC_JMP_SLOT relocations during the bootstrap phase of the dynamic linker. These relocations will be generated if uClibc-ng is configured with 'DODEBUG=y'.
2016-05-28ldso/ARC: fix DT_RELACOUNT handlingCupertino Miranda
With new binutils supporting DT_RELACOUNT, ldso was crashing as it was parsing relocs incorrectly. Apparently that code ran for first time and was never tested. Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2015-10-22ARC: With NPTL support, GP is no longer used for PICVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2015-03-27Add support for R_ARC_NONE relocations.Andrew Burgess
The R_ARC_NONE relocation is generated when --gc-sections, used by the compile time linker, removes some sections. This is completely normal, and we can see that all other targets (based on random sampling) have support for R_*_NONE relocations (named for each target). Handling R_ARC_NONE involves doing nothing with it, which is nice and easy. Signed-off-by: Andrew Burgess <andrew.burgess@embecosm.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-20ARCv2 ISA supportVineet Gupta
This is next gen Instruction Set Architecture from Synopsys and basis for the ARC HS family of processors. http://www.synopsys.com/dw/ipdir.php?ds=arc-hs38-processor&elq_mid=5732&elq_cid=458802 http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/arc-hs/Pages/default.aspx Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-02-16ARC: Conditionalise certain relocations as provided by TLS tools onlyVineet Gupta
uClibc mainline supports NPTL which in turns depends on TLS support in the tools (gcc/binutils), which is yet to be merged in dev branches. However there is some non NPTL code in uClibc, added as part of NPTL effort, which relies on certain relocations only provided by NPTL binutils. As a result building the current upstream even for LT.old breaks. So conditionalize that code on tools, bu tin lack of specific versions, we use NPTL enabling as a sign the tools are equipped to handle those relos. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18NPTL: ARC supportVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-08-18ARC: ldso: Use @pcl syntax.Joern Rennecke
Signed-off-by: Joern Rennecke <joern.rennecke@embecosm.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20ldso: ARC: tweak whitespace some moreBernhard Reutner-Fischer
Use spaces instead of tabs in the table to accomodate different tab settings. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20ldso: ARC whitespace tweaksVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-12-20ldso: Add ARC supportVineet Gupta
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>