From: Rafael Espindola Date: Tue, 23 Jun 2015 03:36:08 +0000 (+0000) Subject: Handle multiple symbols having the same address. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8bfd2e8447be4edd313a8fc86093751bb1002775;p=oota-llvm.git Handle multiple symbols having the same address. I will add an explicit test in a second, but this fixes the bots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240372 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/SymbolSize.cpp b/lib/Object/SymbolSize.cpp index d133266e713..121bf1baa7a 100644 --- a/lib/Object/SymbolSize.cpp +++ b/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; }