aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2010-08-24 07:24:10 +0000
committerNick Clifton <nickc@redhat.com>2010-08-24 07:24:10 +0000
commitb8fa87504778a10270cf291ec81f70e74e6c8c23 (patch)
tree6958f5a7c7d81d0f1f4b8d4e9816448a01a13305
parent9a1ac7768463c9b31fb7226bf6b23e3e747641d9 (diff)
downloadgdb-b8fa87504778a10270cf291ec81f70e74e6c8c23.zip
gdb-b8fa87504778a10270cf291ec81f70e74e6c8c23.tar.gz
gdb-b8fa87504778a10270cf291ec81f70e74e6c8c23.tar.bz2
PR 11899
* layout.cc (segment_precedes): Sort segments by their physical addresses, if they have been set.
-rw-r--r--gold/ChangeLog6
-rw-r--r--gold/layout.cc9
2 files changed, 13 insertions, 2 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index e2792b2..c039654 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-24 Nick Clifton <nickc@redhat.com>
+
+ PR 11899
+ * layout.cc (segment_precedes): Sort segments by their physical
+ addresses, if they have been set.
+
2010-08-23 Cary Coutant <ccoutant@google.com>
* archive.cc (Lib_group::add_symbols): Lock object before deleting its
diff --git a/gold/layout.cc b/gold/layout.cc
index 1dd41f3..3040bf6 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -2457,8 +2457,13 @@ Layout::segment_precedes(const Output_segment* seg1,
if (section_count1 > 0 && section_count2 == 0)
return false;
- uint64_t paddr1 = seg1->first_section_load_address();
- uint64_t paddr2 = seg2->first_section_load_address();
+ uint64_t paddr1 = (seg1->are_addresses_set()
+ ? seg1->paddr()
+ : seg1->first_section_load_address());
+ uint64_t paddr2 = (seg2->are_addresses_set()
+ ? seg2->paddr()
+ : seg2->first_section_load_address());
+
if (paddr1 != paddr2)
return paddr1 < paddr2;
}