[PATCH v6 10/13] ARC: ABI lists

Vineet Gupta Vineet.Gupta1@synopsys.com
Mon Jun 8 04:12:35 GMT 2020


On 6/5/20 2:14 PM, Vineet Gupta via Libc-alpha wrote:
> On 6/5/20 11:02 AM, Adhemerval Zanella via Libc-alpha wrote:
> 
>>>> and we handle this issue with an
>>>> assembly hack to redirect the autogenerate memcpy/memmove calls
>>>> to internal definitions (sysdeps/generic/symbol-hacks.h).
>>>>
>>>> I am not sure exactly if this would be avoided in ARC configuration,
>>>> maybe it could adapt the sparc32 hack for the libgcc .udiv symbol
>>>> (sysdeps/sparc/sparc32/Makefile).
>>>
>>> I looked at the code and this seems different than our issue.
>>>
>>
>> I think it is similar: for sparc32 the divdi3 is pulled from libgcc
>> and it in turns calls an libgcc provided symbol (.udiv) which is
>> also provided by glibc.
>>
>> What I am not sure is if we can use the the same hack to force
>> the linker bind the memcpy libgcc internal usage to glibc provided 
>> symbol.
>>
>> I would try to do something like:
>>
>> diff --git a/sysdeps/arc/Makefile b/sysdeps/arc/Makefile
>> index 8d2fbe00c5..ed2f43d2a6 100644
>> --- a/sysdeps/arc/Makefile
>> +++ b/sysdeps/arc/Makefile
>> @@ -20,6 +20,8 @@
>>  # this variable; it's here mostly for documentational purposes.
>>  long-double-fcts = no
>>  
>> +libc.so-gnulib += -Wl,--wrap=memcpy
>> +
>>  ifeq ($(subdir),debug)
>>  CFLAGS-backtrace.c += -funwind-tables
>>  endif
>>
>> And add a sysdeps/arc/symbol-hacks.h with something like:
>>
>> #if !defined __ASSEMBLER__ && IS_IN (libc) && defined SHARED
>> asm ("memcpy = __wrap_memcpy");
>> #endif
> 
> Thx I'm testing this now.

Sorry no joy. libc link fails

~/BR-glibc/B-hs38/host/bin/arc-buildroot-linux-gnu-gcc   -shared -static-libgcc
-Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/lib/ld-linux-arc.so.2
-B~/BR-glibc/B-hs38/build/glibc-7e5850b0b82dae12d8985d9c62e5f9379bd7f789/build/csu/
-Wl,--version-script=~/BR-glibc/B-hs38/build/glibc-7e5850b0b82dae/build/libc.map
-Wl,-soname=libc.so.6 -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both ....
.... -lgcc -Wl,--wrap=memcpy
~/BR-glibc/B-hs38/build/glibc-7e5850b0b82dae/build/elf/sofini.os

~/BR-glibc/B-hs38/host/lib/gcc/arc-buildroot-linux-gnu/9.3.1/../../../../arc-buildroot-linux-gnu/bin/ld:
~/BR-glibc/B-hs38/host/lib/gcc/arc-buildroot-linux-gnu/9.3.1/libgcc.a(dp-bit.o):
in function `_fpadd_parts':
~/BR-glibc/B-hs38/build/host-gcc-initial-f49afad3a0a9d918aa57da14220ac59b5e755c16/build/arc-buildroot-linux-gnu/libgcc/dp-bit.c:620:
undefined reference to `__wrap_memcpy'
collect2: error: ld returned 1 exit status



More information about the Libc-alpha mailing list