summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp5
-rw-r--r--llvm/tools/dsymutil/DebugMap.cpp6
-rw-r--r--llvm/tools/dsymutil/MachODebugMapParser.cpp12
3 files changed, 15 insertions, 8 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 54e4624af13..3c82d7bf3e2 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -369,11 +369,10 @@ std::error_code MachOObjectFile::getIndirectName(DataRefImpl Symb,
}
uint64_t MachOObjectFile::getSymbolValue(DataRefImpl Sym) const {
- uint64_t NValue = getNValue(Sym);
MachO::nlist_base Entry = getSymbolTableEntryBase(this, Sym);
- if ((Entry.n_type & MachO::N_TYPE) == MachO::N_UNDF && NValue == 0)
+ if ((Entry.n_type & MachO::N_TYPE) == MachO::N_UNDF)
return UnknownAddress;
- return NValue;
+ return getNValue(Sym);
}
ErrorOr<uint64_t> MachOObjectFile::getSymbolAddress(DataRefImpl Sym) const {
diff --git a/llvm/tools/dsymutil/DebugMap.cpp b/llvm/tools/dsymutil/DebugMap.cpp
index e5cc87b3f31..46b269dc267 100644
--- a/llvm/tools/dsymutil/DebugMap.cpp
+++ b/llvm/tools/dsymutil/DebugMap.cpp
@@ -216,7 +216,11 @@ MappingTraits<dsymutil::DebugMapObject>::YamlDMO::denormalize(IO &IO) {
// during the test, we can't hardcode the symbols addresses, so
// look them up here and rewrite them.
for (const auto &Sym : ErrOrObjectFile->symbols()) {
- uint64_t Address = Sym.getValue();
+ uint64_t Address;
+ if (Sym.getFlags() & SymbolRef::SF_Common)
+ Address = Sym.getCommonSize();
+ else
+ Address = Sym.getValue();
ErrorOr<StringRef> Name = Sym.getName();
if (!Name)
continue;
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index bec95915a0f..76fc7612e68 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -197,10 +197,14 @@ void MachODebugMapParser::loadCurrentObjectFileSymbols() {
CurrentObjectAddresses.clear();
for (auto Sym : CurrentObjectHolder.Get().symbols()) {
-
- uint64_t Addr = Sym.getValue();
- if (Addr == UnknownAddress)
- continue;
+ uint64_t Addr;
+ if (Sym.getFlags() & SymbolRef::SF_Common) {
+ Addr = Sym.getCommonSize();
+ } else {
+ Addr = Sym.getValue();
+ if (Addr == UnknownAddress)
+ continue;
+ }
ErrorOr<StringRef> Name = Sym.getName();
if (!Name)
continue;
OpenPOWER on IntegriCloud