diff options
author | Ian Lance Taylor <iant@google.com> | 2008-02-28 00:51:07 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2008-02-28 00:51:07 +0000 |
commit | 15cf077ef4df71bb31c803ed9cf94d8ccdb72dc5 (patch) | |
tree | 581d8124648674e0f604a23717f910e67a2a151e | |
parent | 8851eccaec28f25f56fab5ba5d8ae44f71729975 (diff) | |
download | gdb-15cf077ef4df71bb31c803ed9cf94d8ccdb72dc5.zip gdb-15cf077ef4df71bb31c803ed9cf94d8ccdb72dc5.tar.gz gdb-15cf077ef4df71bb31c803ed9cf94d8ccdb72dc5.tar.bz2 |
Put input sections with no flags in output sections with the same name.
-rw-r--r-- | gold/layout.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gold/layout.cc b/gold/layout.cc index df10498..c125014 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -236,8 +236,21 @@ Layout::get_output_section(const char* name, Stringpool::Key name_key, else { // This is the first time we've seen this name/type/flags - // combination. - Output_section* os = this->make_output_section(name, type, flags); + // combination. If the section has contents but no flags, then + // see whether we have an existing section with the same name. + // This is a workaround for cases where assembler code forgets + // to set section flags, and the GNU linker would simply pick an + // existing section with the same name. FIXME: Perhaps there + // should be an option to control this. + Output_section* os = NULL; + if (type == elfcpp::SHT_PROGBITS && flags == 0) + { + os = this->find_output_section(name); + if (os != NULL && os->type() != elfcpp::SHT_PROGBITS) + os = NULL; + } + if (os == NULL) + os = this->make_output_section(name, type, flags); ins.first->second = os; return os; } |