aboutsummaryrefslogtreecommitdiff
path: root/gold/layout.cc
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 /gold/layout.cc
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.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc9
1 files changed, 7 insertions, 2 deletions
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;
}