1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Convert getSymbolSection to return an ErrorOr.

This function can actually fail since the symbol contains an index to the
section and that can be invalid.

llvm-svn: 244375
This commit is contained in:
Rafael Espindola 2015-08-07 23:27:14 +00:00
parent d517a7b7ab
commit 088669ce42
22 changed files with 83 additions and 91 deletions

View File

@ -653,8 +653,7 @@ protected:
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override; uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
uint32_t getSymbolFlags(DataRefImpl Symb) const override; uint32_t getSymbolFlags(DataRefImpl Symb) const override;
SymbolRef::Type getSymbolType(DataRefImpl Symb) const override; SymbolRef::Type getSymbolType(DataRefImpl Symb) const override;
std::error_code getSymbolSection(DataRefImpl Symb, ErrorOr<section_iterator> getSymbolSection(DataRefImpl Symb) const override;
section_iterator &Res) const override;
void moveSectionNext(DataRefImpl &Sec) const override; void moveSectionNext(DataRefImpl &Sec) const override;
std::error_code getSectionName(DataRefImpl Sec, std::error_code getSectionName(DataRefImpl Sec,
StringRef &Res) const override; StringRef &Res) const override;

View File

@ -204,9 +204,8 @@ protected:
uint8_t getSymbolOther(DataRefImpl Symb) const override; uint8_t getSymbolOther(DataRefImpl Symb) const override;
uint8_t getSymbolELFType(DataRefImpl Symb) const override; uint8_t getSymbolELFType(DataRefImpl Symb) const override;
SymbolRef::Type getSymbolType(DataRefImpl Symb) const override; SymbolRef::Type getSymbolType(DataRefImpl Symb) const override;
section_iterator getSymbolSection(const Elf_Sym *Symb) const; ErrorOr<section_iterator> getSymbolSection(const Elf_Sym *Symb) const;
std::error_code getSymbolSection(DataRefImpl Symb, ErrorOr<section_iterator> getSymbolSection(DataRefImpl Symb) const override;
section_iterator &Res) const override;
void moveSectionNext(DataRefImpl &Sec) const override; void moveSectionNext(DataRefImpl &Sec) const override;
std::error_code getSectionName(DataRefImpl Sec, std::error_code getSectionName(DataRefImpl Sec,
@ -505,11 +504,11 @@ uint32_t ELFObjectFile<ELFT>::getSymbolFlags(DataRefImpl Sym) const {
} }
template <class ELFT> template <class ELFT>
section_iterator ErrorOr<section_iterator>
ELFObjectFile<ELFT>::getSymbolSection(const Elf_Sym *ESym) const { ELFObjectFile<ELFT>::getSymbolSection(const Elf_Sym *ESym) const {
ErrorOr<const Elf_Shdr *> ESecOrErr = EF.getSection(ESym); ErrorOr<const Elf_Shdr *> ESecOrErr = EF.getSection(ESym);
if (std::error_code EC = ESecOrErr.getError()) if (std::error_code EC = ESecOrErr.getError())
report_fatal_error(EC.message()); return EC;
const Elf_Shdr *ESec = *ESecOrErr; const Elf_Shdr *ESec = *ESecOrErr;
if (!ESec) if (!ESec)
@ -521,11 +520,9 @@ ELFObjectFile<ELFT>::getSymbolSection(const Elf_Sym *ESym) const {
} }
template <class ELFT> template <class ELFT>
std::error_code ErrorOr<section_iterator>
ELFObjectFile<ELFT>::getSymbolSection(DataRefImpl Symb, ELFObjectFile<ELFT>::getSymbolSection(DataRefImpl Symb) const {
section_iterator &Res) const { return getSymbolSection(getSymbol(Symb));
Res = getSymbolSection(getSymbol(Symb));
return std::error_code();
} }
template <class ELFT> template <class ELFT>

View File

@ -210,8 +210,7 @@ public:
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override; uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
SymbolRef::Type getSymbolType(DataRefImpl Symb) const override; SymbolRef::Type getSymbolType(DataRefImpl Symb) const override;
uint32_t getSymbolFlags(DataRefImpl Symb) const override; uint32_t getSymbolFlags(DataRefImpl Symb) const override;
std::error_code getSymbolSection(DataRefImpl Symb, ErrorOr<section_iterator> getSymbolSection(DataRefImpl Symb) const override;
section_iterator &Res) const override;
unsigned getSymbolSectionID(SymbolRef Symb) const; unsigned getSymbolSectionID(SymbolRef Symb) const;
unsigned getSectionID(SectionRef Sec) const; unsigned getSectionID(SectionRef Sec) const;

View File

@ -147,7 +147,7 @@ public:
/// @brief Get section this symbol is defined in reference to. Result is /// @brief Get section this symbol is defined in reference to. Result is
/// end_sections() if it is undefined or is an absolute symbol. /// end_sections() if it is undefined or is an absolute symbol.
std::error_code getSection(section_iterator &Result) const; ErrorOr<section_iterator> getSection() const;
const ObjectFile *getObject() const; const ObjectFile *getObject() const;
}; };
@ -202,8 +202,8 @@ protected:
virtual uint32_t getSymbolAlignment(DataRefImpl Symb) const; virtual uint32_t getSymbolAlignment(DataRefImpl Symb) const;
virtual uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const = 0; virtual uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const = 0;
virtual SymbolRef::Type getSymbolType(DataRefImpl Symb) const = 0; virtual SymbolRef::Type getSymbolType(DataRefImpl Symb) const = 0;
virtual std::error_code getSymbolSection(DataRefImpl Symb, virtual ErrorOr<section_iterator>
section_iterator &Res) const = 0; getSymbolSection(DataRefImpl Symb) const = 0;
// Same as above for SectionRef. // Same as above for SectionRef.
friend class SectionRef; friend class SectionRef;
@ -323,8 +323,8 @@ inline uint64_t SymbolRef::getCommonSize() const {
return getObject()->getCommonSymbolSize(getRawDataRefImpl()); return getObject()->getCommonSymbolSize(getRawDataRefImpl());
} }
inline std::error_code SymbolRef::getSection(section_iterator &Result) const { inline ErrorOr<section_iterator> SymbolRef::getSection() const {
return getObject()->getSymbolSection(getRawDataRefImpl(), Result); return getObject()->getSymbolSection(getRawDataRefImpl());
} }
inline SymbolRef::Type SymbolRef::getType() const { inline SymbolRef::Type SymbolRef::getType() const {

View File

@ -685,7 +685,7 @@ DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj,
} }
SymAddr = *SymAddrOrErr; SymAddr = *SymAddrOrErr;
// Also remember what section this symbol is in for later // Also remember what section this symbol is in for later
Sym->getSection(RSec); RSec = *Sym->getSection();
} else if (auto *MObj = dyn_cast<MachOObjectFile>(&Obj)) { } else if (auto *MObj = dyn_cast<MachOObjectFile>(&Obj)) {
// MachO also has relocations that point to sections and // MachO also has relocations that point to sections and
// scattered relocations. // scattered relocations.

View File

@ -164,8 +164,9 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
ErrorOr<StringRef> NameOrErr = I->getName(); ErrorOr<StringRef> NameOrErr = I->getName();
Check(NameOrErr.getError()); Check(NameOrErr.getError());
StringRef Name = *NameOrErr; StringRef Name = *NameOrErr;
section_iterator SI = Obj.section_end(); ErrorOr<section_iterator> SIOrErr = I->getSection();
Check(I->getSection(SI)); Check(SIOrErr.getError());
section_iterator SI = *SIOrErr;
if (SI == Obj.section_end()) if (SI == Obj.section_end())
continue; continue;
uint64_t SectOffset; uint64_t SectOffset;

View File

@ -845,8 +845,9 @@ void RuntimeDyldELF::findOPDEntrySection(const ELFObjectFileBase &Obj,
if (Rel.Addend != (int64_t)TargetSymbolOffset) if (Rel.Addend != (int64_t)TargetSymbolOffset)
continue; continue;
section_iterator tsi(Obj.section_end()); ErrorOr<section_iterator> TSIOrErr = TargetSymbol->getSection();
check(TargetSymbol->getSection(tsi)); check(TSIOrErr.getError());
section_iterator tsi = *TSIOrErr;
bool IsCode = tsi->isText(); bool IsCode = tsi->isText();
Rel.SectionID = findOrEmitSection(Obj, (*tsi), IsCode, LocalSections); Rel.SectionID = findOrEmitSection(Obj, (*tsi), IsCode, LocalSections);
Rel.Addend = (intptr_t)Addend; Rel.Addend = (intptr_t)Addend;
@ -1162,8 +1163,7 @@ relocation_iterator RuntimeDyldELF::processRelocationRef(
// TODO: Now ELF SymbolRef::ST_Debug = STT_SECTION, it's not obviously // TODO: Now ELF SymbolRef::ST_Debug = STT_SECTION, it's not obviously
// and can be changed by another developers. Maybe best way is add // and can be changed by another developers. Maybe best way is add
// a new symbol type ST_Section to SymbolRef and use it. // a new symbol type ST_Section to SymbolRef and use it.
section_iterator si(Obj.section_end()); section_iterator si = *Symbol->getSection();
Symbol->getSection(si);
if (si == Obj.section_end()) if (si == Obj.section_end())
llvm_unreachable("Symbol section not found, bad object file format!"); llvm_unreachable("Symbol section not found, bad object file format!");
DEBUG(dbgs() << "\t\tThis is section symbol\n"); DEBUG(dbgs() << "\t\tThis is section symbol\n");

View File

@ -119,8 +119,7 @@ public:
symbol_iterator Symbol = RelI->getSymbol(); symbol_iterator Symbol = RelI->getSymbol();
if (Symbol == Obj.symbol_end()) if (Symbol == Obj.symbol_end())
report_fatal_error("Unknown symbol in relocation"); report_fatal_error("Unknown symbol in relocation");
section_iterator SecI(Obj.section_end()); section_iterator SecI = *Symbol->getSection();
Symbol->getSection(SecI);
// If there is no section, this must be an external reference. // If there is no section, this must be an external reference.
const bool IsExtern = SecI == Obj.section_end(); const bool IsExtern = SecI == Obj.section_end();

View File

@ -238,21 +238,17 @@ uint64_t COFFObjectFile::getCommonSymbolSizeImpl(DataRefImpl Ref) const {
return Symb.getValue(); return Symb.getValue();
} }
std::error_code ErrorOr<section_iterator>
COFFObjectFile::getSymbolSection(DataRefImpl Ref, COFFObjectFile::getSymbolSection(DataRefImpl Ref) const {
section_iterator &Result) const {
COFFSymbolRef Symb = getCOFFSymbol(Ref); COFFSymbolRef Symb = getCOFFSymbol(Ref);
if (COFF::isReservedSectionNumber(Symb.getSectionNumber())) { if (COFF::isReservedSectionNumber(Symb.getSectionNumber()))
Result = section_end(); return section_end();
} else {
const coff_section *Sec = nullptr; const coff_section *Sec = nullptr;
if (std::error_code EC = getSection(Symb.getSectionNumber(), Sec)) if (std::error_code EC = getSection(Symb.getSectionNumber(), Sec))
return EC; return EC;
DataRefImpl Ref; DataRefImpl Ret;
Ref.p = reinterpret_cast<uintptr_t>(Sec); Ret.p = reinterpret_cast<uintptr_t>(Sec);
Result = section_iterator(SectionRef(Ref, this)); return section_iterator(SectionRef(Ret, this));
}
return std::error_code();
} }
unsigned COFFObjectFile::getSymbolSectionID(SymbolRef Sym) const { unsigned COFFObjectFile::getSymbolSectionID(SymbolRef Sym) const {

View File

@ -445,22 +445,18 @@ uint32_t MachOObjectFile::getSymbolFlags(DataRefImpl DRI) const {
return Result; return Result;
} }
std::error_code MachOObjectFile::getSymbolSection(DataRefImpl Symb, ErrorOr<section_iterator>
section_iterator &Res) const { MachOObjectFile::getSymbolSection(DataRefImpl Symb) const {
MachO::nlist_base Entry = getSymbolTableEntryBase(this, Symb); MachO::nlist_base Entry = getSymbolTableEntryBase(this, Symb);
uint8_t index = Entry.n_sect; uint8_t index = Entry.n_sect;
if (index == 0) { if (index == 0)
Res = section_end(); return section_end();
} else {
DataRefImpl DRI; DataRefImpl DRI;
DRI.d.a = index - 1; DRI.d.a = index - 1;
if (DRI.d.a >= Sections.size()) if (DRI.d.a >= Sections.size())
report_fatal_error("getSymbolSection: Invalid section index."); report_fatal_error("getSymbolSection: Invalid section index.");
Res = section_iterator(SectionRef(DRI, this)); return section_iterator(SectionRef(DRI, this));
}
return std::error_code();
} }
unsigned MachOObjectFile::getSymbolSectionID(SymbolRef Sym) const { unsigned MachOObjectFile::getSymbolSectionID(SymbolRef Sym) const {

View File

@ -98,8 +98,10 @@ void LLVMMoveToNextSection(LLVMSectionIteratorRef SI) {
void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect, void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect,
LLVMSymbolIteratorRef Sym) { LLVMSymbolIteratorRef Sym) {
if (std::error_code ec = (*unwrap(Sym))->getSection(*unwrap(Sect))) ErrorOr<section_iterator> SecOrErr = (*unwrap(Sym))->getSection();
if (std::error_code ec = SecOrErr.getError())
report_fatal_error(ec.message()); report_fatal_error(ec.message());
*unwrap(Sect) = *SecOrErr;
} }
// ObjectFile Symbol iterators // ObjectFile Symbol iterators

View File

@ -29,10 +29,10 @@ ObjectFile::ObjectFile(unsigned int Type, MemoryBufferRef Source)
: SymbolicFile(Type, Source) {} : SymbolicFile(Type, Source) {}
bool SectionRef::containsSymbol(SymbolRef S) const { bool SectionRef::containsSymbol(SymbolRef S) const {
section_iterator SymSec = getObject()->section_end(); ErrorOr<section_iterator> SymSec = S.getSection();
if (S.getSection(SymSec)) if (!SymSec)
return false; return false;
return *this == *SymSec; return *this == **SymSec;
} }
uint64_t ObjectFile::getSymbolValue(DataRefImpl Ref) const { uint64_t ObjectFile::getSymbolValue(DataRefImpl Ref) const {

View File

@ -265,8 +265,13 @@ void MachODebugMapParser::loadMainBinarySymbols(
// are the only ones that need to be queried because the address // 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 // of common data won't be described in the debug map. All other
// addresses should be fetched for the debug map. // addresses should be fetched for the debug map.
if (!(Sym.getFlags() & SymbolRef::SF_Global) || Sym.getSection(Section) || if (!(Sym.getFlags() & SymbolRef::SF_Global))
Section == MainBinary.section_end() || Section->isText()) continue;
ErrorOr<section_iterator> SectionOrErr = Sym.getSection();
if (!SectionOrErr)
continue;
Section = *SectionOrErr;
if (Section == MainBinary.section_end() || Section->isText())
continue; continue;
uint64_t Addr = Sym.getValue(); uint64_t Addr = Sym.getValue();
ErrorOr<StringRef> NameOrErr = Sym.getName(); ErrorOr<StringRef> NameOrErr = Sym.getName();

View File

@ -184,8 +184,9 @@ static void dumpCXXData(const ObjectFile *Obj) {
ErrorOr<StringRef> SymNameOrErr = Sym.getName(); ErrorOr<StringRef> SymNameOrErr = Sym.getName();
error(SymNameOrErr.getError()); error(SymNameOrErr.getError());
StringRef SymName = *SymNameOrErr; StringRef SymName = *SymNameOrErr;
object::section_iterator SecI(Obj->section_begin()); ErrorOr<object::section_iterator> SecIOrErr = Sym.getSection();
error(Sym.getSection(SecI)); error(SecIOrErr.getError());
object::section_iterator SecI = *SecIOrErr;
// Skip external symbols. // Skip external symbols.
if (SecI == Obj->section_end()) if (SecI == Obj->section_end())
continue; continue;

View File

@ -314,8 +314,7 @@ static void darwinPrintSymbol(MachOObjectFile *MachO, SymbolListT::iterator I,
outs() << "(indirect) "; outs() << "(indirect) ";
break; break;
case MachO::N_SECT: { case MachO::N_SECT: {
section_iterator Sec = MachO->section_end(); section_iterator Sec = *MachO->getSymbolSection(I->Sym.getRawDataRefImpl());
MachO->getSymbolSection(I->Sym.getRawDataRefImpl(), Sec);
DataRefImpl Ref = Sec->getRawDataRefImpl(); DataRefImpl Ref = Sec->getRawDataRefImpl();
StringRef SectionName; StringRef SectionName;
MachO->getSectionName(Ref, SectionName); MachO->getSectionName(Ref, SectionName);
@ -594,10 +593,11 @@ static char getSymbolNMTypeChar(ELFObjectFileBase &Obj,
// OK, this is ELF // OK, this is ELF
elf_symbol_iterator SymI(I); elf_symbol_iterator SymI(I);
elf_section_iterator SecI = Obj.section_end(); ErrorOr<elf_section_iterator> SecIOrErr = SymI->getSection();
if (error(SymI->getSection(SecI))) if (error(SecIOrErr.getError()))
return '?'; return '?';
elf_section_iterator SecI = *SecIOrErr;
if (SecI != Obj.section_end()) { if (SecI != Obj.section_end()) {
switch (SecI->getType()) { switch (SecI->getType()) {
case ELF::SHT_PROGBITS: case ELF::SHT_PROGBITS:
@ -651,9 +651,10 @@ static char getSymbolNMTypeChar(COFFObjectFile &Obj, symbol_iterator I) {
uint32_t Characteristics = 0; uint32_t Characteristics = 0;
if (!COFF::isReservedSectionNumber(Symb.getSectionNumber())) { if (!COFF::isReservedSectionNumber(Symb.getSectionNumber())) {
section_iterator SecI = Obj.section_end(); ErrorOr<section_iterator> SecIOrErr = SymI->getSection();
if (error(SymI->getSection(SecI))) if (error(SecIOrErr.getError()))
return '?'; return '?';
section_iterator SecI = *SecIOrErr;
const coff_section *Section = Obj.getCOFFSection(*SecI); const coff_section *Section = Obj.getCOFFSection(*SecI);
Characteristics = Section->Characteristics; Characteristics = Section->Characteristics;
} }
@ -701,8 +702,7 @@ static char getSymbolNMTypeChar(MachOObjectFile &Obj, basic_symbol_iterator I) {
case MachO::N_INDR: case MachO::N_INDR:
return 'i'; return 'i';
case MachO::N_SECT: { case MachO::N_SECT: {
section_iterator Sec = Obj.section_end(); section_iterator Sec = *Obj.getSymbolSection(Symb);
Obj.getSymbolSection(Symb, Sec);
DataRefImpl Ref = Sec->getRawDataRefImpl(); DataRefImpl Ref = Sec->getRawDataRefImpl();
StringRef SectionName; StringRef SectionName;
Obj.getSectionName(Ref, SectionName); Obj.getSectionName(Ref, SectionName);

View File

@ -165,10 +165,10 @@ resolveSectionAndAddress(const COFFObjectFile *Obj, const SymbolRef &Sym,
if (std::error_code EC = ResolvedAddrOrErr.getError()) if (std::error_code EC = ResolvedAddrOrErr.getError())
return EC; return EC;
ResolvedAddr = *ResolvedAddrOrErr; ResolvedAddr = *ResolvedAddrOrErr;
section_iterator iter(Obj->section_begin()); ErrorOr<section_iterator> Iter = Sym.getSection();
if (std::error_code EC = Sym.getSection(iter)) if (std::error_code EC = Iter.getError())
return EC; return EC;
ResolvedSection = Obj->getCOFFSection(*iter); ResolvedSection = Obj->getCOFFSection(**Iter);
return std::error_code(); return std::error_code();
} }

View File

@ -6436,8 +6436,7 @@ static void findUnwindRelocNameAddend(const MachOObjectFile *Obj,
// Go back one so that SymbolAddress <= Addr. // Go back one so that SymbolAddress <= Addr.
--Sym; --Sym;
section_iterator SymSection = Obj->section_end(); section_iterator SymSection = *Sym->second.getSection();
Sym->second.getSection(SymSection);
if (RelocSection == *SymSection) { if (RelocSection == *SymSection) {
// There's a valid symbol in the same section before this reference. // There's a valid symbol in the same section before this reference.
ErrorOr<StringRef> NameOrErr = Sym->second.getName(); ErrorOr<StringRef> NameOrErr = Sym->second.getName();
@ -6780,8 +6779,7 @@ void llvm::printMachOUnwindInfo(const MachOObjectFile *Obj) {
for (const SymbolRef &SymRef : Obj->symbols()) { for (const SymbolRef &SymRef : Obj->symbols()) {
// Discard any undefined or absolute symbols. They're not going to take part // Discard any undefined or absolute symbols. They're not going to take part
// in the convenience lookup for unwind info and just take up resources. // in the convenience lookup for unwind info and just take up resources.
section_iterator Section = Obj->section_end(); section_iterator Section = *SymRef.getSection();
SymRef.getSection(Section);
if (Section == Obj->section_end()) if (Section == Obj->section_end())
continue; continue;

View File

@ -1225,8 +1225,9 @@ void llvm::PrintSymbolTable(const ObjectFile *o) {
uint64_t Address = *AddressOrError; uint64_t Address = *AddressOrError;
SymbolRef::Type Type = Symbol.getType(); SymbolRef::Type Type = Symbol.getType();
uint32_t Flags = Symbol.getFlags(); uint32_t Flags = Symbol.getFlags();
section_iterator Section = o->section_end(); ErrorOr<section_iterator> SectionOrErr = Symbol.getSection();
error(Symbol.getSection(Section)); error(SectionOrErr.getError());
section_iterator Section = *SectionOrErr;
StringRef Name; StringRef Name;
if (Type == SymbolRef::ST_Debug && Section != o->section_end()) { if (Type == SymbolRef::ST_Debug && Section != o->section_end()) {
Section->getName(Name); Section->getName(Name);

View File

@ -630,9 +630,10 @@ bool Decoder::dumpUnpackedEntry(const COFFObjectFile &COFF,
SW.printString("ExceptionRecord", formatSymbol(*Name, Address)); SW.printString("ExceptionRecord", formatSymbol(*Name, Address));
section_iterator SI = COFF.section_end(); ErrorOr<section_iterator> SIOrErr = XDataRecord->getSection();
if (XDataRecord->getSection(SI)) if (!SIOrErr)
return false; return false;
section_iterator SI = *SIOrErr;
return dumpXDataRecord(COFF, *SI, FunctionAddress, Address); return dumpXDataRecord(COFF, *SI, FunctionAddress, Address);
} else { } else {

View File

@ -542,8 +542,9 @@ void MachODumper::printSymbol(const SymbolRef &Symbol) {
getSymbol(Obj, Symbol.getRawDataRefImpl(), MOSymbol); getSymbol(Obj, Symbol.getRawDataRefImpl(), MOSymbol);
StringRef SectionName = ""; StringRef SectionName = "";
section_iterator SecI(Obj->section_begin()); ErrorOr<section_iterator> SecIOrErr = Symbol.getSection();
error(Symbol.getSection(SecI)); error(SecIOrErr.getError());
section_iterator SecI = *SecIOrErr;
if (SecI != Obj->section_end()) if (SecI != Obj->section_end())
error(SecI->getName(SectionName)); error(SecI->getName(SectionName));

View File

@ -149,11 +149,8 @@ static std::error_code resolveRelocation(const Dumper::Context &Ctx,
return EC; return EC;
ResolvedAddress = *ResolvedAddressOrErr; ResolvedAddress = *ResolvedAddressOrErr;
section_iterator SI = Ctx.COFF.section_begin(); ErrorOr<section_iterator> SI = Symbol.getSection();
if (std::error_code EC = Symbol.getSection(SI)) ResolvedSection = Ctx.COFF.getCOFFSection(**SI);
return EC;
ResolvedSection = Ctx.COFF.getCOFFSection(*SI);
return std::error_code(); return std::error_code();
} }

View File

@ -304,8 +304,7 @@ static int printLineInfoForInput(bool LoadObjects, bool UseDebugObj) {
// symbol in memory (rather than that in the unrelocated object file) // symbol in memory (rather than that in the unrelocated object file)
// and use that to query the DWARFContext. // and use that to query the DWARFContext.
if (!UseDebugObj && LoadObjects) { if (!UseDebugObj && LoadObjects) {
object::section_iterator Sec(SymbolObj->section_end()); object::section_iterator Sec = *Sym.getSection();
Sym.getSection(Sec);
StringRef SecName; StringRef SecName;
Sec->getName(SecName); Sec->getName(SecName);
uint64_t SectionLoadAddress = uint64_t SectionLoadAddress =