* layout.cc (Layout::include_section): Do not discard unrecognized
authorIan Lance Taylor <ian@airs.com>
Fri, 4 Jul 2008 03:34:01 +0000 (03:34 +0000)
committerIan Lance Taylor <ian@airs.com>
Fri, 4 Jul 2008 03:34:01 +0000 (03:34 +0000)
SHT_STRTAB sections.

gold/ChangeLog
gold/layout.cc

index d73e1cd9d889bcfddd2a70d7ad1da9bc7fb2b021..f0f2c13f55745d3a566c3ea307735cec00f671ab 100644 (file)
@@ -1,3 +1,8 @@
+2008-07-03  Ian Lance Taylor  <iant@google.com>
+
+       * layout.cc (Layout::include_section): Do not discard unrecognized
+       SHT_STRTAB sections.
+
 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
 
        * script.cc (Lex::can_continue_name): Make '?' allowable in
index 2c8c5241fb5eedba0c98860c3d49373d523e9eaa..62ccaae2b1ea450b7c3f0cdeabc3e8948d85cd3f 100644 (file)
@@ -210,12 +210,19 @@ Layout::include_section(Sized_relobj<size, big_endian>*, const char* name,
     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: