summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-07-03 17:44:18 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-07-03 17:44:18 +0000
commitdea0016f1e576d954b52e1d39fcb59ba10a05892 (patch)
treec5d0ee9cdaa5e0d78a8bd8c081d33a7709bae2be /llvm/tools/llvm-objdump
parentb001a0ba5e10937c3e1a6489bbd47889182cef69 (diff)
downloadbcm5719-llvm-dea0016f1e576d954b52e1d39fcb59ba10a05892.tar.gz
bcm5719-llvm-dea0016f1e576d954b52e1d39fcb59ba10a05892.zip
Use getValue instead of getAddress in a few MachO only cases.
In MachO the value of the symbol is always the address, so we can use the simpler function. llvm-svn: 241364
Diffstat (limited to 'llvm/tools/llvm-objdump')
-rw-r--r--llvm/tools/llvm-objdump/MachODump.cpp32
1 files changed, 9 insertions, 23 deletions
diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp
index 5263c33bf2d..fa5906bb239 100644
--- a/llvm/tools/llvm-objdump/MachODump.cpp
+++ b/llvm/tools/llvm-objdump/MachODump.cpp
@@ -178,18 +178,8 @@ static const Target *GetTarget(const MachOObjectFile *MachOObj,
struct SymbolSorter {
bool operator()(const SymbolRef &A, const SymbolRef &B) {
- SymbolRef::Type AType = A.getType();
- SymbolRef::Type BType = B.getType();
-
- uint64_t AAddr, BAddr;
- if (AType != SymbolRef::ST_Function)
- AAddr = 0;
- else
- A.getAddress(AAddr);
- if (BType != SymbolRef::ST_Function)
- BAddr = 0;
- else
- B.getAddress(BAddr);
+ uint64_t AAddr = (A.getType() != SymbolRef::ST_Function) ? 0 : A.getValue();
+ uint64_t BAddr = (B.getType() != SymbolRef::ST_Function) ? 0 : B.getValue();
return AAddr < BAddr;
}
};
@@ -592,8 +582,7 @@ static void CreateSymbolAddressMap(MachOObjectFile *O,
SymbolRef::Type ST = Symbol.getType();
if (ST == SymbolRef::ST_Function || ST == SymbolRef::ST_Data ||
ST == SymbolRef::ST_Other) {
- uint64_t Address;
- Symbol.getAddress(Address);
+ uint64_t Address = Symbol.getValue();
ErrorOr<StringRef> SymNameOrErr = Symbol.getName();
if (std::error_code EC = SymNameOrErr.getError())
report_fatal_error(EC.message());
@@ -2456,7 +2445,7 @@ static const char *get_symbol_64(uint32_t sect_offset, SectionRef S,
// and return its name.
const char *SymbolName = nullptr;
if (reloc_found && isExtern) {
- Symbol.getAddress(n_value);
+ n_value = Symbol.getValue();
if (n_value == UnknownAddress)
n_value = 0;
ErrorOr<StringRef> NameOrError = Symbol.getName();
@@ -5640,7 +5629,7 @@ static const char *GuessLiteralPointer(uint64_t ReferenceValue,
if (info->O->getAnyRelocationPCRel(RE)) {
unsigned Type = info->O->getAnyRelocationType(RE);
if (Type == MachO::X86_64_RELOC_SIGNED) {
- Symbol.getAddress(ReferenceValue);
+ ReferenceValue = Symbol.getValue();
}
}
}
@@ -6131,8 +6120,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
SymbolRef::Type ST = Symbol.getType();
if (ST == SymbolRef::ST_Function || ST == SymbolRef::ST_Data ||
ST == SymbolRef::ST_Other) {
- uint64_t Address;
- Symbol.getAddress(Address);
+ uint64_t Address = Symbol.getValue();
ErrorOr<StringRef> SymNameOrErr = Symbol.getName();
if (std::error_code EC = SymNameOrErr.getError())
report_fatal_error(EC.message());
@@ -6194,9 +6182,8 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
continue;
// Start at the address of the symbol relative to the section's address.
- uint64_t Start = 0;
+ uint64_t Start = Symbols[SymIdx].getValue();
uint64_t SectionAddress = Sections[SectIdx].getAddress();
- Symbols[SymIdx].getAddress(Start);
Start -= SectionAddress;
// Stop disassembling either at the beginning of the next symbol or at
@@ -6209,7 +6196,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
if (NextSymType == SymbolRef::ST_Function) {
containsNextSym =
Sections[SectIdx].containsSymbol(Symbols[NextSymIdx]);
- Symbols[NextSymIdx].getAddress(NextSym);
+ NextSym = Symbols[NextSymIdx].getValue();
NextSym -= SectionAddress;
break;
}
@@ -6815,8 +6802,7 @@ void llvm::printMachOUnwindInfo(const MachOObjectFile *Obj) {
if (Section == Obj->section_end())
continue;
- uint64_t Addr;
- SymRef.getAddress(Addr);
+ uint64_t Addr = SymRef.getValue();
Symbols.insert(std::make_pair(Addr, SymRef));
}
OpenPOWER on IntegriCloud