aboutsummaryrefslogtreecommitdiff
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
commit1a2dff539bff0b85f89b2f8f0c30dab1851f59a5 (patch)
tree549fd584889a912f8d7aec63610c52b2969dee96 /gold/output.h
parentf0ba79e29c2b6fd25f66a9c1050cd09f6e069513 (diff)
downloadgdb-1a2dff539bff0b85f89b2f8f0c30dab1851f59a5.zip
gdb-1a2dff539bff0b85f89b2f8f0c30dab1851f59a5.tar.gz
gdb-1a2dff539bff0b85f89b2f8f0c30dab1851f59a5.tar.bz2
* 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 55e278b..7ce3202 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