debugging collect2...
Nick Clifton
nickc@redhat.com
Mon Sep 7 09:54:58 GMT 2020
Hi Alan,
> I’m trying to debug a segv in ld when running the ld-pie tests.
> How do I debug this short of getting the core dump from the original segv
Try adding this to the gcc command line: -Wl,-debug
As in:
% gcc -v -fpie -pie -Wl,-debug hello.c
[...lots of output, ending with...]
/bin/ld -plugin /usr/libexec/gcc/x86_64-redhat-linux/9/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper -plugin-opt=-fresolution=/dev/shm/ccpbSR6d.res -plugin-opt=-pass-
[...etc...]
This will then give you a simple (ha!) command line to run, with no
environment variables needed.
The -debug option is actually a flag that is intercepted by the collect2
program, causing it to display the command(s) that it invokes.
Cheers
Nick
More information about the Binutils
mailing list