aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-06-18 22:29:14 +0000
committerIan Lance Taylor <ian@airs.com>2011-06-18 22:29:14 +0000
commit911a5072375a58fb7fd1394dc913a9b315db22a6 (patch)
tree1e7a40d7bc930e763abe77cdbf363b41453bfcc4 /gold
parent1f20b1457b31ca6925063318467fec344a236de3 (diff)
downloadgdb-911a5072375a58fb7fd1394dc913a9b315db22a6.zip
gdb-911a5072375a58fb7fd1394dc913a9b315db22a6.tar.gz
gdb-911a5072375a58fb7fd1394dc913a9b315db22a6.tar.bz2
PR gold/12745
* layout.cc (Layout::layout_eh_frame): Correct handling of writable .eh_frame section.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog6
-rw-r--r--gold/layout.cc14
2 files changed, 18 insertions, 2 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 4a072a8..e4c6287 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-18 Ian Lance Taylor <iant@google.com>
+
+ PR gold/12745
+ * layout.cc (Layout::layout_eh_frame): Correct handling of
+ writable .eh_frame section.
+
2011-06-17 Ian Lance Taylor <iant@google.com>
PR gold/12893
diff --git a/gold/layout.cc b/gold/layout.cc
index 114fa26..a3e60d5 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -1140,6 +1140,8 @@ Layout::layout_eh_frame(Sized_relobj_file<size, big_endian>* object,
gold_assert(this->eh_frame_section_ == os);
+ elfcpp::Elf_Xword orig_flags = os->flags();
+
if (!parameters->incremental()
&& this->eh_frame_data_->add_ehframe_input_section(object,
symbols,
@@ -1153,8 +1155,12 @@ Layout::layout_eh_frame(Sized_relobj_file<size, big_endian>* object,
os->update_flags_for_input_section(shdr.get_sh_flags());
// A writable .eh_frame section is a RELRO section.
- if ((shdr.get_sh_flags() & elfcpp::SHF_WRITE) != 0)
- os->set_is_relro();
+ if ((orig_flags & (elfcpp::SHF_WRITE | elfcpp::SHF_EXECINSTR))
+ != (os->flags() & (elfcpp::SHF_WRITE | elfcpp::SHF_EXECINSTR)))
+ {
+ os->set_is_relro();
+ os->set_order(ORDER_RELRO);
+ }
// We found a .eh_frame section we are going to optimize, so now
// we can add the set of optimized sections to the output
@@ -1176,6 +1182,10 @@ Layout::layout_eh_frame(Sized_relobj_file<size, big_endian>* object,
*off = os->add_input_section(this, object, shndx, name, shdr, reloc_shndx,
saw_sections_clause);
this->have_added_input_section_ = true;
+
+ if ((orig_flags & (elfcpp::SHF_WRITE | elfcpp::SHF_EXECINSTR))
+ != (os->flags() & (elfcpp::SHF_WRITE | elfcpp::SHF_EXECINSTR)))
+ os->set_order(this->default_section_order(os, false));
}
return os;