summaryrefslogtreecommitdiff
path: root/gold/output.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-12-30 06:57:17 +0000
committerIan Lance Taylor <ian@airs.com>2009-12-30 06:57:17 +0000
commitb3aca61fb1666ef8e6e4d613f5a30e176b5244d8 (patch)
tree2b9d30327b3f68ca3e7bfaa4733c8bd2834b678d /gold/output.h
parente6f767fe40f26eea484a38a156657658cb0cb945 (diff)
downloadbinutils-redhat-b3aca61fb1666ef8e6e4d613f5a30e176b5244d8.tar.gz
* layout.cc (Layout::Layout): Initialize increase_relro_.
(Layout::get_output_section): Add is_relro, is_last_relro, and is_first_non_relro parameters. Change all callers. (Layout::choose_output_section): Likewise. (Layout::add_output_section_data): Likewise. (Layout::make_output_section): Likewise. (Layout::set_segment_offsets): Clear increase_relro when using a linker script. * layout.h (class Layout): Add increase_relro method. Add increase_relro_ field. Update declarations. * output.cc (Output_section::Output_section): Initialize is_last_relro_ and is_first_non_relro_. (Output_segment::add_output_section): Group relro sections is do_sort is true. Handle is_last_relro and is_first_non_relro. (Output_segment::maximum_alignment): Remove relro handling. (Output_segment::set_section_addresses): Add increase_relro parameter. Change all callers. Add initial alignment to align relro sections on separate page. Remove old relro handling. (Output_segment::set_section_list_addresses): Remove in_relro parameter. Change all callers. (Output_segment::set_offset): Add increase parameter. Change all callers. Remove old relro handling. * output.h (class Output_section): Add new methods: is_last_relro, set_is_last_relro, is_first_non_relro, set_is_first_non_relro. Add is_last_relro_ and is_first_non_relro_ fields. * i386.cc (Target_i386::got_section): Don't call set_is_relro. Create separate .got.plt section. Call increase_relro. * x86_64.cc (Target_x86_64::got_section): Likewise. * testsuite/relro_script_test.t: Add .got.plt.
Diffstat (limited to 'gold/output.h')
-rw-r--r--gold/output.h40
1 files changed, 37 insertions, 3 deletions
diff --git a/gold/output.h b/gold/output.h
index 55e278bbf2..7ce3202688 100644
--- a/gold/output.h
+++ b/gold/output.h
@@ -2351,6 +2351,35 @@ class Output_section : public Output_data
set_is_relro_local()
{ this->is_relro_local_ = true; }
+ // True if this must be the last relro section.
+ bool
+ is_last_relro() const
+ { return this->is_last_relro_; }
+
+ // Record that this must be the last relro section.
+ void
+ set_is_last_relro()
+ {
+ gold_assert(this->is_relro_);
+ this->is_last_relro_ = true;
+ }
+
+ // True if this must be the first section following the relro sections.
+ bool
+ is_first_non_relro() const
+ {
+ gold_assert(!this->is_relro_);
+ return this->is_first_non_relro_;
+ }
+
+ // Record that this must be the first non-relro section.
+ void
+ set_is_first_non_relro()
+ {
+ gold_assert(!this->is_relro_);
+ this->is_first_non_relro_ = true;
+ }
+
// True if this is a small section: a section which holds small
// variables.
bool
@@ -3341,6 +3370,10 @@ class Output_section : public Output_data
bool is_relro_ : 1;
// True if this section holds relro local data.
bool is_relro_local_ : 1;
+ // True if this must be the last relro section.
+ bool is_last_relro_ : 1;
+ // True if this must be the first section after the relro sections.
+ bool is_first_non_relro_ : 1;
// True if this is a small section.
bool is_small_section_ : 1;
// True if this is a large section.
@@ -3497,7 +3530,8 @@ class Output_segment
// address of the immediately following segment. Update *POFF and
// *PSHNDX. This should only be called for a PT_LOAD segment.
uint64_t
- set_section_addresses(const Layout*, bool reset, uint64_t addr, off_t* poff,
+ set_section_addresses(const Layout*, bool reset, uint64_t addr,
+ unsigned int increase_relro, off_t* poff,
unsigned int* pshndx);
// Set the minimum alignment of this segment. This may be adjusted
@@ -3509,7 +3543,7 @@ class Output_segment
// Set the offset of this segment based on the section. This should
// only be called for a non-PT_LOAD segment.
void
- set_offset();
+ set_offset(unsigned int increase);
// Set the TLS offsets of the sections contained in the PT_TLS segment.
void
@@ -3555,7 +3589,7 @@ class Output_segment
uint64_t
set_section_list_addresses(const Layout*, bool reset, Output_data_list*,
uint64_t addr, off_t* poff, unsigned int* pshndx,
- bool* in_tls, bool* in_relro);
+ bool* in_tls);
// Return the number of Output_sections in an Output_data_list.
unsigned int