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]

PATCH COMMITTED: Don't discard .stabstr sections


Clearly nobody uses stabs debugging any more, since it turns out that
gold didn't handle it correctly.  gold would discard the .stabstr
section, because it discarded all SHT_STRTAB sections in the input
files.  I changed it to only discard the ones explicitly listed in the
ABI.

Ian


2008-07-03  Ian Lance Taylor  <iant@google.com>

	* layout.cc (Layout::include_section): Do not discard unrecognized
	SHT_STRTAB sections.


Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.106
diff -u -p -r1.106 layout.cc
--- layout.cc	28 May 2008 20:48:16 -0000	1.106
+++ layout.cc	4 Jul 2008 03:32:54 -0000
@@ -210,12 +210,19 @@ Layout::include_section(Sized_relobj<siz
     case elfcpp::SHT_NULL:
     case elfcpp::SHT_SYMTAB:
     case elfcpp::SHT_DYNSYM:
-    case elfcpp::SHT_STRTAB:
     case elfcpp::SHT_HASH:
     case elfcpp::SHT_DYNAMIC:
     case elfcpp::SHT_SYMTAB_SHNDX:
       return false;
 
+    case elfcpp::SHT_STRTAB:
+      // Discard the sections which have special meanings in the ELF
+      // ABI.  Keep others (e.g., .stabstr).  We could also do this by
+      // checking the sh_link fields of the appropriate sections.
+      return (strcmp(name, ".dynstr") != 0
+	      && strcmp(name, ".strtab") != 0
+	      && strcmp(name, ".shstrtab") != 0);
+
     case elfcpp::SHT_RELA:
     case elfcpp::SHT_REL:
     case elfcpp::SHT_GROUP:

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