diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFContext.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp | 14 | ||||
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Object/COFFObjectFile.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Object/MachOObjectFile.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Object/Object.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp | 13 |
8 files changed, 28 insertions, 41 deletions
diff --git a/llvm/lib/DebugInfo/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARFContext.cpp index 7e4132f059b..aaae952da5b 100644 --- a/llvm/lib/DebugInfo/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARFContext.cpp @@ -595,9 +595,8 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : uint64_t SymAddr = 0; // ELF relocations may need the symbol address if (Obj->isELF()) { - object::SymbolRef Sym; - reloc_i->getSymbol(Sym); - Sym.getAddress(SymAddr); + object::symbol_iterator Sym = reloc_i->getSymbol(); + Sym->getAddress(SymAddr); } object::RelocVisitor V(Obj->getFileFormatName()); diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index ee424db6aff..e552cea1bc0 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -551,9 +551,8 @@ void RuntimeDyldELF::findOPDEntrySection(ObjectImage &Obj, continue; } - SymbolRef TargetSymbol; uint64_t TargetSymbolOffset; - check(i->getSymbol(TargetSymbol)); + symbol_iterator TargetSymbol = i->getSymbol(); check(i->getOffset(TargetSymbolOffset)); int64_t Addend; check(getELFRelocationAddend(*i, Addend)); @@ -576,7 +575,7 @@ void RuntimeDyldELF::findOPDEntrySection(ObjectImage &Obj, continue; section_iterator tsi(Obj.end_sections()); - check(TargetSymbol.getSection(tsi)); + check(TargetSymbol->getSection(tsi)); Rel.SectionID = findOrEmitSection(Obj, (*tsi), true, LocalSections); Rel.Addend = (intptr_t)Addend; return; @@ -777,12 +776,11 @@ void RuntimeDyldELF::processRelocationRef(unsigned SectionID, Check(RelI.getType(RelType)); int64_t Addend; Check(getELFRelocationAddend(RelI, Addend)); - SymbolRef Symbol; - Check(RelI.getSymbol(Symbol)); + symbol_iterator Symbol = RelI.getSymbol(); // Obtain the symbol name which is referenced in the relocation StringRef TargetName; - Symbol.getName(TargetName); + Symbol->getName(TargetName); DEBUG(dbgs() << "\t\tRelType: " << RelType << " Addend: " << Addend << " TargetName: " << TargetName @@ -791,7 +789,7 @@ void RuntimeDyldELF::processRelocationRef(unsigned SectionID, // First search for the symbol in the local symbol table SymbolTableMap::const_iterator lsi = Symbols.find(TargetName.data()); SymbolRef::Type SymType; - Symbol.getType(SymType); + Symbol->getType(SymType); if (lsi != Symbols.end()) { Value.SectionID = lsi->second.first; Value.Addend = lsi->second.second + Addend; @@ -809,7 +807,7 @@ void RuntimeDyldELF::processRelocationRef(unsigned SectionID, // and can be changed by another developers. Maybe best way is add // a new symbol type ST_Section to SymbolRef and use it. section_iterator si(Obj.end_sections()); - Symbol.getSection(si); + Symbol->getSection(si); if (si == Obj.end_sections()) llvm_unreachable("Symbol section not found, bad object file format!"); DEBUG(dbgs() << "\t\tThis is section symbol\n"); diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp index 01a3fd9f82d..0384b322624 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp @@ -302,10 +302,9 @@ void RuntimeDyldMachO::processRelocationRef(unsigned SectionID, if (isExtern) { // Obtain the symbol name which is referenced in the relocation - SymbolRef Symbol; - RelI.getSymbol(Symbol); + symbol_iterator Symbol = RelI.getSymbol(); StringRef TargetName; - Symbol.getName(TargetName); + Symbol->getName(TargetName); // First search for the symbol in the local symbol table SymbolTableMap::const_iterator lsi = Symbols.find(TargetName.data()); if (lsi != Symbols.end()) { diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index f5b49ab0618..bc5958d3c47 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/lib/Object/COFFObjectFile.cpp @@ -712,13 +712,11 @@ error_code COFFObjectFile::getRelocationOffset(DataRefImpl Rel, Res = toRel(Rel)->VirtualAddress; return object_error::success; } -error_code COFFObjectFile::getRelocationSymbol(DataRefImpl Rel, - SymbolRef &Res) const { +symbol_iterator COFFObjectFile::getRelocationSymbol(DataRefImpl Rel) const { const coff_relocation* R = toRel(Rel); DataRefImpl Symb; Symb.p = reinterpret_cast<uintptr_t>(SymbolTable + R->SymbolTableIndex); - Res = SymbolRef(Symb, this); - return object_error::success; + return symbol_iterator(SymbolRef(Symb, this)); } error_code COFFObjectFile::getRelocationType(DataRefImpl Rel, uint64_t &Res) const { diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 654af081f9e..bd5ea57c1f5 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -869,15 +869,13 @@ error_code MachOObjectFile::getRelocationOffset(DataRefImpl Rel, return object_error::success; } -error_code -MachOObjectFile::getRelocationSymbol(DataRefImpl Rel, SymbolRef &Res) const { +symbol_iterator +MachOObjectFile::getRelocationSymbol(DataRefImpl Rel) const { macho::RelocationEntry RE = getRelocation(Rel); uint32_t SymbolIdx = getPlainRelocationSymbolNum(RE); bool isExtern = getPlainRelocationExternal(RE); - if (!isExtern) { - Res = *end_symbols(); - return object_error::success; - } + if (!isExtern) + return end_symbols(); macho::SymtabLoadCommand S = getSymtabLoadCommand(); unsigned SymbolTableEntrySize = is64Bit() ? @@ -886,8 +884,7 @@ MachOObjectFile::getRelocationSymbol(DataRefImpl Rel, SymbolRef &Res) const { uint64_t Offset = S.SymbolTableOffset + SymbolIdx * SymbolTableEntrySize; DataRefImpl Sym; Sym.p = reinterpret_cast<uintptr_t>(getPtr(this, Offset)); - Res = SymbolRef(Sym, this); - return object_error::success; + return symbol_iterator(SymbolRef(Sym, this)); } error_code MachOObjectFile::getRelocationType(DataRefImpl Rel, diff --git a/llvm/lib/Object/Object.cpp b/llvm/lib/Object/Object.cpp index 3e2c78ec47c..6941708dd34 100644 --- a/llvm/lib/Object/Object.cpp +++ b/llvm/lib/Object/Object.cpp @@ -219,10 +219,7 @@ uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI) { } LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI) { - SymbolRef ret; - if (error_code ec = (*unwrap(RI))->getSymbol(ret)) - report_fatal_error(ec.message()); - + symbol_iterator ret = (*unwrap(RI))->getSymbol(); return wrap(new symbol_iterator(ret)); } diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp index 917c37d2ca5..8f4ab4673d5 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp @@ -27,11 +27,11 @@ public: const MCExpr *createExprForRelocation(RelocationRef Rel) { uint64_t RelType; Rel.getType(RelType); - SymbolRef SymRef; Rel.getSymbol(SymRef); + symbol_iterator SymI = Rel.getSymbol(); - StringRef SymName; SymRef.getName(SymName); - uint64_t SymAddr; SymRef.getAddress(SymAddr); - uint64_t SymSize; SymRef.getSize(SymSize); + StringRef SymName; SymI->getName(SymName); + uint64_t SymAddr; SymI->getAddress(SymAddr); + uint64_t SymSize; SymI->getSize(SymSize); int64_t Addend; getELFRelocationAddend(Rel, Addend); MCSymbol *Sym = Ctx.GetOrCreateSymbol(SymName); diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp index a76cad555df..75b5acf5089 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp @@ -28,10 +28,10 @@ public: const MachOObjectFile *Obj = cast<MachOObjectFile>(Rel.getObjectFile()); uint64_t RelType; Rel.getType(RelType); - SymbolRef SymRef; Rel.getSymbol(SymRef); + symbol_iterator SymI = Rel.getSymbol(); - StringRef SymName; SymRef.getName(SymName); - uint64_t SymAddr; SymRef.getAddress(SymAddr); + StringRef SymName; SymI->getName(SymName); + uint64_t SymAddr; SymI->getAddress(SymAddr); RelocationEntry RE = Obj->getRelocation(Rel.getRawDataRefImpl()); bool isPCRel = Obj->getAnyRelocationPCRel(RE); @@ -86,12 +86,11 @@ public: const MCExpr *LHS = MCSymbolRefExpr::Create(Sym, Ctx); - SymbolRef RSymRef; - RelNext.getSymbol(RSymRef); + symbol_iterator RSymI = RelNext.getSymbol(); uint64_t RSymAddr; - RSymRef.getAddress(RSymAddr); + RSymI->getAddress(RSymAddr); StringRef RSymName; - RSymRef.getName(RSymName); + RSymI->getName(RSymName); MCSymbol *RSym = Ctx.GetOrCreateSymbol(RSymName); if (RSym->isVariable() == false) |