aboutsummaryrefslogtreecommitdiff
path: root/gold/layout.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-06-29 00:39:54 +0000
committerIan Lance Taylor <ian@airs.com>2011-06-29 00:39:54 +0000
commitaecf301fb9a06b3d05280260758bcd3e85d7413e (patch)
tree6abfce385d16ede9a1a234bb95054427b1e5a99c /gold/layout.h
parentd555a4fbf322f7818ea970c1d8108730d9f3f33e (diff)
downloadgdb-aecf301fb9a06b3d05280260758bcd3e85d7413e.zip
gdb-aecf301fb9a06b3d05280260758bcd3e85d7413e.tar.gz
gdb-aecf301fb9a06b3d05280260758bcd3e85d7413e.tar.bz2
PR gold/12898
* layout.cc (Layout::segment_precedes): Don't crash if a linker script create indistinguishable segments. (Layout::set_segment_offsets): Use stable_sort when sorting segments. Pass this to Compare_segments constructor. * layout.h (class Layout): Make segment_precedes non-static. (class Compare_segments): Change from struct to class. Add layout_ field. Add constructor. * script-sections.cc (Script_sections::attach_sections_using_phdrs_clause): Rename local orphan to is_orphan. Don't report failure to put empty section in segment. On attachment failure, report name of section, and attach to first PT_LOAD segment.
Diffstat (limited to 'gold/layout.h')
-rw-r--r--gold/layout.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/gold/layout.h b/gold/layout.h
index 0f6840e..4a437b5 100644
--- a/gold/layout.h
+++ b/gold/layout.h
@@ -1052,7 +1052,7 @@ class Layout
place_orphan_sections_in_script();
// Return whether SEG1 comes before SEG2 in the output file.
- static bool
+ bool
segment_precedes(const Output_segment* seg1, const Output_segment* seg2);
// Use to save and restore segments during relaxation.
@@ -1102,11 +1102,19 @@ class Layout
// A comparison class for segments.
- struct Compare_segments
+ class Compare_segments
{
+ public:
+ Compare_segments(Layout* layout)
+ : layout_(layout)
+ { }
+
bool
operator()(const Output_segment* seg1, const Output_segment* seg2)
- { return Layout::segment_precedes(seg1, seg2); }
+ { return this->layout_->segment_precedes(seg1, seg2); }
+
+ private:
+ Layout* layout_;
};
typedef std::vector<Output_section_data*> Output_section_data_list;