projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert r247684 - Replace Triple with a new TargetTuple ...
[oota-llvm.git]
/
tools
/
llvm-objdump
/
llvm-objdump.cpp
diff --git
a/tools/llvm-objdump/llvm-objdump.cpp
b/tools/llvm-objdump/llvm-objdump.cpp
index 7496872edc387c18bd518fe736955d1d58a1e8d9..9cccd8d838c251b6545595882386106adfc6ad9c 100644
(file)
--- a/
tools/llvm-objdump/llvm-objdump.cpp
+++ b/
tools/llvm-objdump/llvm-objdump.cpp
@@
-249,6
+249,7
@@
void llvm::error(std::error_code EC) {
outs() << ToolName << ": error reading file: " << EC.message() << ".\n";
outs().flush();
outs() << ToolName << ": error reading file: " << EC.message() << ".\n";
outs().flush();
+ exit(1);
}
static void report_error(StringRef File, std::error_code EC) {
}
static void report_error(StringRef File, std::error_code EC) {
@@
-377,11
+378,12
@@
PrettyPrinter &selectPrettyPrinter(Triple const &Triple) {
template <class ELFT>
static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj,
template <class ELFT>
static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj,
-
DataRefImpl Rel
,
+
const RelocationRef &RelRef
,
SmallVectorImpl<char> &Result) {
SmallVectorImpl<char> &Result) {
+ DataRefImpl Rel = RelRef.getRawDataRefImpl();
+
typedef typename ELFObjectFile<ELFT>::Elf_Sym Elf_Sym;
typedef typename ELFObjectFile<ELFT>::Elf_Shdr Elf_Shdr;
typedef typename ELFObjectFile<ELFT>::Elf_Sym Elf_Sym;
typedef typename ELFObjectFile<ELFT>::Elf_Shdr Elf_Shdr;
- typedef typename ELFObjectFile<ELFT>::Elf_Rel Elf_Rel;
typedef typename ELFObjectFile<ELFT>::Elf_Rela Elf_Rela;
const ELFFile<ELFT> &EF = *Obj->getELFFile();
typedef typename ELFObjectFile<ELFT>::Elf_Rela Elf_Rela;
const ELFFile<ELFT> &EF = *Obj->getELFFile();
@@
-403,36
+405,31
@@
static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj,
if (std::error_code EC = StrTabOrErr.getError())
return EC;
StringRef StrTab = *StrTabOrErr;
if (std::error_code EC = StrTabOrErr.getError())
return EC;
StringRef StrTab = *StrTabOrErr;
- uint8_t type;
+ uint8_t type
= RelRef.getType()
;
StringRef res;
int64_t addend = 0;
StringRef res;
int64_t addend = 0;
- uint16_t symbol_index = 0;
switch (Sec->sh_type) {
default:
return object_error::parse_failed;
case ELF::SHT_REL: {
switch (Sec->sh_type) {
default:
return object_error::parse_failed;
case ELF::SHT_REL: {
- const Elf_Rel *ERel = Obj->getRel(Rel);
- type = ERel->getType(EF.isMips64EL());
- symbol_index = ERel->getSymbol(EF.isMips64EL());
// TODO: Read implicit addend from section data.
break;
}
case ELF::SHT_RELA: {
const Elf_Rela *ERela = Obj->getRela(Rel);
// TODO: Read implicit addend from section data.
break;
}
case ELF::SHT_RELA: {
const Elf_Rela *ERela = Obj->getRela(Rel);
- type = ERela->getType(EF.isMips64EL());
- symbol_index = ERela->getSymbol(EF.isMips64EL());
addend = ERela->r_addend;
break;
}
}
addend = ERela->r_addend;
break;
}
}
- const Elf_Sym *symb =
-
EF.template getEntry<Elf_Sym>(Sec->sh_link, symbol_index
);
+ symbol_iterator SI = RelRef.getSymbol();
+
const Elf_Sym *symb = Obj->getSymbol(SI->getRawDataRefImpl()
);
StringRef Target;
StringRef Target;
- ErrorOr<const Elf_Shdr *> SymSec = EF.getSection(symb);
- if (std::error_code EC = SymSec.getError())
- return EC;
if (symb->getType() == ELF::STT_SECTION) {
if (symb->getType() == ELF::STT_SECTION) {
- ErrorOr<StringRef> SecName = EF.getSectionName(*SymSec);
+ ErrorOr<section_iterator> SymSI = SI->getSection();
+ if (std::error_code EC = SymSI.getError())
+ return EC;
+ const Elf_Shdr *SymSec = Obj->getSection((*SymSI)->getRawDataRefImpl());
+ ErrorOr<StringRef> SecName = EF.getSectionName(SymSec);
if (std::error_code EC = SecName.getError())
return EC;
Target = *SecName;
if (std::error_code EC = SecName.getError())
return EC;
Target = *SecName;
@@
-494,9
+491,8
@@
static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj,
}
static std::error_code getRelocationValueString(const ELFObjectFileBase *Obj,
}
static std::error_code getRelocationValueString(const ELFObjectFileBase *Obj,
- const RelocationRef &Rel
Ref
,
+ const RelocationRef &Rel,
SmallVectorImpl<char> &Result) {
SmallVectorImpl<char> &Result) {
- DataRefImpl Rel = RelRef.getRawDataRefImpl();
if (auto *ELF32LE = dyn_cast<ELF32LEObjectFile>(Obj))
return getRelocationValueString(ELF32LE, Rel, Result);
if (auto *ELF64LE = dyn_cast<ELF64LEObjectFile>(Obj))
if (auto *ELF32LE = dyn_cast<ELF32LEObjectFile>(Obj))
return getRelocationValueString(ELF32LE, Rel, Result);
if (auto *ELF64LE = dyn_cast<ELF64LEObjectFile>(Obj))
@@
-1224,8
+1220,9
@@
void llvm::PrintSymbolTable(const ObjectFile *o) {
uint64_t Address = *AddressOrError;
SymbolRef::Type Type = Symbol.getType();
uint32_t Flags = Symbol.getFlags();
uint64_t Address = *AddressOrError;
SymbolRef::Type Type = Symbol.getType();
uint32_t Flags = Symbol.getFlags();
- section_iterator Section = o->section_end();
- error(Symbol.getSection(Section));
+ ErrorOr<section_iterator> SectionOrErr = Symbol.getSection();
+ error(SectionOrErr.getError());
+ section_iterator Section = *SectionOrErr;
StringRef Name;
if (Type == SymbolRef::ST_Debug && Section != o->section_end()) {
Section->getName(Name);
StringRef Name;
if (Type == SymbolRef::ST_Debug && Section != o->section_end()) {
Section->getName(Name);