* debugging collect2...
@ 2020-09-04 19:06 Alan Lehotsky
2020-09-07 9:54 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Alan Lehotsky @ 2020-09-04 19:06 UTC (permalink / raw)
To: binutils
I’m trying to debug a segv in ld when running the ld-pie tests.
I did a
gcc -v -pie -o pie $src/binutils/ld/testsuite/ld-pie/pie.c
and get the collect line.
There appear to be a bunch of env vars that get reported in the sequence…
I then startup gdb on collect2
Do a number of
set env …
to setup the envars
Then in order to get the ld that’s crashing,
set follow-fork child
and then run collect2 with the args.
run -plugin /local/mnt/nx/alehotsk/fixup/toolchain/install/bin/../libexec/gcc/XXX-none-elf/8.1.1/liblto_plugin.so -plugin-opt=/local/mnt/nx/alehotsk/fixup/XXX-toolchain/install/bin/../libexec/gcc/XXX-none-elf/8.1.1/lto-wrapper -plugin-opt=-fresolution=pie.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc -V -Qy -EL -pie -o pie /local/mnt/nx/alehotsk/fixup/XXX-toolchain/install/bin/../lib/gcc/XXX-none-elf/8.1.1/../../../../XXX-none-elf/lib/crt0.o /local/mnt/nx/alehotsk/fixup/XXX-toolchain/install/bin/../lib/gcc/XXX-none-elf/8.1.1/crti.o /local/mnt/nx/alehotsk/fixup/XXX-toolchain/install/bin/../lib/gcc/XXX-none-elf/8.1.1/crtbegin.o -L/local/mnt/nx/alehotsk/fixup/XXX-toolchain/install/bin/../lib/gcc/XXX-none-elf/8.1.1 -L/local/mnt/nx/alehotsk/fixup/XXX-toolchain/install/bin/../lib/gcc -L/local/mnt/nx/alehotsk/fixup/XXX-toolchain/install/bin/../lib/gcc/XXX-none-elf/8.1.1/../../../../XXX-none-elf/lib pie.o -lgcc --start-group -lc -lgcc --end-group -lgcc /local/mnt/nx/alehotsk/fixup/XXX-toolchain/install/bin/../lib/gcc/XXX-none-elf/8.1.1/crtend.o /local/mnt/nx/alehotsk/fixup/XXX-toolchain/install/bin/../lib/gcc/XXX-none-elf/8.1.1/crtn.o
collect2: fatal error: cannot find ‘ld'
compilation terminated.
How do I debug this short of getting the core dump from the original segv
Alan Lehotsky
https://codegentllc.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: debugging collect2...
2020-09-04 19:06 debugging collect2 Alan Lehotsky
@ 2020-09-07 9:54 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2020-09-07 9:54 UTC (permalink / raw)
To: apl, binutils
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-07 9:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 19:06 debugging collect2 Alan Lehotsky
2020-09-07 9:54 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).