gold: No .debug_aranges section when linking with --gdb-index

Martin Richtarsky
Wed Oct 10 10:46:00 GMT 2018


when I use gold with --gdb-index, the resulting binary is missing the
.debug_aranges section. The script below demonstrates the issue.
is linked without --gdb-index and has .debug_aranges, but not is this on purpose? .debug_aranges would be helpful for us
for fast callstack resolution.

Interestingly lld handles it differently (you can also test it with the
script below, just set the path to lld binutils)

Thanks and best regards,


set -eu
# gold binutils
# lld

# Without gdb-index
g++ -c lib1.cpp -o lib1.o
g++ $BINUTILS -shared lib1.o -o

# With gdb-index
g++ $BINUTILS -Wl,--gdb-index -shared lib1.o -o

set -o xtrace
objdump -h | grep aranges # has aranges with gold
objdump -h | grep aranges # has no aranges with gold (but
with lld)


More information about the Binutils mailing list