This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Do not discard SHF_EXCLUDE sections for -r links
- From: Sriraman Tallam <tmsriram at google dot com>
- To: Ian Lance Taylor <iant at google dot com>, Cary Coutant <ccoutant at google dot com>, binutils <binutils at sourceware dot org>
- Date: Mon, 15 Oct 2012 17:24:27 -0700
- Subject: Do not discard SHF_EXCLUDE sections for -r links
Hi,
BFD ld does not discard SHF_EXCLUDE sections for relocatable links
whereas gold does. This simple patch fixes this. Is this ok to
submit?
* layout.cc (Layout::include_section): Keep sections marked
SHF_EXCLUDE when doing relocatable links.
Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.238
diff -u -u -p -r1.238 layout.cc
--- layout.cc 10 Sep 2012 23:10:41 -0000 1.238
+++ layout.cc 16 Oct 2012 00:23:38 -0000
@@ -582,7 +582,8 @@ bool
Layout::include_section(Sized_relobj_file<size, big_endian>*, const char* name,
const elfcpp::Shdr<size, big_endian>& shdr)
{
- if (shdr.get_sh_flags() & elfcpp::SHF_EXCLUDE)
+ if (!parameters->options().relocatable()
+ && (shdr.get_sh_flags() & elfcpp::SHF_EXCLUDE))
return false;
switch (shdr.get_sh_type())
Thanks,
-Sri.