Using gold build from [1] and a 32-bit dump_syms from Google breakpad. Take a hello world program and compile it without gold: gcc -m32 -gstabs hello.c -o hello and then run dump_syms hello will produce: MODULE Linux x86 1888DA9DFDD4858254E7EA9FD030F83D0 hello FILE 0 hello.c FUNC 374 2b 0 main 374 11 4 0 385 c 5 0 391 5 6 0 396 9 7 0 then run: gcc -m32 -gstabs -B/path/to/dir_with_gold hello.c -o hello and I get: MODULE Linux x86 C170460C4897C338F08D0B7886DAD6D50 hello FUNC 1e4 2b 0 1e4 11 4 -1 1f5 c 5 -1 201 5 6 -1 206 9 7 -1 [1] ftp://sourceware.org/pub/binutils/snapshots/binutils-2.19.51.tar.bz2
Subject: Bug 10219 CVSROOT: /cvs/src Module name: src Changes by: ian@sourceware.org 2009-06-24 00:38:00 Modified files: gold : ChangeLog layout.cc layout.h Log message: PR 10219 * layout.cc (Layout::Layout): Initialize have_stabstr_section_. (Layout::make_output_section): Set have_stabstr_section_ if we see a .stab*str section. (Layout::finalize): Call link_stabs_sections. (Layout::link_stabs_sections): New file. * layout.h (class Layout): Add have_stabstr_section_ field. Declare link_stabs_sections. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.248&r2=1.249 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/layout.cc.diff?cvsroot=src&r1=1.128&r2=1.129 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gold/layout.h.diff?cvsroot=src&r1=1.65&r2=1.66
Thanks for the bug report. The GNU linker links .stab and .stabstr sections, and dump_syms was relying on that to find the .stabstr section. I just committed a patch to gold to link the sections in the same way, which fixes this problem.
Works for me.