PR gold/12695
authorIan Lance Taylor <ian@airs.com>
Wed, 29 Jun 2011 21:26:40 +0000 (21:26 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 29 Jun 2011 21:26:40 +0000 (21:26 +0000)
* layout.cc (Layout::symtab_section_shndx): New function.
* layout.h (class Layout): Declare symtab_section_shndx.
* output.cc (Output_section::write_header): Call it.

gold/ChangeLog
gold/layout.cc
gold/layout.h
gold/output.cc

index e62857d8e9da4db08699f7c5d7f493e72a8ec7a7..bfb9a4087645867358b9d2b6b008ea188dfe0687 100644 (file)
@@ -1,3 +1,10 @@
+2011-06-29  Ian Lance Taylor  <iant@google.com>
+
+       PR gold/12695
+       * layout.cc (Layout::symtab_section_shndx): New function.
+       * layout.h (class Layout): Declare symtab_section_shndx.
+       * output.cc (Output_section::write_header): Call it.
+
 2011-06-29  Ian Lance Taylor  <iant@google.com>
 
        PR gold/12818
index 0ef13aff2390ee8bb2c443c9c6d553a7aae4d921..a52d35c7b2d315d72d4f475334ee78cfd4ffa4e0 100644 (file)
@@ -4536,6 +4536,17 @@ Layout::symtab_section_offset() const
   return 0;
 }
 
+// Return the section index of the normal symbol table.  It may have
+// been stripped by the -s/--strip-all option.
+
+unsigned int
+Layout::symtab_section_shndx() const
+{
+  if (this->symtab_section_ != NULL)
+    return this->symtab_section_->out_shndx();
+  return 0;
+}
+
 // Write out the Output_sections.  Most won't have anything to write,
 // since most of the data will come from input sections which are
 // handled elsewhere.  But some Output_sections do have Output_data.
index 4a437b5e1408022792649562384e0f94262870dd..4790584436e8fba7c7b34020a60e47ba674aebfe 100644 (file)
@@ -701,6 +701,10 @@ class Layout
   off_t
   symtab_section_offset() const;
 
+  // Return the section index of the normal symbol tabl.e
+  unsigned int
+  symtab_section_shndx() const;
+
   // Return the dynamic symbol table.
   Output_section*
   dynsym_section() const
index 8912c4e7ef23999583d6a7fd1fe81bf22457e5e4..8a781c5e87d9d1fc4a306a75acd62c3644662be9 100644 (file)
@@ -3390,7 +3390,7 @@ Output_section::write_header(const Layout* layout,
   if (this->link_section_ != NULL)
     oshdr->put_sh_link(this->link_section_->out_shndx());
   else if (this->should_link_to_symtab_)
-    oshdr->put_sh_link(layout->symtab_section()->out_shndx());
+    oshdr->put_sh_link(layout->symtab_section_shndx());
   else if (this->should_link_to_dynsym_)
     oshdr->put_sh_link(layout->dynsym_section()->out_shndx());
   else