[PATCH] Makerules: Generate shlib.lds with -fuse-ld=bfd

Sam James sam@gentoo.org
Tue Nov 8 00:29:52 GMT 2022



> 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>>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 358 bytes
Desc: Message signed with OpenPGP
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20221108/f3903dfe/attachment.sig>


More information about the Libc-alpha mailing list