This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]