aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-01-10 21:57:31 +0000
committerIan Lance Taylor <ian@airs.com>2011-01-10 21:57:31 +0000
commit3bb951e542447c383f81b512ce44f5dd203441d9 (patch)
treea14a433bc6a18c669d3395d684164687317744dc
parentcb11d1f450c9319dbce0018bf3e41acf675f4a39 (diff)
downloadfsf-binutils-gdb-3bb951e542447c383f81b512ce44f5dd203441d9.zip
fsf-binutils-gdb-3bb951e542447c383f81b512ce44f5dd203441d9.tar.gz
fsf-binutils-gdb-3bb951e542447c383f81b512ce44f5dd203441d9.tar.bz2
* layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
section as relro. (Layout::set_segment_offsets): Reset increase_relro before calling set_section_addresses a second time.
-rw-r--r--gold/ChangeLog7
-rw-r--r--gold/layout.cc12
2 files changed, 18 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index ef9771f..a1207cf 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,10 @@
+2011-01-10 Ian Lance Taylor <iant@google.com>
+
+ * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
+ section as relro.
+ (Layout::set_segment_offsets): Reset increase_relro before calling
+ set_section_addresses a second time.
+
2011-01-04 Cary Coutant <ccoutant@google.com>
* script-sections.cc (Sort_output_sections::operator()): Sort TLS
diff --git a/gold/layout.cc b/gold/layout.cc
index 9bf9a9f..63b9e0d 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -1,6 +1,6 @@
// layout.cc -- lay out output file sections for gold
-// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -912,6 +912,10 @@ Layout::layout_eh_frame(Sized_relobj<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();
+
// We found a .eh_frame section we are going to optimize, so now
// we can add the set of optimized sections to the output
// section. We need to postpone adding this until we've found a
@@ -2722,6 +2726,12 @@ Layout::set_segment_offsets(const Target* target, Output_segment* load_seg,
addr = align_address(addr, (*p)->maximum_alignment());
off = orig_off + ((addr - orig_addr) & (abi_pagesize - 1));
off = align_file_offset(off, addr, abi_pagesize);
+
+ increase_relro = this->increase_relro_;
+ if (this->script_options_->saw_sections_clause())
+ increase_relro = 0;
+ has_relro = false;
+
new_addr = (*p)->set_section_addresses(this, true, addr,
&increase_relro,
&has_relro,