aboutsummaryrefslogtreecommitdiff
path: root/gold/script-sections.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-03-19 05:51:49 +0000
committerIan Lance Taylor <ian@airs.com>2009-03-19 05:51:49 +0000
commit0d371ad35608efa28b1ea2c01a457de59b59e3e1 (patch)
treec3cbe0267d172c160c125b894caa1f7164cb42c9 /gold/script-sections.h
parent13e4f8ad17b4c8a6a6bcfe6aebe8647068985ce0 (diff)
downloadgdb-0d371ad35608efa28b1ea2c01a457de59b59e3e1.zip
gdb-0d371ad35608efa28b1ea2c01a457de59b59e3e1.tar.gz
gdb-0d371ad35608efa28b1ea2c01a457de59b59e3e1.tar.bz2
* script-sections.h: Include <list>.
(class Script_sections): Change Sections_elements from std::vector to std::list. Typedef public Elements_iterator. Add orphan_section_placement_, data_segment_align_start_, and saw_data_segment_align_ fields. Remove data_segment_align_index_ field. * script-sections.cc (class Orphan_section_placement): New class. (class Sections_element): Add virtual functions is_relro and orphan_section_init. Remove virtual function place_orphan_here. (class Output_section_definition): Add is_relro and orphan_section_init. Remove place_orphan_here. (class Orphan_output_section): Likewise. (Script_sections::Script_sections): Update for field changes. (Script_sections::data_segment_align): Set saw_data_segment_align_ and data_segment_align_start_, not data_segment_align_index. (Script_sections::data_segment_relro_end): Check saw_data_segment_align_. Use data_segment_align_start_ rather than data_segment_align_index_. (Script_sections::place_orphan): Rewrite to use Orphan_section_placement.
Diffstat (limited to 'gold/script-sections.h')
-rw-r--r--gold/script-sections.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/gold/script-sections.h b/gold/script-sections.h
index 465c24e..390c350 100644
--- a/gold/script-sections.h
+++ b/gold/script-sections.h
@@ -1,6 +1,6 @@
// script-sections.h -- linker script SECTIONS for gold -*- C++ -*-
-// Copyright 2008 Free Software Foundation, Inc.
+// Copyright 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -26,6 +26,7 @@
#define GOLD_SCRIPT_SECTIONS_H
#include <cstdio>
+#include <list>
#include <vector>
namespace gold
@@ -41,9 +42,15 @@ class Output_data;
class Output_section_definition;
class Output_section;
class Output_segment;
+class Orphan_section_placement;
class Script_sections
{
+ private:
+ // This is a list, not a vector, because we insert orphan sections
+ // in the middle.
+ typedef std::list<Sections_element*> Sections_elements;
+
public:
Script_sections();
@@ -184,9 +191,10 @@ class Script_sections
void
print(FILE*) const;
- private:
- typedef std::vector<Sections_element*> Sections_elements;
+ // Used for orphan sections.
+ typedef Sections_elements::iterator Elements_iterator;
+ private:
typedef std::vector<Phdrs_element*> Phdrs_elements;
// Create segments.
@@ -232,9 +240,13 @@ class Script_sections
Output_section_definition* output_section_;
// The list of program headers in the PHDRS clause.
Phdrs_elements* phdrs_elements_;
- // The index of the next Sections_element when we see
+ // Where to put orphan sections.
+ Orphan_section_placement* orphan_section_placement_;
+ // A pointer to the last Sections_element when we see
// DATA_SEGMENT_ALIGN.
- size_t data_segment_align_index_;
+ Sections_elements::iterator data_segment_align_start_;
+ // Whether we have seen DATA_SEGMENT_ALIGN.
+ bool saw_data_segment_align_;
// Whether we have seen DATA_SEGMENT_RELRO_END.
bool saw_relro_end_;
};