summaryrefslogtreecommitdiff
path: root/ldso/ldso/arc/dl-sysdep.h
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2015-02-14 15:25:37 +0530
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-02-16 21:52:13 +0100
commit181d410ad00cddd1d6c9f4835e129136b74c5187 (patch)
treebd6baa4c28963210df1f3a00d49dcf6fbdcf5ade /ldso/ldso/arc/dl-sysdep.h
parent673c426bfbe58ee626d346b13365b73712f961ba (diff)
ARC: Conditionalise certain relocations as provided by TLS tools only
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>
Diffstat (limited to 'ldso/ldso/arc/dl-sysdep.h')
-rw-r--r--ldso/ldso/arc/dl-sysdep.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/ldso/ldso/arc/dl-sysdep.h b/ldso/ldso/arc/dl-sysdep.h
index d71e16b32..08b3bade8 100644
--- a/ldso/ldso/arc/dl-sysdep.h
+++ b/ldso/ldso/arc/dl-sysdep.h
@@ -127,6 +127,7 @@ static __always_inline Elf32_Addr elf_machine_dynamic(void)
/* Return the run-time load address of the shared object. */
static __always_inline Elf32_Addr elf_machine_load_address(void)
{
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
/* To find the loadaddr we subtract the runtime addr of a non-local symbol
* say _DYNAMIC from it's build-time addr.
* N.B., gotpc loads get optimized by the linker if it finds the symbol
@@ -144,6 +145,15 @@ static __always_inline Elf32_Addr elf_machine_load_address(void)
"sub %0, %0, %1 ;delta" "\n"
: "=&r" (addr), "=r"(tmp)
);
+#else
+ Elf32_Addr addr, tmp;
+ __asm__ (
+ "ld %1, [pcl, _dl_start@gotpc] ;build addr of _dl_start \n"
+ "add %0, pcl, _dl_start-.+(.&2) ;runtime addr of _dl_start \n"
+ "sub %0, %0, %1 ;delta \n"
+ : "=&r" (addr), "=r"(tmp)
+ );
+#endif
return addr;
}