summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-01-30 02:49:50 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-01-30 02:49:50 +0000
commitefdbec8b0a49fb67c3844be703548fdc6c1dded0 (patch)
tree040894fc0c18d09dfdfec8693a253bcf998cb8c5 /lib
parent6bf3966f7fd92217360877d1c04ea8ffe47c11cc (diff)
downloadllvm-efdbec8b0a49fb67c3844be703548fdc6c1dded0.tar.gz
llvm-efdbec8b0a49fb67c3844be703548fdc6c1dded0.tar.bz2
llvm-efdbec8b0a49fb67c3844be703548fdc6c1dded0.tar.xz
Simplify the handling of iterators in ObjectFile.
None of the object file formats reported error on iterator increment. In retrospect, that is not too surprising: no object format stores symbols or sections in a linked list or other structure that requires chasing pointers. As a consequence, all error checking can be done on begin() and end(). This reduces the text segment of bin/llvm-readobj in my machine from 521233 to 518526 bytes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200442 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/DebugInfo/DWARFContext.cpp9
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp24
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp13
-rw-r--r--lib/MC/MCObjectDisassembler.cpp24
-rw-r--r--lib/MC/MCObjectSymbolizer.cpp28
-rw-r--r--lib/Object/COFFObjectFile.cpp32
-rw-r--r--lib/Object/MachOObjectFile.cpp49
-rw-r--r--lib/Object/Object.cpp13
-rw-r--r--lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp8
9 files changed, 58 insertions, 142 deletions
diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp
index 3b73f7ff4d..daf7cdd98c 100644
--- a/lib/DebugInfo/DWARFContext.cpp
+++ b/lib/DebugInfo/DWARFContext.cpp
@@ -603,10 +603,9 @@ static bool consumeCompressedDebugSectionHeader(StringRef &data,
DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) :
IsLittleEndian(Obj->isLittleEndian()),
AddressSize(Obj->getBytesInAddress()) {
- error_code ec;
for (object::section_iterator i = Obj->begin_sections(),
- e = Obj->end_sections();
- i != e; i.increment(ec)) {
+ e = Obj->end_sections();
+ i != e; ++i) {
StringRef name;
i->getName(name);
StringRef data;
@@ -697,8 +696,8 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) :
uint64_t SectionSize;
RelocatedSection->getSize(SectionSize);
for (object::relocation_iterator reloc_i = i->begin_relocations(),
- reloc_e = i->end_relocations();
- reloc_i != reloc_e; reloc_i.increment(ec)) {
+ reloc_e = i->end_relocations();
+ reloc_i != reloc_e; ++reloc_i) {
uint64_t Address;
reloc_i->getOffset(Address);
uint64_t Type;
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index f99d7d0b27..6f9eefb68c 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -115,12 +115,10 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectImage *InputObject) {
// Maximum required total memory to allocate all common symbols
uint64_t CommonSize = 0;
- error_code err;
// Parse symbols
DEBUG(dbgs() << "Parse symbols:\n");
- for (symbol_iterator i = obj->begin_symbols(), e = obj->end_symbols();
- i != e; i.increment(err)) {
- Check(err);
+ for (symbol_iterator i = obj->begin_symbols(), e = obj->end_symbols(); i != e;
+ ++i) {
object::SymbolRef::Type SymType;
StringRef Name;
Check(i->getType(SymType));
@@ -173,18 +171,16 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectImage *InputObject) {
// Parse and process relocations
DEBUG(dbgs() << "Parse relocations:\n");
- for (section_iterator si = obj->begin_sections(),
- se = obj->end_sections(); si != se; si.increment(err)) {
- Check(err);
+ for (section_iterator si = obj->begin_sections(), se = obj->end_sections();
+ si != se; ++si) {
bool isFirstRelocation = true;
unsigned SectionID = 0;
StubMap Stubs;
section_iterator RelocatedSection = si->getRelocatedSection();
for (relocation_iterator i = si->begin_relocations(),
- e = si->end_relocations(); i != e; i.increment(err)) {
- Check(err);
-
+ e = si->end_relocations();
+ i != e; ++i) {
// If it's the first relocation in this section, find its SectionID
if (isFirstRelocation) {
SectionID =
@@ -251,21 +247,21 @@ unsigned RuntimeDyldImpl::emitSection(ObjectImage &Obj,
unsigned StubBufSize = 0,
StubSize = getMaxStubSize();
- error_code err;
const ObjectFile *ObjFile = Obj.getObjectFile();
// FIXME: this is an inefficient way to handle this. We should computed the
// necessary section allocation size in loadObject by walking all the sections
// once.
if (StubSize > 0) {
for (section_iterator SI = ObjFile->begin_sections(),
- SE = ObjFile->end_sections();
- SI != SE; SI.increment(err), Check(err)) {
+ SE = ObjFile->end_sections();
+ SI != SE; ++SI) {
section_iterator RelSecI = SI->getRelocatedSection();
if (!(RelSecI == Section))
continue;
for (relocation_iterator I = SI->begin_relocations(),
- E = SI->end_relocations(); I != E; I.increment(err), Check(err)) {
+ E = SI->end_relocations();
+ I != E; ++I) {
StubBufSize += StubSize;
}
}
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index 7f3a790d4b..4dbd6794c6 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -621,10 +621,8 @@ void RuntimeDyldELF::findOPDEntrySection(ObjectImage &Obj,
RelocationValueRef &Rel) {
// Get the ELF symbol value (st_value) to compare with Relocation offset in
// .opd entries
-
- error_code err;
- for (section_iterator si = Obj.begin_sections(),
- se = Obj.end_sections(); si != se; si.increment(err)) {
+ for (section_iterator si = Obj.begin_sections(), se = Obj.end_sections();
+ si != se; ++si) {
section_iterator RelSecI = si->getRelocatedSection();
if (RelSecI == Obj.end_sections())
continue;
@@ -636,14 +634,12 @@ void RuntimeDyldELF::findOPDEntrySection(ObjectImage &Obj,
for (relocation_iterator i = si->begin_relocations(),
e = si->end_relocations(); i != e;) {
- check(err);
-
// The R_PPC64_ADDR64 relocation indicates the first field
// of a .opd entry
uint64_t TypeFunc;
check(i->getType(TypeFunc));
if (TypeFunc != ELF::R_PPC64_ADDR64) {
- i.increment(err);
+ ++i;
continue;
}
@@ -653,10 +649,9 @@ void RuntimeDyldELF::findOPDEntrySection(ObjectImage &Obj,
int64_t Addend;
check(getELFRelocationAddend(*i, Addend));
- i = i.increment(err);
+ ++i;
if (i == e)
break;
- check(err);
// Just check if following relocation is a R_PPC64_TOC
uint64_t TypeTOC;
diff --git a/lib/MC/MCObjectDisassembler.cpp b/lib/MC/MCObjectDisassembler.cpp
index 16a110f09b..85de4111b7 100644
--- a/lib/MC/MCObjectDisassembler.cpp
+++ b/lib/MC/MCObjectDisassembler.cpp
@@ -37,11 +37,8 @@ MCObjectDisassembler::MCObjectDisassembler(const ObjectFile &Obj,
: Obj(Obj), Dis(Dis), MIA(MIA), MOS(0) {}
uint64_t MCObjectDisassembler::getEntrypoint() {
- error_code ec;
for (symbol_iterator SI = Obj.begin_symbols(), SE = Obj.end_symbols();
- SI != SE; SI.increment(ec)) {
- if (ec)
- break;
+ SI != SE; ++SI) {
StringRef Name;
SI->getName(Name);
if (Name == "main" || Name == "_main") {
@@ -90,13 +87,8 @@ MCModule *MCObjectDisassembler::buildModule(bool withCFG) {
}
void MCObjectDisassembler::buildSectionAtoms(MCModule *Module) {
- error_code ec;
- for (section_iterator SI = Obj.begin_sections(),
- SE = Obj.end_sections();
- SI != SE;
- SI.increment(ec)) {
- if (ec) break;
-
+ for (section_iterator SI = Obj.begin_sections(), SE = Obj.end_sections();
+ SI != SE; ++SI) {
bool isText; SI->isText(isText);
bool isData; SI->isData(isData);
if (!isData && !isText)
@@ -184,11 +176,8 @@ void MCObjectDisassembler::buildCFG(MCModule *Module) {
AddressSetTy Splits;
AddressSetTy Calls;
- error_code ec;
for (symbol_iterator SI = Obj.begin_symbols(), SE = Obj.end_symbols();
- SI != SE; SI.increment(ec)) {
- if (ec)
- break;
+ SI != SE; ++SI) {
SymbolRef::Type SymType;
SI->getType(SymType);
if (SymType == SymbolRef::ST_Function) {
@@ -506,11 +495,8 @@ MCMachOObjectDisassembler::MCMachOObjectDisassembler(
: MCObjectDisassembler(MOOF, Dis, MIA), MOOF(MOOF),
VMAddrSlide(VMAddrSlide), HeaderLoadAddress(HeaderLoadAddress) {
- error_code ec;
for (section_iterator SI = MOOF.begin_sections(), SE = MOOF.end_sections();
- SI != SE; SI.increment(ec)) {
- if (ec)
- break;
+ SI != SE; ++SI) {
StringRef Name;
SI->getName(Name);
// FIXME: We should use the S_ section type instead of the name.
diff --git a/lib/MC/MCObjectSymbolizer.cpp b/lib/MC/MCObjectSymbolizer.cpp
index cdf743e6bb..3fb053dd78 100644
--- a/lib/MC/MCObjectSymbolizer.cpp
+++ b/lib/MC/MCObjectSymbolizer.cpp
@@ -52,10 +52,8 @@ MCMachObjectSymbolizer(MCContext &Ctx, OwningPtr<MCRelocationInfo> &RelInfo,
: MCObjectSymbolizer(Ctx, RelInfo, MOOF), MOOF(MOOF),
StubsStart(0), StubsCount(0), StubSize(0), StubsIndSymIndex(0) {
- error_code ec;
for (section_iterator SI = MOOF->begin_sections(), SE = MOOF->end_sections();
- SI != SE; SI.increment(ec)) {
- if (ec) break;
+ SI != SE; ++SI) {
StringRef Name; SI->getName(Name);
if (Name == "__stubs") {
SectionRef StubsSec = *SI;
@@ -91,10 +89,8 @@ StringRef MCMachObjectSymbolizer::findExternalFunctionAt(uint64_t Addr) {
StringRef SymName;
symbol_iterator SI = MOOF->begin_symbols();
- error_code ec;
- for (uint32_t i = 0; i != SymtabIdx; ++i) {
- SI.increment(ec);
- }
+ for (uint32_t i = 0; i != SymtabIdx; ++i)
+ ++SI;
SI->getName(SymName);
assert(SI != MOOF->end_symbols() && "Stub wasn't found in the symbol table!");
assert(SymName.front() == '_' && "Mach-O symbol doesn't start with '_'!");
@@ -159,10 +155,8 @@ tryAddingSymbolicOperand(MCInst &MI, raw_ostream &cStream,
return false;
uint64_t UValue = Value;
// FIXME: map instead of looping each time?
- error_code ec;
for (symbol_iterator SI = Obj->begin_symbols(), SE = Obj->end_symbols();
- SI != SE; SI.increment(ec)) {
- if (ec) break;
+ SI != SE; ++SI) {
uint64_t SymAddr; SI->getAddress(SymAddr);
uint64_t SymSize; SI->getSize(SymSize);
StringRef SymName; SI->getName(SymName);
@@ -239,11 +233,8 @@ const RelocationRef *MCObjectSymbolizer::findRelocationAt(uint64_t Addr) {
}
void MCObjectSymbolizer::buildSectionList() {
- error_code ec;
for (section_iterator SI = Obj->begin_sections(), SE = Obj->end_sections();
- SI != SE; SI.increment(ec)) {
- if (ec) break;
-
+ SI != SE; ++SI) {
bool RequiredForExec; SI->isRequiredForExecution(RequiredForExec);
if (RequiredForExec == false)
continue;
@@ -263,11 +254,8 @@ void MCObjectSymbolizer::buildSectionList() {
}
void MCObjectSymbolizer::buildRelocationByAddrMap() {
- error_code ec;
for (section_iterator SI = Obj->begin_sections(), SE = Obj->end_sections();
- SI != SE; SI.increment(ec)) {
- if (ec) break;
-
+ SI != SE; ++SI) {
section_iterator RelSecI = SI->getRelocatedSection();
if (RelSecI == Obj->end_sections())
continue;
@@ -279,9 +267,7 @@ void MCObjectSymbolizer::buildRelocationByAddrMap() {
continue;
for (relocation_iterator RI = SI->begin_relocations(),
RE = SI->end_relocations();
- RI != RE;
- RI.increment(ec)) {
- if (ec) break;
+ RI != RE; ++RI) {
// FIXME: libObject is inconsistent regarding error handling. The
// overwhelming majority of methods always return object_error::success,
// and assert for simple errors.. Here, ELFObjectFile::getRelocationOffset
diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp
index 1558d9d15f..6439056dfa 100644
--- a/lib/Object/COFFObjectFile.cpp
+++ b/lib/Object/COFFObjectFile.cpp
@@ -87,13 +87,10 @@ const coff_section *COFFObjectFile::toSec(DataRefImpl Ref) const {
return Addr;
}
-error_code COFFObjectFile::getSymbolNext(DataRefImpl Ref,
- SymbolRef &Result) const {
+void COFFObjectFile::moveSymbolNext(DataRefImpl &Ref) const {
const coff_symbol *Symb = toSymb(Ref);
Symb += 1 + Symb->NumberOfAuxSymbols;
Ref.p = reinterpret_cast<uintptr_t>(Symb);
- Result = SymbolRef(Ref, this);
- return object_error::success;
}
error_code COFFObjectFile::getSymbolName(DataRefImpl Ref,
@@ -221,13 +218,10 @@ error_code COFFObjectFile::getSymbolValue(DataRefImpl Ref,
report_fatal_error("getSymbolValue unimplemented in COFFObjectFile");
}
-error_code COFFObjectFile::getSectionNext(DataRefImpl Ref,
- SectionRef &Result) const {
+void COFFObjectFile::moveSectionNext(DataRefImpl &Ref) const {
const coff_section *Sec = toSec(Ref);
Sec += 1;
Ref.p = reinterpret_cast<uintptr_t>(Sec);
- Result = SectionRef(Ref, this);
- return object_error::success;
}
error_code COFFObjectFile::getSectionName(DataRefImpl Ref,
@@ -386,11 +380,8 @@ error_code COFFObjectFile::initSymbolTablePtr() {
// Returns the file offset for the given RVA.
error_code COFFObjectFile::getRvaPtr(uint32_t Rva, uintptr_t &Res) const {
- error_code EC;
for (section_iterator I = begin_sections(), E = end_sections(); I != E;
- I.increment(EC)) {
- if (EC)
- return EC;
+ ++I) {
const coff_section *Section = getCOFFSection(I);
uint32_t SectionStart = Section->VirtualAddress;
uint32_t SectionEnd = Section->VirtualAddress + Section->VirtualSize;
@@ -801,12 +792,9 @@ const coff_relocation *COFFObjectFile::toRel(DataRefImpl Rel) const {
return reinterpret_cast<const coff_relocation*>(Rel.p);
}
-error_code COFFObjectFile::getRelocationNext(DataRefImpl Rel,
- RelocationRef &Res) const {
+void COFFObjectFile::moveRelocationNext(DataRefImpl &Rel) const {
Rel.p = reinterpret_cast<uintptr_t>(
reinterpret_cast<const coff_relocation*>(Rel.p) + 1);
- Res = RelocationRef(Rel, this);
- return object_error::success;
}
error_code COFFObjectFile::getRelocationAddress(DataRefImpl Rel,
@@ -932,10 +920,8 @@ operator==(const ImportDirectoryEntryRef &Other) const {
return ImportTable == Other.ImportTable && Index == Other.Index;
}
-error_code
-ImportDirectoryEntryRef::getNext(ImportDirectoryEntryRef &Result) const {
- Result = ImportDirectoryEntryRef(ImportTable, Index + 1, OwningObject);
- return object_error::success;
+void ImportDirectoryEntryRef::moveNext() {
+ ++Index;
}
error_code ImportDirectoryEntryRef::
@@ -967,10 +953,8 @@ operator==(const ExportDirectoryEntryRef &Other) const {
return ExportTable == Other.ExportTable && Index == Other.Index;
}
-error_code
-ExportDirectoryEntryRef::getNext(ExportDirectoryEntryRef &Result) const {
- Result = ExportDirectoryEntryRef(ExportTable, Index + 1, OwningObject);
- return object_error::success;
+void ExportDirectoryEntryRef::moveNext() {
+ ++Index;
}
// Returns the name of the current export symbol. If the symbol is exported only
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp
index 2409314e12..49e3148ac8 100644
--- a/lib/Object/MachOObjectFile.cpp
+++ b/lib/Object/MachOObjectFile.cpp
@@ -275,18 +275,9 @@ static StringRef parseSegmentOrSectionName(const char *P) {
// Helper to advance a section or symbol iterator multiple increments at a time.
template<class T>
-static error_code advance(T &it, size_t Val) {
- error_code ec;
- while (Val--) {
- it.increment(ec);
- }
- return ec;
-}
-
-template<class T>
-static void advanceTo(T &it, size_t Val) {
- if (error_code ec = advance(it, Val))
- report_fatal_error(ec.message());
+static void advance(T &it, size_t Val) {
+ while (Val--)
+ ++it;
}
static unsigned getCPUType(const MachOObjectFile *O) {
@@ -305,11 +296,9 @@ static void printRelocationTargetName(const MachOObjectFile *O,
if (IsScattered) {
uint32_t Val = O->getPlainRelocationSymbolNum(RE);
- error_code ec;
for (symbol_iterator SI = O->begin_symbols(), SE = O->end_symbols();
- SI != SE; SI.increment(ec)) {
- if (ec) report_fatal_error(ec.message());
-
+ SI != SE; ++SI) {
+ error_code ec;
uint64_t Addr;
StringRef Name;
@@ -325,9 +314,8 @@ static void printRelocationTargetName(const MachOObjectFile *O,
// If we couldn't find a symbol that this relocation refers to, try
// to find a section beginning instead.
for (section_iterator SI = O->begin_sections(), SE = O->end_sections();
- SI != SE; SI.increment(ec)) {
- if (ec) report_fatal_error(ec.message());
-
+ SI != SE; ++SI) {
+ error_code ec;
uint64_t Addr;
StringRef Name;
@@ -350,12 +338,12 @@ static void printRelocationTargetName(const MachOObjectFile *O,
if (isExtern) {
symbol_iterator SI = O->begin_symbols();
- advanceTo(SI, Val);
+ advance(SI, Val);
SI->getName(S);
} else {
section_iterator SI = O->begin_sections();
// Adjust for the fact that sections are 1-indexed.
- advanceTo(SI, Val - 1);
+ advance(SI, Val - 1);
SI->getName(S);
}
@@ -454,14 +442,11 @@ MachOObjectFile::MachOObjectFile(MemoryBuffer *Object, bool IsLittleEndian,
}
}
-error_code MachOObjectFile::getSymbolNext(DataRefImpl Symb,
- SymbolRef &Res) const {
+void MachOObjectFile::moveSymbolNext(DataRefImpl &Symb) const {
unsigned SymbolTableEntrySize = is64Bit() ?
sizeof(MachO::nlist_64) :
sizeof(MachO::nlist);
Symb.p += SymbolTableEntrySize;
- Res = SymbolRef(Symb, this);
- return object_error::success;
}
error_code MachOObjectFile::getSymbolName(DataRefImpl Symb,
@@ -545,9 +530,7 @@ error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI,
}
// Unfortunately symbols are unsorted so we need to touch all
// symbols from load command
- error_code ec;
- for (symbol_iterator I = begin_symbols(), E = end_symbols(); I != E;
- I.increment(ec)) {
+ for (symbol_iterator I = begin_symbols(), E = end_symbols(); I != E; ++I) {
DataRefImpl DRI = I->getRawDataRefImpl();
Entry = getSymbolTableEntryBase(this, DRI);
getSymbolAddress(DRI, Value);
@@ -648,11 +631,8 @@ error_code MachOObjectFile::getSymbolValue(DataRefImpl Symb,
report_fatal_error("getSymbolValue unimplemented in MachOObjectFile");
}
-error_code MachOObjectFile::getSectionNext(DataRefImpl Sec,
- SectionRef &Res) const {
+void MachOObjectFile::moveSectionNext(DataRefImpl &Sec) const {
Sec.d.a++;
- Res = SectionRef(Sec, this);
- return object_error::success;
}
error_code
@@ -834,13 +814,10 @@ MachOObjectFile::section_rel_end(DataRefImpl Sec) const {
return relocation_iterator(RelocationRef(Ret, this));
}
-error_code MachOObjectFile::getRelocationNext(DataRefImpl Rel,
- RelocationRef &Res) const {
+void MachOObjectFile::moveRelocationNext(DataRefImpl &Rel) const {
const MachO::any_relocation_info *P =
reinterpret_cast<const MachO::any_relocation_info *>(Rel.p);
Rel.p = reinterpret_cast<uintptr_t>(P + 1);
- Res = RelocationRef(Rel, this);
- return object_error::success;
}
error_code
diff --git a/lib/Object/Object.cpp b/lib/Object/Object.cpp
index e454d8eec7..399d460f8c 100644
--- a/lib/Object/Object.cpp
+++ b/lib/Object/Object.cpp
@@ -84,9 +84,7 @@ LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile,
}
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI) {
- error_code ec;
- unwrap(SI)->increment(ec);
- if (ec) report_fatal_error("LLVMMoveToNextSection failed: " + ec.message());
+ ++(*unwrap(SI));
}
void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect,
@@ -111,9 +109,7 @@ LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef ObjectFile,
}
void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI) {
- error_code ec;
- unwrap(SI)->increment(ec);
- if (ec) report_fatal_error("LLVMMoveToNextSymbol failed: " + ec.message());
+ ++(*unwrap(SI));
}
// SectionRef accessors
@@ -169,10 +165,7 @@ LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section,
}
void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef SI) {
- error_code ec;
- unwrap(SI)->increment(ec);
- if (ec) report_fatal_error("LLVMMoveToNextRelocation failed: " +
- ec.message());
+ ++(*unwrap(SI));
}
diff --git a/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp b/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
index 1114ff96cf..024bdb75b4 100644
--- a/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
+++ b/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
@@ -72,9 +72,9 @@ public:
break;
case X86_64_RELOC_SUBTRACTOR:
{
- RelocationRef RelNext;
- Obj->getRelocationNext(Rel.getRawDataRefImpl(), RelNext);
- any_relocation_info RENext = Obj->getRelocation(RelNext.getRawDataRefImpl());
+ Rel.moveNext();
+ any_relocation_info RENext =
+ Obj->getRelocation(Rel.getRawDataRefImpl());
// X86_64_SUBTRACTOR must be followed by a relocation of type
// X86_64_RELOC_UNSIGNED.
@@ -86,7 +86,7 @@ public:
const MCExpr *LHS = MCSymbolRefExpr::Create(Sym, Ctx);
- symbol_iterator RSymI = RelNext.getSymbol();
+ symbol_iterator RSymI = Rel.getSymbol();
uint64_t RSymAddr;
RSymI->getAddress(RSymAddr);
StringRef RSymName;