This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Discard .gnu_debuglink sections
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Fri, 08 Jan 2010 13:08:47 -0800
- Subject: gold patch committed: Discard .gnu_debuglink sections
PR 11072 is about a failure with objcopy --add-gnu-debuglink for
binaries linked with gold. The test case in the PR has a
.gnu_debuglink section. objcopy --add-gnu-debuglink fails if the file
already has such a section. The GNU linker discards .gnu_debuglink
sections. So I changed gold to also discard those sections.
Committed to mainline.
Ian
2010-01-08 Ian Lance Taylor <iant@google.com>
PR 11072
* layout.cc (Layout::include_section): Remove .gnu_debuglink
sections.
Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.162
diff -p -u -r1.162 layout.cc
--- layout.cc 8 Jan 2010 19:33:17 -0000 1.162
+++ layout.cc 8 Jan 2010 21:07:08 -0000
@@ -352,6 +352,11 @@ Layout::include_section(Sized_relobj<siz
if (is_prefix_of(".gnu.lto_", name))
return false;
}
+ // The GNU linker strips .gnu_debuglink sections, so we do too.
+ // This is a feature used to keep debugging information in
+ // separate files.
+ if (strcmp(name, ".gnu_debuglink") == 0)
+ return false;
return true;
default: