Static application with --dynamic-list crashes

Florian Weimer fweimer@redhat.com
Thu Mar 16 08:31:00 GMT 2017


On 03/15/2017 09:08 AM, Alexey Neyman wrote:
> The problem I noticed was that in crosstool-ng, when a gdbserver is
> linked statically, it requests a strange path as the dynamic linker
> (/lib/ld64.so.1). This path is the default in ld when it creates a
> dynamically linked application and there was no --dynamic-linker= option
> passed in. In this case, the application was linked with "-static
> -Wl,--dynamic-list=some.file". With these options, GCC does not pass
> --dynamic-linker (because -static is in effect) - but ld thinks it links
> a dynamically linked app because of the --dynamic-list.

gdbserver compatibility will be much improved if you dynamically link it 
against a really old glibc.

The problem here is that multi-threading support in gdbserver currently 
needs loading of the host libthread_db.  When linked statically, this 
requires the exact same version of glibc (and its libthread_db) against 
which gdbserver was linked statically.  When gdbserver is linked 
dynamically, any version which is not earlier then what gdbserver was 
linked against will do instead.

Infinity support may change that, Cc:ing Gary.

So while there might be a glibc bug here, fixing it will not actually 
give you a generally usable statically linked gdbserver, I'm afraid.

Thanks,
Florian



More information about the Libc-alpha mailing list