diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-24 10:20:30 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-24 10:20:30 +0000 |
commit | d7a32ea4b86c04ba0c4736f803527eb393a40867 (patch) | |
tree | 1b09dcd2e51416a33c0b030346842e8ea6dd3e38 /llvm/tools/dsymutil/MachODebugMapParser.cpp | |
parent | 595348228569c587e14bf8cea1c4fdf1b503c104 (diff) | |
download | bcm5719-llvm-d7a32ea4b86c04ba0c4736f803527eb393a40867.tar.gz bcm5719-llvm-d7a32ea4b86c04ba0c4736f803527eb393a40867.zip |
Change how symbol sizes are handled in lib/Object.
COFF and MachO only define symbol sizes for common symbols. Reflect that
in the class hierarchy by having a method for common symbols only in the base
and a general one in ELF.
This avoids the need of using a magic value for the size, which had a few
problems
* Most callers didn't check for it.
* The ones that did could not tell the magic value from a file actually having
that value.
llvm-svn: 240529
Diffstat (limited to 'llvm/tools/dsymutil/MachODebugMapParser.cpp')
-rw-r--r-- | llvm/tools/dsymutil/MachODebugMapParser.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp index b803e410199..b1e6abcefa8 100644 --- a/llvm/tools/dsymutil/MachODebugMapParser.cpp +++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp @@ -160,7 +160,7 @@ void MachODebugMapParser::handleStabSymbolTableEntry(uint32_t StringIndex, // symbol table to find its address as it might not be in the // debug map (for common symbols). Value = getMainBinarySymbolAddress(Name); - if (Value == UnknownAddressOrSize) + if (Value == UnknownAddress) return; break; case MachO::N_FUN: @@ -199,8 +199,7 @@ void MachODebugMapParser::loadCurrentObjectFileSymbols() { for (auto Sym : CurrentObjectHolder.Get().symbols()) { StringRef Name; uint64_t Addr; - if (Sym.getAddress(Addr) || Addr == UnknownAddressOrSize || - Sym.getName(Name)) + if (Sym.getAddress(Addr) || Addr == UnknownAddress || Sym.getName(Name)) continue; CurrentObjectAddresses[Name] = Addr; } @@ -212,7 +211,7 @@ void MachODebugMapParser::loadCurrentObjectFileSymbols() { uint64_t MachODebugMapParser::getMainBinarySymbolAddress(StringRef Name) { auto Sym = MainBinarySymbolAddresses.find(Name); if (Sym == MainBinarySymbolAddresses.end()) - return UnknownAddressOrSize; + return UnknownAddress; return Sym->second; } @@ -233,7 +232,7 @@ void MachODebugMapParser::loadMainBinarySymbols() { // are the only ones that need to be queried because the address // of common data won't be described in the debug map. All other // addresses should be fetched for the debug map. - if (Sym.getAddress(Addr) || Addr == UnknownAddressOrSize || + if (Sym.getAddress(Addr) || Addr == UnknownAddress || !(Sym.getFlags() & SymbolRef::SF_Global) || Sym.getSection(Section) || Section->isText() || Sym.getName(Name) || Name.size() == 0 || Name[0] == '\0') |