diff options
author | Ian Lance Taylor <iant@google.com> | 2007-10-10 06:33:56 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2007-10-10 06:33:56 +0000 |
commit | cec9d2f362a9f1c13aad15caed66493463efb674 (patch) | |
tree | 711b97acffe7fb945ae78afb0f2009548aba68b5 /gold/merge.cc | |
parent | 4e9d858638034246a4ab4595f5497c7393c3bfbf (diff) | |
download | gdb-cec9d2f362a9f1c13aad15caed66493463efb674.zip gdb-cec9d2f362a9f1c13aad15caed66493463efb674.tar.gz gdb-cec9d2f362a9f1c13aad15caed66493463efb674.tar.bz2 |
From Craig Silverstein: don't get confused if the same file name
occurs in an archive.
Diffstat (limited to 'gold/merge.cc')
-rw-r--r-- | gold/merge.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gold/merge.cc b/gold/merge.cc index 0db62ef..75cbc18 100644 --- a/gold/merge.cc +++ b/gold/merge.cc @@ -40,7 +40,15 @@ Output_merge_base::Merge_key_less::operator()(const Merge_key& mk1, // matter. We want to get consistent results across links so we // don't use pointer comparison. if (mk1.object != mk2.object) - return mk1.object->name() < mk2.object->name(); + { + // Two different object files can have the same name: if foo.a + // includes both bar/qux.o and baz/qux.o, then both end up with + // the name foo.a(qux.o). But it's impossible for two different + // object files to have both the same name and the same offset. + if (mk1.object->offset() != mk2.object->offset()) + return mk1.object->offset() < mk2.object->offset(); + return mk1.object->name() < mk2.object->name(); + } if (mk1.shndx != mk2.shndx) return mk1.shndx < mk2.shndx; return mk1.offset < mk2.offset; |