[PATCH 0/3] Allow LLD 13.0.0 and improve compatibility with gold and clang

Fangrui Song maskray@google.com
Wed Jul 28 21:52:27 GMT 2021


On 2021-07-28, H.J. Lu wrote:
>On Sun, Jul 25, 2021 at 8:58 PM Fangrui Song via Libc-alpha
><libc-alpha@sourceware.org> wrote:
>>
>> The patches allow LLD 13.0.0 to build glibc. LLD's compatibility with
>> GNU ld is generally better than gold's compatibility with GNU ld.
>>
>> The first two commits improve gold and clang compatibility as well.
>> (There is still a long way for clang to build glibc.)
>>
>> About `make check` results:
>>
>> I can't configure glibc --enable-static-pie with gold, so I use
>> --disable-static-pie with gold.
>>
>> * gold (--disable-static-pie) has 160 FAIL.
>> * ld.bfd has 152 FAIL.
>> * ld.lld has 159 FAIL.
>>
>> ## I have investigated a few failures.
>>
>> The tst-ifunc-isa-*.c failures are not ld.lld's fault.
>> The lld linked tst-ifunc-isa-* work with LD_BIND_NOW=1.
>> The tests happen to work with GNU ld because the IRELATIVE for foo_ifunc
>> is placed after JUMP_SLOT in .repa.plt.  The test needs to call
>> __x86_get_cpuid_feature_leaf which is defined in a different TU. IMHO
>> such ifunc does not guaranteed to work.
>>
>> For gmon/tst-gmon-gprof*, ld.lld linked tst-gmon-gprof has a f3 line,
>> which appears more correct to me.  But the test considers it a failure.
>>
>> % cat gmon/tst-gmon-gprof.out
>> --- expected
>> +++ actual
>> @@ -1,2 +1,3 @@
>>  f1 2000
>>  f2 1000
>> +f3 1
>> FAIL
>>
>>
>> For malloc/tst-compathooks-on,
>>
>>     malloc/tst-compathooks-on: Symbol `__free_hook' has different size in shared object, consider re-linking
>>
>> the root cause is that lld's symbol versioning is different from GNU ld in an unusal case:
>>
>>     __asm__ (".symver " "__free_hook" "," "__free_hook" "@" "GLIBC_2.2.5");
>>
>> This leaves two symbols __free_hook and __free_hook@GLIBC_2.2.5.
>> __free_hook is then attached a default version GLIBC_2.2.5.
>> I think malloc/malloc-debug.c uses a fragile versioned symbol here.
>> If the inline asm uses @@ the failure should go away.
>>
>>
>> In summary, I think the failed tests touch some dark corners of the toolchain.
>> These things do not really matter for real world applications.
>>
>
>Please open a separate bug for each issue you are trying to fix and reference
>the bug in your patch.
>
>Thanks.

I filed:

https://sourceware.org/bugzilla/show_bug.cgi?id=28151 elf: Some tst-audit* tests need ld --audit and --depaudit which do not work with gold or ld.lld
https://sourceware.org/bugzilla/show_bug.cgi?id=28152 elf: clang integrated assembler and ld.lld do not support .tls_common
https://sourceware.org/bugzilla/show_bug.cgi?id=28153 [test] gmon/tst-gmon-gprof* may have a f3 line when built with ld.lld
https://sourceware.org/bugzilla/show_bug.cgi?id=28154 [test] sysdeps/x86/tst-ifunc-isa-* lazy binding failure with ld.lld

If there is a need to amend patches, I'll attach the BZ numbers.


More information about the Libc-alpha mailing list