[PATCH v3] elf: Add back support for programs that do not load libc.so

Florian Weimer fweimer@redhat.com
Tue Nov 12 13:56:26 GMT 2024


* Andreas Schwab:

> On Nov 12 2024, Florian Weimer wrote:
>
>> +/* On some build configurations, the main program contains a reference
>> +   to __stack_chk_guard, but that cannot be resolved because this test
>> +   does not link against libc.so. Provide a definition here, so that
>> +   program is able to run.  Zero is a permitted, but unlikely value
>> +   for the stack guard.  */
>> +void *__stack_chk_guard;
>
> Why is that not resolved by the definition in ld.so?  It is never
> exported by libc.so.

Good question.  The Linaro CI reports this (on aarch64):

/home/tcwg-build/workspace/tcwg_gnu_4/abe/builds/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/glibc-glibc.git~master/elf/tst-nolink-libc: symbol lookup error: /home/tcwg-build/workspace/tcwg_gnu_4/abe/builds/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/glibc-glibc.git~master/elf/ld.so: undefined symbol: __stack_chk_guard, version GLIBC_2.17

I have not been able to reproduce it with my own aarch64 builds.  Given
the error, it did not occur to me to search for a definition in ld.so
itself.  I agree it must be there.

I suspect it's a corner case in how the search scope is set up, but I'm
out of ideas here.

Thanks,
Florian



More information about the Libc-alpha mailing list