[PATCH] Makerules: Remove no-op -Wl,-d when linking libc_pic.os
Florian Weimer
fw@deneb.enyo.de
Mon Jun 27 08:04:04 GMT 2022
* Fangrui Song:
>>Do you know what the .gnu.glibc-stub.* processing processing refers
>>to?
>
> [a] Just few lines below, there is
>
> # Generate a list of -R options to excise .gnu.glibc-stub.* sections.
>
> The idea is to create libc_pic.os from libc_pic.a, strip .gnu.glibc-stub.*, then link libc_pic.os.clean into libc.so.
>
> Technically the relocatable link can be omitted. We can change `build-shlib`
> to link -Wl,--whole-archive libc_pic.a -Wl,--no-whole-archive instead. objcopy -R works on an archive for
> a long time. I am unsure whether the 1990+ objcopy supports archives.
> But at a first glance I do not find a good place to insert -Wl,--whole-archive into build-shlib...
For linking libc.so, we can list the objects directly, then we don't
need -Wl,--whole-archive.
For linking ld.so, we do not use -Wl,--whole-archive because we
actually want to link a subset. I was under the impression that we
rebuild objects for inclusion into ld.so, so I'm rather puzzled that
we need this.
> [b] Around $(objpfx)stubs: $(objs-for-stubs), we can see that
> .gnu.glibc-stub.* is to generate */stubs files and finally testroot.root/$prefix/include/gnu/stubs-64.h
>
> % cat testroot.root/tmp/glibc/lld/include/gnu/stubs-64.h
> /* This file is automatically generated.
> It defines a symbol `__stub_FUNCTION' for each function
> in the C library which is a stub, meaning it will fail
> every time called, usually setting errno to ENOSYS. */
>
> #ifdef _LIBC
> #error Applications may not define the macro _LIBC
> #endif
>
> #define __stub___compat_bdflush
> #define __stub_chflags
> #define __stub_fchflags
> #define __stub_gtty
> #define __stub_revoke
> #define __stub_setlogin
> #define __stub_sigreturn
> #define __stub_stty
Those warning sections must propagate into libc.so, so I think we
could parse that and the generate header from it.
More information about the Libc-alpha
mailing list