* [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd @ 2022-11-06 18:17 Fangrui Song 2022-11-06 21:21 ` Sam James 2022-11-07 8:31 ` Florian Weimer 0 siblings, 2 replies; 11+ messages in thread From: Fangrui Song @ 2022-11-06 18:17 UTC (permalink / raw) To: libc-alpha, Florian Weimer; +Cc: Fangrui Song lld does not dump a linker script with --verbose (it does not use a linker script driven design and lots of linker processing is not serializable as a linker script anyway). With the default --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. Just dump the linker script with -fuse-ld=bfd. lld since 15 (https://reviews.llvm.org/D124656) supports custom RELRO sections in the GNU ld dumped linker script. --- Makerules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makerules b/Makerules index 09c0cf8357..2edc6ee4e1 100644 --- a/Makerules +++ b/Makerules @@ -553,7 +553,7 @@ else # not for shared objects $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules $(LINK.o) -shared -Wl,-O1 \ - -nostdlib -nostartfiles \ + -nostdlib -nostartfiles -fuse-ld=bfd \ $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \ -Wl,--verbose 2>/dev/null | \ sed > $@T \ -- 2.38.1.431.g37b22c650d-goog ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd 2022-11-06 18:17 [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd Fangrui Song @ 2022-11-06 21:21 ` Sam James 2022-11-06 23:06 ` Fangrui Song 2022-11-07 8:31 ` Florian Weimer 1 sibling, 1 reply; 11+ messages in thread From: Sam James @ 2022-11-06 21:21 UTC (permalink / raw) To: Fangrui Song; +Cc: libc-alpha, Florian Weimer [-- Attachment #1: Type: text/plain, Size: 591 bytes --] > On 6 Nov 2022, at 18:17, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: > > lld does not dump a linker script with --verbose (it does not use a > linker script driven design and lots of linker processing is not > serializable as a linker script anyway). With the default > --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. > > Just dump the linker script with -fuse-ld=bfd. lld since 15 > (https://reviews.llvm.org/D124656) supports custom RELRO sections in the > GNU ld dumped linker script. > --- What if bfd isn't installed? [-- Attachment #2: Message signed with OpenPGP --] [-- Type: application/pgp-signature, Size: 358 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd 2022-11-06 21:21 ` Sam James @ 2022-11-06 23:06 ` Fangrui Song 2022-11-06 23:12 ` Sam James 0 siblings, 1 reply; 11+ messages in thread From: Fangrui Song @ 2022-11-06 23:06 UTC (permalink / raw) To: Sam James; +Cc: libc-alpha, Florian Weimer On 2022-11-06, Sam James wrote: > > >> On 6 Nov 2022, at 18:17, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: >> >> lld does not dump a linker script with --verbose (it does not use a >> linker script driven design and lots of linker processing is not >> serializable as a linker script anyway). With the default >> --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. >> >> Just dump the linker script with -fuse-ld=bfd. lld since 15 >> (https://reviews.llvm.org/D124656) supports custom RELRO sections in the >> GNU ld dumped linker script. >> --- > >What if bfd isn't installed? Then --with-default-link=yes has to be used:) ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd 2022-11-06 23:06 ` Fangrui Song @ 2022-11-06 23:12 ` Sam James 2022-11-06 23:15 ` Fangrui Song 2022-11-06 23:21 ` Fangrui Song 0 siblings, 2 replies; 11+ messages in thread From: Sam James @ 2022-11-06 23:12 UTC (permalink / raw) To: Fangrui Song; +Cc: Carlos O'Donell via Libc-alpha, Florian Weimer [-- Attachment #1: Type: text/plain, Size: 852 bytes --] > On 6 Nov 2022, at 23:06, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: > > On 2022-11-06, Sam James wrote: >> >> >>> On 6 Nov 2022, at 18:17, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: >>> >>> lld does not dump a linker script with --verbose (it does not use a >>> linker script driven design and lots of linker processing is not >>> serializable as a linker script anyway). With the default >>> --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. >>> >>> Just dump the linker script with -fuse-ld=bfd. lld since 15 >>> (https://reviews.llvm.org/D124656) supports custom RELRO sections in the >>> GNU ld dumped linker script. >>> --- >> >> What if bfd isn't installed? > > Then --with-default-link=yes has to be used:) Configure should check in that case. [-- Attachment #2: Message signed with OpenPGP --] [-- Type: application/pgp-signature, Size: 358 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd 2022-11-06 23:12 ` Sam James @ 2022-11-06 23:15 ` Fangrui Song 2022-11-06 23:15 ` Sam James 2022-11-06 23:21 ` Fangrui Song 1 sibling, 1 reply; 11+ messages in thread From: Fangrui Song @ 2022-11-06 23:15 UTC (permalink / raw) To: Sam James; +Cc: Carlos O'Donell via Libc-alpha, Florian Weimer On 2022-11-06, Sam James wrote: > > >> On 6 Nov 2022, at 23:06, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: >> >> On 2022-11-06, Sam James wrote: >>> >>> >>>> On 6 Nov 2022, at 18:17, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: >>>> >>>> lld does not dump a linker script with --verbose (it does not use a >>>> linker script driven design and lots of linker processing is not >>>> serializable as a linker script anyway). With the default >>>> --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. >>>> >>>> Just dump the linker script with -fuse-ld=bfd. lld since 15 >>>> (https://reviews.llvm.org/D124656) supports custom RELRO sections in the >>>> GNU ld dumped linker script. >>>> --- >>> >>> What if bfd isn't installed? >> >> Then --with-default-link=yes has to be used:) > >Configure should check in that case. The patch isn't worse than the current state: if ld => lld, the build will just fail due to `test -s $@T` (the linker script is empty). ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd 2022-11-06 23:15 ` Fangrui Song @ 2022-11-06 23:15 ` Sam James 0 siblings, 0 replies; 11+ messages in thread From: Sam James @ 2022-11-06 23:15 UTC (permalink / raw) To: Fangrui Song; +Cc: Carlos O'Donell via Libc-alpha, Florian Weimer [-- Attachment #1: Type: text/plain, Size: 1232 bytes --] > On 6 Nov 2022, at 23:15, Fangrui Song <maskray@google.com> wrote: > > On 2022-11-06, Sam James wrote: >> >> >>> On 6 Nov 2022, at 23:06, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: >>> >>> On 2022-11-06, Sam James wrote: >>>> >>>> >>>>> On 6 Nov 2022, at 18:17, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: >>>>> >>>>> lld does not dump a linker script with --verbose (it does not use a >>>>> linker script driven design and lots of linker processing is not >>>>> serializable as a linker script anyway). With the default >>>>> --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. >>>>> >>>>> Just dump the linker script with -fuse-ld=bfd. lld since 15 >>>>> (https://reviews.llvm.org/D124656) supports custom RELRO sections in the >>>>> GNU ld dumped linker script. >>>>> --- >>>> >>>> What if bfd isn't installed? >>> >>> Then --with-default-link=yes has to be used:) >> >> Configure should check in that case. > > The patch isn't worse than the current state: if ld => lld, the build > will just fail due to `test -s $@T` (the linker script is empty). Sure, but could you add a quick configure check while you're here? [-- Attachment #2: Message signed with OpenPGP --] [-- Type: application/pgp-signature, Size: 358 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd 2022-11-06 23:12 ` Sam James 2022-11-06 23:15 ` Fangrui Song @ 2022-11-06 23:21 ` Fangrui Song 1 sibling, 0 replies; 11+ messages in thread From: Fangrui Song @ 2022-11-06 23:21 UTC (permalink / raw) To: Sam James; +Cc: Carlos O'Donell via Libc-alpha, Florian Weimer On 2022-11-06, Sam James wrote: > > >> On 6 Nov 2022, at 23:06, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: >> >> On 2022-11-06, Sam James wrote: >>> >>> >>>> On 6 Nov 2022, at 18:17, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: >>>> >>>> lld does not dump a linker script with --verbose (it does not use a >>>> linker script driven design and lots of linker processing is not >>>> serializable as a linker script anyway). With the default >>>> --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. >>>> >>>> Just dump the linker script with -fuse-ld=bfd. lld since 15 >>>> (https://reviews.llvm.org/D124656) supports custom RELRO sections in the >>>> GNU ld dumped linker script. >>>> --- >>> >>> What if bfd isn't installed? >> >> Then --with-default-link=yes has to be used:) > >Configure should check in that case. I am unsure whether the additioinal complexity is worthwhile (and how?). The patch is a follow-up to my comment in April: https://sourceware.org/pipermail/libc-alpha/2022-April/138278.html where the changed --with-default-link default required my lld build to specify --with-default-link=yes explicitly. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd 2022-11-06 18:17 [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd Fangrui Song 2022-11-06 21:21 ` Sam James @ 2022-11-07 8:31 ` Florian Weimer 2022-11-08 0:06 ` Sam James 1 sibling, 1 reply; 11+ messages in thread From: Florian Weimer @ 2022-11-07 8:31 UTC (permalink / raw) To: Fangrui Song; +Cc: libc-alpha * Fangrui Song: > lld does not dump a linker script with --verbose (it does not use a > linker script driven design and lots of linker processing is not > serializable as a linker script anyway). With the default > --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. > > Just dump the linker script with -fuse-ld=bfd. lld since 15 > (https://reviews.llvm.org/D124656) supports custom RELRO sections in the > GNU ld dumped linker script. > --- > Makerules | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Makerules b/Makerules > index 09c0cf8357..2edc6ee4e1 100644 > --- a/Makerules > +++ b/Makerules > @@ -553,7 +553,7 @@ else > # not for shared objects > $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules > $(LINK.o) -shared -Wl,-O1 \ > - -nostdlib -nostartfiles \ > + -nostdlib -nostartfiles -fuse-ld=bfd \ > $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \ > -Wl,--verbose 2>/dev/null | \ > sed > $@T \ Would you please add the comment? I'm not sure if a configure check is required. We have a path towards removal of the custom linker script; the vfprintf refactor I posted is a first step. Thanks, Florian ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd 2022-11-07 8:31 ` Florian Weimer @ 2022-11-08 0:06 ` Sam James 2022-11-08 0:22 ` Fangrui Song 0 siblings, 1 reply; 11+ messages in thread From: Sam James @ 2022-11-08 0:06 UTC (permalink / raw) To: Florian Weimer; +Cc: Fangrui Song, libc-alpha [-- Attachment #1: Type: text/plain, Size: 1383 bytes --] > On 7 Nov 2022, at 08:31, Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> wrote: > > * Fangrui Song: > >> lld does not dump a linker script with --verbose (it does not use a >> linker script driven design and lots of linker processing is not >> serializable as a linker script anyway). With the default >> --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. >> >> Just dump the linker script with -fuse-ld=bfd. lld since 15 >> (https://reviews.llvm.org/D124656) supports custom RELRO sections in the >> GNU ld dumped linker script. >> --- >> Makerules | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/Makerules b/Makerules >> index 09c0cf8357..2edc6ee4e1 100644 >> --- a/Makerules >> +++ b/Makerules >> @@ -553,7 +553,7 @@ else >> # not for shared objects >> $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules >> $(LINK.o) -shared -Wl,-O1 \ >> - -nostdlib -nostartfiles \ >> + -nostdlib -nostartfiles -fuse-ld=bfd \ >> $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \ >> -Wl,--verbose 2>/dev/null | \ >> sed > $@T \ > > Would you please add the comment? > > I'm not sure if a configure check is required. We have a path towards > removal of the custom linker script; the vfprintf refactor I posted is a > first step. > That works for me. [-- Attachment #2: Message signed with OpenPGP --] [-- Type: application/pgp-signature, Size: 358 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd 2022-11-08 0:06 ` Sam James @ 2022-11-08 0:22 ` Fangrui Song 2022-11-08 0:29 ` Sam James 0 siblings, 1 reply; 11+ messages in thread From: Fangrui Song @ 2022-11-08 0:22 UTC (permalink / raw) To: Sam James, Florian Weimer; +Cc: libc-alpha On 2022-11-08, Sam James wrote: > > >> On 7 Nov 2022, at 08:31, Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> wrote: >> >> * Fangrui Song: >> >>> lld does not dump a linker script with --verbose (it does not use a >>> linker script driven design and lots of linker processing is not >>> serializable as a linker script anyway). With the default >>> --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. >>> >>> Just dump the linker script with -fuse-ld=bfd. lld since 15 >>> (https://reviews.llvm.org/D124656) supports custom RELRO sections in the >>> GNU ld dumped linker script. >>> --- >>> Makerules | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/Makerules b/Makerules >>> index 09c0cf8357..2edc6ee4e1 100644 >>> --- a/Makerules >>> +++ b/Makerules >>> @@ -553,7 +553,7 @@ else >>> # not for shared objects >>> $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules >>> $(LINK.o) -shared -Wl,-O1 \ >>> - -nostdlib -nostartfiles \ >>> + -nostdlib -nostartfiles -fuse-ld=bfd \ >>> $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \ >>> -Wl,--verbose 2>/dev/null | \ >>> sed > $@T \ >> >> Would you please add the comment? >> >> I'm not sure if a configure check is required. We have a path towards >> removal of the custom linker script; the vfprintf refactor I posted is a >> first step. >> > >That works for me. > > Added comments... From 00ee52ee0753a8d849c23d4e051f10aa8a4e2074 Mon Sep 17 00:00:00 2001 From: Fangrui Song <maskray@google.com> Date: Mon, 7 Nov 2022 16:21:13 -0800 Subject: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd lld does not dump a linker script with --verbose (it does not use a linker script driven design and lots of linker processing is not serializable as a linker script anyway). With the default --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. Just dump the linker script with -fuse-ld=bfd. lld since 15 (https://reviews.llvm.org/D124656) supports custom RELRO sections in the GNU ld dumped linker script. --- Makerules | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makerules b/Makerules index 09c0cf8357..ed6873a1a8 100644 --- a/Makerules +++ b/Makerules @@ -546,14 +546,16 @@ endef ifeq (yes,$(use-default-link)) # If the linker is good enough, we can let it use its default linker script. +# In the long term the custom linker script will be removed. shlib-lds = shlib-lds-flags = else # binutils only position loadable notes into the first page for binaries, # not for shared objects +# lld --verbose does not dump a linker script. Use -fuse-ld=bfd. $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules $(LINK.o) -shared -Wl,-O1 \ - -nostdlib -nostartfiles \ + -nostdlib -nostartfiles -fuse-ld=bfd \ $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \ -Wl,--verbose 2>/dev/null | \ sed > $@T \ -- 2.38.1.431.g37b22c650d-goog ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd 2022-11-08 0:22 ` Fangrui Song @ 2022-11-08 0:29 ` Sam James 0 siblings, 0 replies; 11+ messages in thread From: Sam James @ 2022-11-08 0:29 UTC (permalink / raw) To: Fangrui Song; +Cc: Florian Weimer, libc-alpha [-- Attachment #1: Type: text/plain, Size: 2406 bytes --] > On 8 Nov 2022, at 00:22, Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> wrote: > > On 2022-11-08, Sam James wrote: >> >> >>> On 7 Nov 2022, at 08:31, Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> wrote: >>> >>> * Fangrui Song: >>> >>>> lld does not dump a linker script with --verbose (it does not use a >>>> linker script driven design and lots of linker processing is not >>>> serializable as a linker script anyway). With the default >>>> --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. >>>> >>>> Just dump the linker script with -fuse-ld=bfd. lld since 15 >>>> (https://reviews.llvm.org/D124656) supports custom RELRO sections in the >>>> GNU ld dumped linker script. >>>> --- >>>> Makerules | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/Makerules b/Makerules >>>> index 09c0cf8357..2edc6ee4e1 100644 >>>> --- a/Makerules >>>> +++ b/Makerules >>>> @@ -553,7 +553,7 @@ else >>>> # not for shared objects >>>> $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules >>>> $(LINK.o) -shared -Wl,-O1 \ >>>> - -nostdlib -nostartfiles \ >>>> + -nostdlib -nostartfiles -fuse-ld=bfd \ >>>> $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \ >>>> -Wl,--verbose 2>/dev/null | \ >>>> sed > $@T \ >>> >>> Would you please add the comment? >>> >>> I'm not sure if a configure check is required. We have a path towards >>> removal of the custom linker script; the vfprintf refactor I posted is a >>> first step. >>> >> >> That works for me. >> >> > > Added comments... > > > From 00ee52ee0753a8d849c23d4e051f10aa8a4e2074 Mon Sep 17 00:00:00 2001 > From: Fangrui Song <maskray@google.com> > Date: Mon, 7 Nov 2022 16:21:13 -0800 > Subject: [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd > > lld does not dump a linker script with --verbose (it does not use a > linker script driven design and lots of linker processing is not > serializable as a linker script anyway). With the default > --with-default-link=no build, $@T is empty and makes `test -s $@T` fail. > > Just dump the linker script with -fuse-ld=bfd. lld since 15 > (https://reviews.llvm.org/D124656) supports custom RELRO sections in the > GNU ld dumped linker script. > --- Thanks! Reviewed-by: Sam James <sam@gentoo.org <mailto:sam@gentoo.org>> [-- Attachment #2: Message signed with OpenPGP --] [-- Type: application/pgp-signature, Size: 358 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-11-08 0:30 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-11-06 18:17 [PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd Fangrui Song 2022-11-06 21:21 ` Sam James 2022-11-06 23:06 ` Fangrui Song 2022-11-06 23:12 ` Sam James 2022-11-06 23:15 ` Fangrui Song 2022-11-06 23:15 ` Sam James 2022-11-06 23:21 ` Fangrui Song 2022-11-07 8:31 ` Florian Weimer 2022-11-08 0:06 ` Sam James 2022-11-08 0:22 ` Fangrui Song 2022-11-08 0:29 ` Sam James
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).