public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Fangrui Song <maskray@google.com>,
	"H.J. Lu" <hjl.tools@gmail.com>,
	Libc-alpha <libc-alpha@sourceware.org>
Subject: LLD and glibc
Date: Mon, 25 Oct 2021 11:53:08 -0300	[thread overview]
Message-ID: <c0f2887b-8f57-f1e8-bd52-401b616770c0@linaro.org> (raw)

I tracked down the issues with lld on glibc and it seems slight better
than my previous attempt.

To use lld without having to mess with my toolchain installation, I was
trying to use -fuse-ld=lld plus -B option.  However it does not work
correctly with the LIBC_PROG_BINUTILS macro, since it issues the
passed CC with -print-prog-name=ld.  In this case gcc will always dump
the ld path, not the lld (it does work if I use -print-prog-name=lld).
I think this is a gcc issue since it should be agnostic whether
-fuse-ld is used, but I think we can try to workaround it on glibc
configure (use the -fuse-ld argument on -print-prog-name if the former
is presented).

So to actually use lld I had to adjust the links on my build-many-glibcs
built toolchain to explicit point to lld (both bin/x86_64-glibc-linux-gnu-ld
and x86_64-glibc-linux-gnu/bin/ld).

The new issue is the same H.J has reported some time earlier:

ld: error: cannot preempt symbol: foo_protected
>>> defined in /home/azanella/Projects/glibc/build/x86_64-linux-gnu-lld/elf/ifuncmod5.so
>>> referenced by ifuncmain5.c:22 (/home/azanella/Projects/glibc/glibc-git/elf/ifuncmain5.c:22)
>>>               /home/azanella/Projects/glibc/build/x86_64-linux-gnu-lld/elf/ifuncmain5.o:(get_foo_protected)

I think we should just disable the tests ldd does not support (with the
patch below) instead of get back of the discussion whether it should be
supported or not.

The good news is with release clang+llvm 13 and with the testcase patch
I could build and run make check successfully without any regression.

I am writing this because we need to fix both issues (configure with -fuse-ld
and the failure on make check) so we can start review the DT_RELR patchset [1]

[1] https://patchwork.sourceware.org/project/glibc/list/?series=3895

---

diff --git a/elf/Makefile b/elf/Makefile
index bdcf4cb885..7ddc4b39a3 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -427,11 +427,14 @@ ifeq (yes,$(build-shared))
 tests += tst-ifunc-fault-lazy tst-ifunc-fault-bindnow
 # Note: sysdeps/x86_64/ifuncmain8.c uses ifuncmain8.
 tests-internal += \
-        ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
+        ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
         ifuncmain1staticpic \
         ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
-        ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
+        ifuncmain5pic ifuncmain5staticpic \
         ifuncmain7 ifuncmain7pic
+ifeq (no,$(with-lld))
+test-internal += ifuncmain1 ifuncmain5
+endif
 ifeq (yes,$(have-gcc-ifunc))
 tests-internal += ifuncmain9 ifuncmain9pic
 endif
@@ -451,7 +454,10 @@ endif
 tests-internal += $(ifunc-pie-tests)
 tests-pie += $(ifunc-pie-tests)
 endif
-modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
+modules-names += ifuncmod1 ifuncmod3 ifuncmod6
+ifeq (no,$(with-lld))
+modules-names += ifuncmod5
+endif
 endif
 endif
 



             reply	other threads:[~2021-10-25 14:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 14:53 Adhemerval Zanella [this message]
2021-10-25 16:53 ` Fangrui Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0f2887b-8f57-f1e8-bd52-401b616770c0@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).