aboutsummaryrefslogtreecommitdiff
path: root/gold/script-sections.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2016-12-12 18:51:29 -0800
committerCary Coutant <ccoutant@gmail.com>2016-12-12 18:52:44 -0800
commitbfbf34de2f27672282d4fa4c0916cc41890dcc6c (patch)
tree8000687927ea911cc49c035dce75659aab3bbbdf /gold/script-sections.cc
parentd81222d3863037a90e0402cf438f7e45600feea2 (diff)
downloadgdb-bfbf34de2f27672282d4fa4c0916cc41890dcc6c.zip
gdb-bfbf34de2f27672282d4fa4c0916cc41890dcc6c.tar.gz
gdb-bfbf34de2f27672282d4fa4c0916cc41890dcc6c.tar.bz2
When using linker scripts, place linker-generated sections by the output section name.
2016-12-12 Igor Kudrin <ikudrin@accesssoftek.com> Cary Coutant <ccoutant@gmail.com> gold/ PR gold/14676 * script-sections.cc (Output_section_definition::output_section_name): For linker-generated sections, compare with output section name. * testsuite/Makefile.am (script_test_13): New test. * testsuite/Makefile.in: Regenerate. * testsuite/script_test_13.c: New source file. * testsuite/script_test_13.sh: New script. * testsuite/script_test_13.t: New linker script.
Diffstat (limited to 'gold/script-sections.cc')
-rw-r--r--gold/script-sections.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/gold/script-sections.cc b/gold/script-sections.cc
index d970e57..90ec8d4 100644
--- a/gold/script-sections.cc
+++ b/gold/script-sections.cc
@@ -2291,6 +2291,17 @@ Output_section_definition::output_section_name(
Script_sections::Section_type* psection_type,
bool* keep)
{
+ // If the input section is linker-created, just look for a match
+ // on the output section name.
+ if (file_name == NULL && this->name_ != "/DISCARD/")
+ {
+ if (this->name_ != section_name)
+ return NULL;
+ *slot = &this->output_section_;
+ *psection_type = this->section_type();
+ return this->name_.c_str();
+ }
+
// Ask each element whether it matches NAME.
for (Output_section_elements::const_iterator p = this->elements_.begin();
p != this->elements_.end();