Index: lib/Object/SymbolSize.cpp =================================================================== --- lib/Object/SymbolSize.cpp +++ lib/Object/SymbolSize.cpp @@ -66,23 +66,27 @@ Addresses.push_back( {O.symbol_end(), Address + Size, 0, getSectionID(O, Sec)}); } + + if (Addresses.empty()) + return Ret; + array_pod_sort(Addresses.begin(), Addresses.end(), compareAddress); // Compute the size as the gap to the next symbol for (unsigned I = 0, N = Addresses.size() - 1; I < N; ++I) { auto &P = Addresses[I]; if (P.I == O.symbol_end()) continue; // 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; } // Assign the sorted symbols in the original order. Ret.resize(SymNum); for (SymEntry &P : Addresses) {