mbox series

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

Message ID 20210805162601.1200851-1-maskray@google.com
Headers show
Series Allow LLD 13.0.0 and improve compatibility with gold and clang | expand


Fāng-ruì Sòng Aug. 5, 2021, 4:25 p.m. UTC
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.

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 22 FAIL.
* ld.bfd has 14 FAIL.
* ld.lld has 16 FAIL. (With glibc bug BZ #28153 fixed)

(I am using a variant of the Debian testing (BZ #28177
libgcc_s.so.1), so even with GNU ld there may be relatively more
failures than Fedora/RedHat.

% ./testrun.sh stdlib/tst-quick_exit 
stdlib/tst-quick_exit: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

`make check` only has 2 more failures with LLD than with GNU ld:
BZ #28154 (LLD follows the PowerPC port of GNU ld for ifunc by
placing IRELATIVE relocations in .rela.dyn).
The set of dynamic symbols is the same with GNU ld and LLD,
modulo unused SHN_ABS version node symbols.

For comparison, gold does not support --enable-static-pie
(--no-dynamic-linker is unsupported BZ #22221), yet
has 6 failures more than LLD. gold linked libc.so has
larger .dynsym differences with GNU ld and LLD
(ISTM non-default version symbols are changed to default versions
by a version script).


I identified the lack of support of

* version script on non-default version symbols
* copy relocations on non-default version symbols

in an earlier snapshot of LLD 13.0.0 and fixed them.
The functionality of the LLD linked libc.so and ld.so looks pretty good.

Fangrui Song (3):
  elf: Replace .tls_common with .tbss definition [BZ #28152]
  elf: Skip tst-auditlogmod-* if the linker doesn't support --depaudit
    [BZ #28151]
  configure: Allow LD to be LLD 13.0.0 or above [BZ #26558]

 configure        | 111 +++++++++++++++++++++++++++++++++++++++++++++--
 configure.ac     |  24 +++++++---
 elf/Makefile     |   4 +-
 elf/tls-macros.h |   6 ++-
 4 files changed, 134 insertions(+), 11 deletions(-)