[PATCH 0/3] Make glibc build with LLD

Fāng-ruì Sòng maskray@google.com
Fri Jan 8 18:04:06 GMT 2021


On Fri, Jan 8, 2021 at 9:10 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Jan 7, 2021 at 9:05 PM Fāng-ruì Sòng via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> >
> > On Mon, Dec 28, 2020 at 11:48 AM Fangrui Song <maskray@google.com> wrote:
> > >
> > > I sent the first two in April. Resending in a patch series to be
> > > clearer.
> > >
> > >   install: Replace scripts/output-format.sed with objdump -f
> > >
> > > replaced https://sourceware.org/pipermail/libc-alpha/2020-April/112733.html
> > > by leveraging objdump -f.
> > >
> > > With this patch series (available in https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/maskray/lld),
> > > `make` with ld pointing to ld.lld (LLVM linker) works.
> > >
> > > Fangrui Song (3):
> > >   configure: Allow LD to be a linker other than GNU ld and gold
> > >   elf: Replace a --defsym trick with an object file to be compatible
> > >     with lld
> > >   install: Replace scripts/output-format.sed with objdump -f
> > >
> > >  Makerules                                     | 13 ++-----
> > >  .../strcoll-inputs/filelist#en_US.UTF-8       |  1 -
> > >  config.make.in                                |  1 -
> > >  configure                                     | 32 +++++------------
> > >  configure.ac                                  | 24 +++++--------
> > >  elf/Makefile                                  | 11 +++---
> > >  scripts/output-format.sed                     | 35 -------------------
> > >  7 files changed, 23 insertions(+), 94 deletions(-)
> > >  delete mode 100644 scripts/output-format.sed
> > >
> > > --
> > > 2.29.2.729.g45daf8777d-goog
> > >
> >
> > Hope "elf:" and "install:" can be reviewed (they are nice
> > simplification on their own), even if you don't want to take
> > "configure:" for now.
> >
> > For __rela_iplt_start, I gave a fair assessment on
> > https://bugs.llvm.org/show_bug.cgi?id=48674#c4 . I feel bad that an
> > improvable binutils issue caused the block of a static-pie relocation
> > improvement
>
> No.  There is no need to work around the lld bug which can be fixed.

I wish the glibc change does not make people feel "oh, we change glibc
just to adapt LLD".
I have provided my reasoning
(https://sourceware.org/bugzilla/show_bug.cgi?id=27164) why this is
not an LLD bug and I believe the reasoning is pretty solid (drop a
gratuitous difference between ld and ld -pie; clarify glibc code).

This is both a (future) cleanup opportunity for GNU ld and a
clarification for glibc csu/libc-start.c

> > "Make _dl_relocate_static_pie return an int indicating whether it
> > applied relocs." The other few failures (e.g. not supporting ld.lld
> > --audit / tls common) are not really usability affecting issues.
>
> "make check" should be clean.  Otherwise, we have no way to
> know if glibc is built properly on x86.
>
> --
> H.J.


More information about the Libc-alpha mailing list