@@ -507,9 +507,11 @@ ifeq ($(TARGET_ARCH),c6x)
endif
ifeq ($(TARGET_ARCH),arc)
+ ARC_HAS_AT_PCL_RELOC:=$(shell echo -e "\t.text\n\tadd r0,pcl,_symbol@pcl" | $(CC) -c -x assembler -o /dev/null - 2> /dev/null && echo -n y || echo -n n)
CPU_CFLAGS-y += -mlock -mswape
CPU_CFLAGS-$(CONFIG_ARC_CPU_700) += -mA7
CPU_CFLAGS-$(CONFIG_ARC_CPU_HS) += -mcpu=archs
+ CPU_CFLAGS-$(ARC_HAS_AT_PCL_RELOC) += -DARC_HAS_AT_PCL_RELOC
CPU_LDFLAGS-y += $(CPU_CFLAGS) -marclinux
endif
@@ -34,7 +34,7 @@ __asm__(
" ; skip the extra args calc by dl_start() \n"
" ld_s r1, [sp] ; orig argc from aux-vec Tbl \n"
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#ifdef ARC_HAS_AT_PCL_RELOC
" ld r12, [pcl, _dl_skip_args@pcl] \n"
" add r2, pcl, _dl_fini@pcl ; finalizer \n"
@@ -154,7 +154,11 @@ static __always_inline Elf32_Addr elf_machine_load_address(void)
Elf32_Addr addr, tmp;
__asm__ (
"ld %1, [pcl, _dl_start@gotpc] ;build addr of _dl_start \n"
+#ifdef ARC_HAS_AT_PCL_RELOC
+ "add %0, pcl, _dl_start@pcl ;runtime addr of _dl_start \n"
+#else
"add %0, pcl, _dl_start-.+(.&2) ;runtime addr of _dl_start \n"
+#endif /* ARC_HAS_AT_PCL_RELOC */
"sub %0, %0, %1 ;delta \n"
: "=&r" (addr), "=r"(tmp)
);