diff options
author | Frederic Riss <friss@apple.com> | 2016-01-31 04:29:22 +0000 |
---|---|---|
committer | Frederic Riss <friss@apple.com> | 2016-01-31 04:29:22 +0000 |
commit | d8c33dc2f60becafd0460d4e24d211316f64e521 (patch) | |
tree | 982b172f5b71cc65765bb9849e09566c2e37c515 /llvm/tools/dsymutil/DwarfLinker.cpp | |
parent | f42e031c79678ab79e1e7c4c86c9edad764b046c (diff) | |
download | bcm5719-llvm-d8c33dc2f60becafd0460d4e24d211316f64e521.tar.gz bcm5719-llvm-d8c33dc2f60becafd0460d4e24d211316f64e521.zip |
[dsymutil] Allow debug map mappings with no object file address. NFC
This change just changes the data structure that ties symbol names,
object file address and linked binary addresses to accept mappings
with no object file address. Such symbol mappings are not fed into
the debug map yet, so this patch is NFC.
A subsequent patch will make use of this functionality for common
symbols.
llvm-svn: 259317
Diffstat (limited to 'llvm/tools/dsymutil/DwarfLinker.cpp')
-rw-r--r-- | llvm/tools/dsymutil/DwarfLinker.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp index 37dd02851dc..fe971e99607 100644 --- a/llvm/tools/dsymutil/DwarfLinker.cpp +++ b/llvm/tools/dsymutil/DwarfLinker.cpp @@ -1854,10 +1854,10 @@ void DwarfLinker::startDebugObject(DWARFContext &Dwarf, DebugMapObject &Obj) { // -gline-tables-only on Darwin. for (const auto &Entry : Obj.symbols()) { const auto &Mapping = Entry.getValue(); - if (Mapping.Size) - Ranges[Mapping.ObjectAddress] = std::make_pair( - Mapping.ObjectAddress + Mapping.Size, - int64_t(Mapping.BinaryAddress) - Mapping.ObjectAddress); + if (Mapping.Size && Mapping.ObjectAddress) + Ranges[*Mapping.ObjectAddress] = std::make_pair( + *Mapping.ObjectAddress + Mapping.Size, + int64_t(Mapping.BinaryAddress) - *Mapping.ObjectAddress); } } @@ -1988,14 +1988,16 @@ hasValidRelocation(uint32_t StartOffset, uint32_t EndOffset, const auto &ValidReloc = ValidRelocs[NextValidReloc++]; const auto &Mapping = ValidReloc.Mapping->getValue(); + uint64_t ObjectAddress = + Mapping.ObjectAddress ? uint64_t(*Mapping.ObjectAddress) : UINT64_MAX; if (Linker.Options.Verbose) outs() << "Found valid debug map entry: " << ValidReloc.Mapping->getKey() - << " " << format("\t%016" PRIx64 " => %016" PRIx64, - uint64_t(Mapping.ObjectAddress), + << " " << format("\t%016" PRIx64 " => %016" PRIx64, ObjectAddress, uint64_t(Mapping.BinaryAddress)); - Info.AddrAdjust = int64_t(Mapping.BinaryAddress) + ValidReloc.Addend - - Mapping.ObjectAddress; + Info.AddrAdjust = int64_t(Mapping.BinaryAddress) + ValidReloc.Addend; + if (Mapping.ObjectAddress) + Info.AddrAdjust -= ObjectAddress; Info.InDebugMap = true; return true; } |