summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/SymbolSize.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-23 03:36:08 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-23 03:36:08 +0000
commit49943652f57c92efa02c45f12e23b06a2ac8009b (patch)
tree65b250b6d4d25848f7b0d63e61f722b849babcbc /llvm/lib/Object/SymbolSize.cpp
parent7a30608026825c7c558f029384d257d016992775 (diff)
downloadbcm5719-llvm-49943652f57c92efa02c45f12e23b06a2ac8009b.tar.gz
bcm5719-llvm-49943652f57c92efa02c45f12e23b06a2ac8009b.zip
Handle multiple symbols having the same address.
I will add an explicit test in a second, but this fixes the bots. llvm-svn: 240372
Diffstat (limited to 'llvm/lib/Object/SymbolSize.cpp')
-rw-r--r--llvm/lib/Object/SymbolSize.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Object/SymbolSize.cpp b/llvm/lib/Object/SymbolSize.cpp
index d133266e713..121bf1baa7a 100644
--- a/llvm/lib/Object/SymbolSize.cpp
+++ b/llvm/lib/Object/SymbolSize.cpp
@@ -28,6 +28,8 @@ static int compareAddress(const SymEntry *A, const SymEntry *B) {
return A->Address - B->Address;
if (A->Section < B->Section)
return -1;
+ if (A->Section == B->Section)
+ return 0;
return 1;
}
@@ -73,7 +75,13 @@ llvm::object::computeSymbolSizes(const ObjectFile &O) {
auto &P = Addresses[I];
if (P.I == O.symbol_end())
continue;
- uint64_t Size = Addresses[I + 1].Address - P.Address;
+
+ // If multiple symbol have the same address, give both the same size.
+ unsigned NextI = I + 1;
+ while (NextI < N && Addresses[NextI].Address == P.Address)
+ ++NextI;
+
+ uint64_t Size = Addresses[NextI].Address - P.Address;
P.Address = Size;
}
OpenPOWER on IntegriCloud