aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-06-29 21:26:40 +0000
committerIan Lance Taylor <ian@airs.com>2011-06-29 21:26:40 +0000
commit886f533adaf49c51722d4b02a309e88dd8c1c239 (patch)
tree130f63d0501a03ee8b6c36227576821cb332f2ea /gold
parenta4e064680b35eab949a2511d159bc9fe921f84e7 (diff)
downloadfsf-binutils-gdb-886f533adaf49c51722d4b02a309e88dd8c1c239.zip
fsf-binutils-gdb-886f533adaf49c51722d4b02a309e88dd8c1c239.tar.gz
fsf-binutils-gdb-886f533adaf49c51722d4b02a309e88dd8c1c239.tar.bz2
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.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog7
-rw-r--r--gold/layout.cc11
-rw-r--r--gold/layout.h4
-rw-r--r--gold/output.cc2
4 files changed, 23 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index e62857d..bfb9a40 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,12 @@
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
* symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
symbols which are not used in a relocation.
diff --git a/gold/layout.cc b/gold/layout.cc
index 0ef13af..a52d35c 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -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.
diff --git a/gold/layout.h b/gold/layout.h
index 4a437b5..4790584 100644
--- a/gold/layout.h
+++ b/gold/layout.h
@@ -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
diff --git a/gold/output.cc b/gold/output.cc
index 8912c4e..8a781c5 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -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