mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-31 07:43:37 +00:00
Remove bogus std::error_code returns form SectionRef.
There are two methods in SectionRef that can fail: * getName: The index into the string table can be invalid. * getContents: The section might point to invalid contents. Every other method will always succeed and returning and std::error_code just complicates the code. For example, a section can have an invalid alignment, but if we are able to get to the section structure at all and create a SectionRef, we will always be able to read that invalid alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219314 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1a98f792a5
commit
8175be535a
@ -546,24 +546,19 @@ protected:
|
||||
void moveSectionNext(DataRefImpl &Sec) const override;
|
||||
std::error_code getSectionName(DataRefImpl Sec,
|
||||
StringRef &Res) const override;
|
||||
std::error_code getSectionAddress(DataRefImpl Sec,
|
||||
uint64_t &Res) const override;
|
||||
std::error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const override;
|
||||
uint64_t getSectionAddress(DataRefImpl Sec) const override;
|
||||
uint64_t getSectionSize(DataRefImpl Sec) const override;
|
||||
std::error_code getSectionContents(DataRefImpl Sec,
|
||||
StringRef &Res) const override;
|
||||
std::error_code getSectionAlignment(DataRefImpl Sec,
|
||||
uint64_t &Res) const override;
|
||||
std::error_code isSectionText(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionData(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionBSS(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionReadOnlyData(DataRefImpl Sec,
|
||||
bool &Res) const override;
|
||||
std::error_code isSectionRequiredForExecution(DataRefImpl Sec,
|
||||
bool &Res) const override;
|
||||
std::error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,
|
||||
bool &Result) const override;
|
||||
uint64_t getSectionAlignment(DataRefImpl Sec) const override;
|
||||
bool isSectionText(DataRefImpl Sec) const override;
|
||||
bool isSectionData(DataRefImpl Sec) const override;
|
||||
bool isSectionBSS(DataRefImpl Sec) const override;
|
||||
bool isSectionVirtual(DataRefImpl Sec) const override;
|
||||
bool isSectionZeroInit(DataRefImpl Sec) const override;
|
||||
bool isSectionReadOnlyData(DataRefImpl Sec) const override;
|
||||
bool isSectionRequiredForExecution(DataRefImpl Sec) const override;
|
||||
bool sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb) const override;
|
||||
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
|
||||
relocation_iterator section_rel_end(DataRefImpl Sec) const override;
|
||||
|
||||
|
@ -89,24 +89,19 @@ protected:
|
||||
void moveSectionNext(DataRefImpl &Sec) const override;
|
||||
std::error_code getSectionName(DataRefImpl Sec,
|
||||
StringRef &Res) const override;
|
||||
std::error_code getSectionAddress(DataRefImpl Sec,
|
||||
uint64_t &Res) const override;
|
||||
std::error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const override;
|
||||
uint64_t getSectionAddress(DataRefImpl Sec) const override;
|
||||
uint64_t getSectionSize(DataRefImpl Sec) const override;
|
||||
std::error_code getSectionContents(DataRefImpl Sec,
|
||||
StringRef &Res) const override;
|
||||
std::error_code getSectionAlignment(DataRefImpl Sec,
|
||||
uint64_t &Res) const override;
|
||||
std::error_code isSectionText(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionData(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionBSS(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionRequiredForExecution(DataRefImpl Sec,
|
||||
bool &Res) const override;
|
||||
std::error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionReadOnlyData(DataRefImpl Sec,
|
||||
bool &Res) const override;
|
||||
std::error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,
|
||||
bool &Result) const override;
|
||||
uint64_t getSectionAlignment(DataRefImpl Sec) const override;
|
||||
bool isSectionText(DataRefImpl Sec) const override;
|
||||
bool isSectionData(DataRefImpl Sec) const override;
|
||||
bool isSectionBSS(DataRefImpl Sec) const override;
|
||||
bool isSectionRequiredForExecution(DataRefImpl Sec) const override;
|
||||
bool isSectionVirtual(DataRefImpl Sec) const override;
|
||||
bool isSectionZeroInit(DataRefImpl Sec) const override;
|
||||
bool isSectionReadOnlyData(DataRefImpl Sec) const override;
|
||||
bool sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb) const override;
|
||||
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
|
||||
relocation_iterator section_rel_end(DataRefImpl Sec) const override;
|
||||
section_iterator getRelocatedSection(DataRefImpl Sec) const override;
|
||||
@ -413,17 +408,13 @@ std::error_code ELFObjectFile<ELFT>::getSectionName(DataRefImpl Sec,
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::getSectionAddress(DataRefImpl Sec,
|
||||
uint64_t &Result) const {
|
||||
Result = toELFShdrIter(Sec)->sh_addr;
|
||||
return object_error::success;
|
||||
uint64_t ELFObjectFile<ELFT>::getSectionAddress(DataRefImpl Sec) const {
|
||||
return toELFShdrIter(Sec)->sh_addr;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::getSectionSize(DataRefImpl Sec,
|
||||
uint64_t &Result) const {
|
||||
Result = toELFShdrIter(Sec)->sh_size;
|
||||
return object_error::success;
|
||||
uint64_t ELFObjectFile<ELFT>::getSectionSize(DataRefImpl Sec) const {
|
||||
return toELFShdrIter(Sec)->sh_size;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
@ -436,79 +427,59 @@ ELFObjectFile<ELFT>::getSectionContents(DataRefImpl Sec,
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code
|
||||
ELFObjectFile<ELFT>::getSectionAlignment(DataRefImpl Sec,
|
||||
uint64_t &Result) const {
|
||||
Result = toELFShdrIter(Sec)->sh_addralign;
|
||||
return object_error::success;
|
||||
uint64_t ELFObjectFile<ELFT>::getSectionAlignment(DataRefImpl Sec) const {
|
||||
return toELFShdrIter(Sec)->sh_addralign;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::isSectionText(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
Result = toELFShdrIter(Sec)->sh_flags & ELF::SHF_EXECINSTR;
|
||||
return object_error::success;
|
||||
bool ELFObjectFile<ELFT>::isSectionText(DataRefImpl Sec) const {
|
||||
return toELFShdrIter(Sec)->sh_flags & ELF::SHF_EXECINSTR;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::isSectionData(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
bool ELFObjectFile<ELFT>::isSectionData(DataRefImpl Sec) const {
|
||||
Elf_Shdr_Iter EShdr = toELFShdrIter(Sec);
|
||||
Result = EShdr->sh_flags & (ELF::SHF_ALLOC | ELF::SHF_WRITE) &&
|
||||
EShdr->sh_type == ELF::SHT_PROGBITS;
|
||||
return object_error::success;
|
||||
return EShdr->sh_flags & (ELF::SHF_ALLOC | ELF::SHF_WRITE) &&
|
||||
EShdr->sh_type == ELF::SHT_PROGBITS;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::isSectionBSS(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
bool ELFObjectFile<ELFT>::isSectionBSS(DataRefImpl Sec) const {
|
||||
Elf_Shdr_Iter EShdr = toELFShdrIter(Sec);
|
||||
Result = EShdr->sh_flags & (ELF::SHF_ALLOC | ELF::SHF_WRITE) &&
|
||||
EShdr->sh_type == ELF::SHT_NOBITS;
|
||||
return object_error::success;
|
||||
return EShdr->sh_flags & (ELF::SHF_ALLOC | ELF::SHF_WRITE) &&
|
||||
EShdr->sh_type == ELF::SHT_NOBITS;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code
|
||||
ELFObjectFile<ELFT>::isSectionRequiredForExecution(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
Result = toELFShdrIter(Sec)->sh_flags & ELF::SHF_ALLOC;
|
||||
return object_error::success;
|
||||
bool ELFObjectFile<ELFT>::isSectionRequiredForExecution(DataRefImpl Sec) const {
|
||||
return toELFShdrIter(Sec)->sh_flags & ELF::SHF_ALLOC;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::isSectionVirtual(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
Result = toELFShdrIter(Sec)->sh_type == ELF::SHT_NOBITS;
|
||||
return object_error::success;
|
||||
bool ELFObjectFile<ELFT>::isSectionVirtual(DataRefImpl Sec) const {
|
||||
return toELFShdrIter(Sec)->sh_type == ELF::SHT_NOBITS;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::isSectionZeroInit(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
Result = toELFShdrIter(Sec)->sh_type == ELF::SHT_NOBITS;
|
||||
return object_error::success;
|
||||
bool ELFObjectFile<ELFT>::isSectionZeroInit(DataRefImpl Sec) const {
|
||||
return toELFShdrIter(Sec)->sh_type == ELF::SHT_NOBITS;
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::isSectionReadOnlyData(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
bool ELFObjectFile<ELFT>::isSectionReadOnlyData(DataRefImpl Sec) const {
|
||||
Elf_Shdr_Iter EShdr = toELFShdrIter(Sec);
|
||||
Result = !(EShdr->sh_flags & (ELF::SHF_WRITE | ELF::SHF_EXECINSTR));
|
||||
return object_error::success;
|
||||
return !(EShdr->sh_flags & (ELF::SHF_WRITE | ELF::SHF_EXECINSTR));
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::sectionContainsSymbol(DataRefImpl Sec,
|
||||
DataRefImpl Symb,
|
||||
bool &Result) const {
|
||||
bool ELFObjectFile<ELFT>::sectionContainsSymbol(DataRefImpl Sec,
|
||||
DataRefImpl Symb) const {
|
||||
Elf_Sym_Iter ESym = toELFSymIter(Symb);
|
||||
|
||||
uintX_t Index = ESym->st_shndx;
|
||||
bool Reserved = Index >= ELF::SHN_LORESERVE && Index <= ELF::SHN_HIRESERVE;
|
||||
|
||||
Result = !Reserved && (&*toELFShdrIter(Sec) == EF.getSection(ESym->st_shndx));
|
||||
return object_error::success;
|
||||
return !Reserved && (&*toELFShdrIter(Sec) == EF.getSection(ESym->st_shndx));
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
|
@ -215,24 +215,19 @@ public:
|
||||
void moveSectionNext(DataRefImpl &Sec) const override;
|
||||
std::error_code getSectionName(DataRefImpl Sec,
|
||||
StringRef &Res) const override;
|
||||
std::error_code getSectionAddress(DataRefImpl Sec,
|
||||
uint64_t &Res) const override;
|
||||
std::error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const override;
|
||||
uint64_t getSectionAddress(DataRefImpl Sec) const override;
|
||||
uint64_t getSectionSize(DataRefImpl Sec) const override;
|
||||
std::error_code getSectionContents(DataRefImpl Sec,
|
||||
StringRef &Res) const override;
|
||||
std::error_code getSectionAlignment(DataRefImpl Sec,
|
||||
uint64_t &Res) const override;
|
||||
std::error_code isSectionText(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionData(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionBSS(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionRequiredForExecution(DataRefImpl Sec,
|
||||
bool &Res) const override;
|
||||
std::error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const override;
|
||||
std::error_code isSectionReadOnlyData(DataRefImpl Sec,
|
||||
bool &Res) const override;
|
||||
std::error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,
|
||||
bool &Result) const override;
|
||||
uint64_t getSectionAlignment(DataRefImpl Sec) const override;
|
||||
bool isSectionText(DataRefImpl Sec) const override;
|
||||
bool isSectionData(DataRefImpl Sec) const override;
|
||||
bool isSectionBSS(DataRefImpl Sec) const override;
|
||||
bool isSectionRequiredForExecution(DataRefImpl Sec) const override;
|
||||
bool isSectionVirtual(DataRefImpl Sec) const override;
|
||||
bool isSectionZeroInit(DataRefImpl Sec) const override;
|
||||
bool isSectionReadOnlyData(DataRefImpl Sec) const override;
|
||||
bool sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb) const override;
|
||||
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
|
||||
relocation_iterator section_rel_end(DataRefImpl Sec) const override;
|
||||
|
||||
|
@ -95,22 +95,22 @@ public:
|
||||
void moveNext();
|
||||
|
||||
std::error_code getName(StringRef &Result) const;
|
||||
std::error_code getAddress(uint64_t &Result) const;
|
||||
std::error_code getSize(uint64_t &Result) const;
|
||||
uint64_t getAddress() const;
|
||||
uint64_t getSize() const;
|
||||
std::error_code getContents(StringRef &Result) const;
|
||||
|
||||
/// @brief Get the alignment of this section as the actual value (not log 2).
|
||||
std::error_code getAlignment(uint64_t &Result) const;
|
||||
uint64_t getAlignment() const;
|
||||
|
||||
std::error_code isText(bool &Result) const;
|
||||
std::error_code isData(bool &Result) const;
|
||||
std::error_code isBSS(bool &Result) const;
|
||||
std::error_code isRequiredForExecution(bool &Result) const;
|
||||
std::error_code isVirtual(bool &Result) const;
|
||||
std::error_code isZeroInit(bool &Result) const;
|
||||
std::error_code isReadOnlyData(bool &Result) const;
|
||||
bool isText() const;
|
||||
bool isData() const;
|
||||
bool isBSS() const;
|
||||
bool isRequiredForExecution() const;
|
||||
bool isVirtual() const;
|
||||
bool isZeroInit() const;
|
||||
bool isReadOnlyData() const;
|
||||
|
||||
std::error_code containsSymbol(SymbolRef S, bool &Result) const;
|
||||
bool containsSymbol(SymbolRef S) const;
|
||||
|
||||
relocation_iterator relocation_begin() const;
|
||||
relocation_iterator relocation_end() const;
|
||||
@ -225,29 +225,21 @@ protected:
|
||||
virtual void moveSectionNext(DataRefImpl &Sec) const = 0;
|
||||
virtual std::error_code getSectionName(DataRefImpl Sec,
|
||||
StringRef &Res) const = 0;
|
||||
virtual std::error_code getSectionAddress(DataRefImpl Sec,
|
||||
uint64_t &Res) const = 0;
|
||||
virtual std::error_code getSectionSize(DataRefImpl Sec,
|
||||
uint64_t &Res) const = 0;
|
||||
virtual uint64_t getSectionAddress(DataRefImpl Sec) const = 0;
|
||||
virtual uint64_t getSectionSize(DataRefImpl Sec) const = 0;
|
||||
virtual std::error_code getSectionContents(DataRefImpl Sec,
|
||||
StringRef &Res) const = 0;
|
||||
virtual std::error_code getSectionAlignment(DataRefImpl Sec,
|
||||
uint64_t &Res) const = 0;
|
||||
virtual std::error_code isSectionText(DataRefImpl Sec, bool &Res) const = 0;
|
||||
virtual std::error_code isSectionData(DataRefImpl Sec, bool &Res) const = 0;
|
||||
virtual std::error_code isSectionBSS(DataRefImpl Sec, bool &Res) const = 0;
|
||||
virtual std::error_code isSectionRequiredForExecution(DataRefImpl Sec,
|
||||
bool &Res) const = 0;
|
||||
virtual uint64_t getSectionAlignment(DataRefImpl Sec) const = 0;
|
||||
virtual bool isSectionText(DataRefImpl Sec) const = 0;
|
||||
virtual bool isSectionData(DataRefImpl Sec) const = 0;
|
||||
virtual bool isSectionBSS(DataRefImpl Sec) const = 0;
|
||||
virtual bool isSectionRequiredForExecution(DataRefImpl Sec) const = 0;
|
||||
// A section is 'virtual' if its contents aren't present in the object image.
|
||||
virtual std::error_code isSectionVirtual(DataRefImpl Sec,
|
||||
bool &Res) const = 0;
|
||||
virtual std::error_code isSectionZeroInit(DataRefImpl Sec,
|
||||
bool &Res) const = 0;
|
||||
virtual std::error_code isSectionReadOnlyData(DataRefImpl Sec,
|
||||
bool &Res) const = 0;
|
||||
virtual std::error_code sectionContainsSymbol(DataRefImpl Sec,
|
||||
DataRefImpl Symb,
|
||||
bool &Result) const = 0;
|
||||
virtual bool isSectionVirtual(DataRefImpl Sec) const = 0;
|
||||
virtual bool isSectionZeroInit(DataRefImpl Sec) const = 0;
|
||||
virtual bool isSectionReadOnlyData(DataRefImpl Sec) const = 0;
|
||||
virtual bool sectionContainsSymbol(DataRefImpl Sec,
|
||||
DataRefImpl Symb) const = 0;
|
||||
virtual relocation_iterator section_rel_begin(DataRefImpl Sec) const = 0;
|
||||
virtual relocation_iterator section_rel_end(DataRefImpl Sec) const = 0;
|
||||
virtual section_iterator getRelocatedSection(DataRefImpl Sec) const;
|
||||
@ -397,54 +389,53 @@ inline std::error_code SectionRef::getName(StringRef &Result) const {
|
||||
return OwningObject->getSectionName(SectionPimpl, Result);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::getAddress(uint64_t &Result) const {
|
||||
return OwningObject->getSectionAddress(SectionPimpl, Result);
|
||||
inline uint64_t SectionRef::getAddress() const {
|
||||
return OwningObject->getSectionAddress(SectionPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::getSize(uint64_t &Result) const {
|
||||
return OwningObject->getSectionSize(SectionPimpl, Result);
|
||||
inline uint64_t SectionRef::getSize() const {
|
||||
return OwningObject->getSectionSize(SectionPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::getContents(StringRef &Result) const {
|
||||
return OwningObject->getSectionContents(SectionPimpl, Result);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::getAlignment(uint64_t &Result) const {
|
||||
return OwningObject->getSectionAlignment(SectionPimpl, Result);
|
||||
inline uint64_t SectionRef::getAlignment() const {
|
||||
return OwningObject->getSectionAlignment(SectionPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::isText(bool &Result) const {
|
||||
return OwningObject->isSectionText(SectionPimpl, Result);
|
||||
inline bool SectionRef::isText() const {
|
||||
return OwningObject->isSectionText(SectionPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::isData(bool &Result) const {
|
||||
return OwningObject->isSectionData(SectionPimpl, Result);
|
||||
inline bool SectionRef::isData() const {
|
||||
return OwningObject->isSectionData(SectionPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::isBSS(bool &Result) const {
|
||||
return OwningObject->isSectionBSS(SectionPimpl, Result);
|
||||
inline bool SectionRef::isBSS() const {
|
||||
return OwningObject->isSectionBSS(SectionPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::isRequiredForExecution(bool &Result) const {
|
||||
return OwningObject->isSectionRequiredForExecution(SectionPimpl, Result);
|
||||
inline bool SectionRef::isRequiredForExecution() const {
|
||||
return OwningObject->isSectionRequiredForExecution(SectionPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::isVirtual(bool &Result) const {
|
||||
return OwningObject->isSectionVirtual(SectionPimpl, Result);
|
||||
inline bool SectionRef::isVirtual() const {
|
||||
return OwningObject->isSectionVirtual(SectionPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::isZeroInit(bool &Result) const {
|
||||
return OwningObject->isSectionZeroInit(SectionPimpl, Result);
|
||||
inline bool SectionRef::isZeroInit() const {
|
||||
return OwningObject->isSectionZeroInit(SectionPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::isReadOnlyData(bool &Result) const {
|
||||
return OwningObject->isSectionReadOnlyData(SectionPimpl, Result);
|
||||
inline bool SectionRef::isReadOnlyData() const {
|
||||
return OwningObject->isSectionReadOnlyData(SectionPimpl);
|
||||
}
|
||||
|
||||
inline std::error_code SectionRef::containsSymbol(SymbolRef S,
|
||||
bool &Result) const {
|
||||
inline bool SectionRef::containsSymbol(SymbolRef S) const {
|
||||
return OwningObject->sectionContainsSymbol(SectionPimpl,
|
||||
S.getRawDataRefImpl(), Result);
|
||||
S.getRawDataRefImpl());
|
||||
}
|
||||
|
||||
inline relocation_iterator SectionRef::relocation_begin() const {
|
||||
|
@ -516,12 +516,10 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile &Obj)
|
||||
StringRef name;
|
||||
Section.getName(name);
|
||||
// Skip BSS and Virtual sections, they aren't interesting.
|
||||
bool IsBSS;
|
||||
Section.isBSS(IsBSS);
|
||||
bool IsBSS = Section.isBSS();
|
||||
if (IsBSS)
|
||||
continue;
|
||||
bool IsVirtual;
|
||||
Section.isVirtual(IsVirtual);
|
||||
bool IsVirtual = Section.isVirtual();
|
||||
if (IsVirtual)
|
||||
continue;
|
||||
StringRef data;
|
||||
@ -612,8 +610,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile &Obj)
|
||||
}
|
||||
|
||||
if (Section.relocation_begin() != Section.relocation_end()) {
|
||||
uint64_t SectionSize;
|
||||
RelocatedSection->getSize(SectionSize);
|
||||
uint64_t SectionSize = RelocatedSection->getSize();
|
||||
for (const RelocationRef &Reloc : Section.relocations()) {
|
||||
uint64_t Address;
|
||||
Reloc.getOffset(Address);
|
||||
|
@ -134,10 +134,7 @@ static std::error_code getOffset(const SymbolRef &Sym, uint64_t &Result) {
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
uint64_t SectionAddress;
|
||||
if (std::error_code EC = SecI->getAddress(SectionAddress))
|
||||
return EC;
|
||||
|
||||
uint64_t SectionAddress = SecI->getAddress();
|
||||
Result = Address - SectionAddress;
|
||||
return object_error::success;
|
||||
}
|
||||
@ -199,14 +196,13 @@ RuntimeDyldImpl::loadObject(std::unique_ptr<ObjectImage> Obj) {
|
||||
SymType == object::SymbolRef::ST_Unknown) {
|
||||
uint64_t SectOffset;
|
||||
StringRef SectionData;
|
||||
bool IsCode;
|
||||
section_iterator SI = Obj->end_sections();
|
||||
Check(getOffset(*I, SectOffset));
|
||||
Check(I->getSection(SI));
|
||||
if (SI == Obj->end_sections())
|
||||
continue;
|
||||
Check(SI->getContents(SectionData));
|
||||
Check(SI->isText(IsCode));
|
||||
bool IsCode = SI->isText();
|
||||
unsigned SectionID =
|
||||
findOrEmitSection(*Obj, *SI, IsCode, LocalSections);
|
||||
LocalSymbols[Name.data()] = SymbolLoc(SectionID, SectOffset);
|
||||
@ -236,8 +232,7 @@ RuntimeDyldImpl::loadObject(std::unique_ptr<ObjectImage> Obj) {
|
||||
if (I == E && !ProcessAllSections)
|
||||
continue;
|
||||
|
||||
bool IsCode = false;
|
||||
Check(RelocatedSection->isText(IsCode));
|
||||
bool IsCode = RelocatedSection->isText();
|
||||
SectionID =
|
||||
findOrEmitSection(*Obj, *RelocatedSection, IsCode, LocalSections);
|
||||
DEBUG(dbgs() << "\tSectionID: " << SectionID << "\n");
|
||||
@ -291,20 +286,15 @@ void RuntimeDyldImpl::computeTotalAllocSize(ObjectImage &Obj,
|
||||
SI != SE; ++SI) {
|
||||
const SectionRef &Section = *SI;
|
||||
|
||||
bool IsRequired;
|
||||
Check(Section.isRequiredForExecution(IsRequired));
|
||||
bool IsRequired = Section.isRequiredForExecution();
|
||||
|
||||
// Consider only the sections that are required to be loaded for execution
|
||||
if (IsRequired) {
|
||||
uint64_t DataSize = 0;
|
||||
uint64_t Alignment64 = 0;
|
||||
bool IsCode = false;
|
||||
bool IsReadOnly = false;
|
||||
StringRef Name;
|
||||
Check(Section.getSize(DataSize));
|
||||
Check(Section.getAlignment(Alignment64));
|
||||
Check(Section.isText(IsCode));
|
||||
Check(Section.isReadOnlyData(IsReadOnly));
|
||||
uint64_t DataSize = Section.getSize();
|
||||
uint64_t Alignment64 = Section.getAlignment();
|
||||
bool IsCode = Section.isText();
|
||||
bool IsReadOnly = Section.isReadOnlyData();
|
||||
Check(Section.getName(Name));
|
||||
unsigned Alignment = (unsigned)Alignment64 & 0xffffffffL;
|
||||
|
||||
@ -386,10 +376,8 @@ unsigned RuntimeDyldImpl::computeSectionStubBufSize(ObjectImage &Obj,
|
||||
}
|
||||
|
||||
// Get section data size and alignment
|
||||
uint64_t Alignment64;
|
||||
uint64_t DataSize;
|
||||
Check(Section.getSize(DataSize));
|
||||
Check(Section.getAlignment(Alignment64));
|
||||
uint64_t DataSize = Section.getSize();
|
||||
uint64_t Alignment64 = Section.getAlignment();
|
||||
|
||||
// Add stubbuf size alignment
|
||||
unsigned Alignment = (unsigned)Alignment64 & 0xffffffffL;
|
||||
@ -473,24 +461,18 @@ unsigned RuntimeDyldImpl::emitSection(ObjectImage &Obj,
|
||||
const SectionRef &Section, bool IsCode) {
|
||||
|
||||
StringRef data;
|
||||
uint64_t Alignment64;
|
||||
Check(Section.getContents(data));
|
||||
Check(Section.getAlignment(Alignment64));
|
||||
uint64_t Alignment64 = Section.getAlignment();
|
||||
|
||||
unsigned Alignment = (unsigned)Alignment64 & 0xffffffffL;
|
||||
bool IsRequired;
|
||||
bool IsVirtual;
|
||||
bool IsZeroInit;
|
||||
bool IsReadOnly;
|
||||
uint64_t DataSize;
|
||||
unsigned PaddingSize = 0;
|
||||
unsigned StubBufSize = 0;
|
||||
StringRef Name;
|
||||
Check(Section.isRequiredForExecution(IsRequired));
|
||||
Check(Section.isVirtual(IsVirtual));
|
||||
Check(Section.isZeroInit(IsZeroInit));
|
||||
Check(Section.isReadOnlyData(IsReadOnly));
|
||||
Check(Section.getSize(DataSize));
|
||||
bool IsRequired = Section.isRequiredForExecution();
|
||||
bool IsVirtual = Section.isVirtual();
|
||||
bool IsZeroInit = Section.isZeroInit();
|
||||
bool IsReadOnly = Section.isReadOnlyData();
|
||||
uint64_t DataSize = Section.getSize();
|
||||
Check(Section.getName(Name));
|
||||
|
||||
StubBufSize = computeSectionStubBufSize(Obj, Section);
|
||||
|
@ -702,8 +702,7 @@ void RuntimeDyldELF::findOPDEntrySection(ObjectImage &Obj,
|
||||
|
||||
section_iterator tsi(Obj.end_sections());
|
||||
check(TargetSymbol->getSection(tsi));
|
||||
bool IsCode = false;
|
||||
tsi->isText(IsCode);
|
||||
bool IsCode = tsi->isText();
|
||||
Rel.SectionID = findOrEmitSection(Obj, (*tsi), IsCode, LocalSections);
|
||||
Rel.Addend = (intptr_t)Addend;
|
||||
return;
|
||||
@ -983,9 +982,7 @@ relocation_iterator RuntimeDyldELF::processRelocationRef(
|
||||
if (si == Obj.end_sections())
|
||||
llvm_unreachable("Symbol section not found, bad object file format!");
|
||||
DEBUG(dbgs() << "\t\tThis is section symbol\n");
|
||||
// Default to 'true' in case isText fails (though it never does).
|
||||
bool isCode = true;
|
||||
si->isText(isCode);
|
||||
bool isCode = si->isText();
|
||||
Value.SectionID = findOrEmitSection(Obj, (*si), isCode, ObjSectionToID);
|
||||
Value.Addend = Addend;
|
||||
break;
|
||||
|
@ -66,11 +66,9 @@ RelocationValueRef RuntimeDyldMachO::getRelocationValueRef(
|
||||
}
|
||||
} else {
|
||||
SectionRef Sec = Obj.getRelocationSection(RelInfo);
|
||||
bool IsCode = false;
|
||||
Sec.isText(IsCode);
|
||||
bool IsCode = Sec.isText();
|
||||
Value.SectionID = findOrEmitSection(ObjImg, Sec, IsCode, ObjSectionToID);
|
||||
uint64_t Addr;
|
||||
Sec.getAddress(Addr);
|
||||
uint64_t Addr = Sec.getAddress();
|
||||
Value.Offset = RE.Addend - Addr;
|
||||
}
|
||||
|
||||
@ -115,9 +113,8 @@ RuntimeDyldMachO::getSectionByAddress(const MachOObjectFile &Obj,
|
||||
section_iterator SE = Obj.section_end();
|
||||
|
||||
for (; SI != SE; ++SI) {
|
||||
uint64_t SAddr, SSize;
|
||||
SI->getAddress(SAddr);
|
||||
SI->getSize(SSize);
|
||||
uint64_t SAddr = SI->getAddress();
|
||||
uint64_t SSize = SI->getSize();
|
||||
if ((Addr >= SAddr) && (Addr < SAddr + SSize))
|
||||
return SI;
|
||||
}
|
||||
|
@ -232,20 +232,17 @@ private:
|
||||
uint32_t AddrA = MachO->getScatteredRelocationValue(RE);
|
||||
section_iterator SAI = getSectionByAddress(*MachO, AddrA);
|
||||
assert(SAI != MachO->section_end() && "Can't find section for address A");
|
||||
uint64_t SectionABase;
|
||||
SAI->getAddress(SectionABase);
|
||||
uint64_t SectionABase = SAI->getAddress();
|
||||
uint64_t SectionAOffset = AddrA - SectionABase;
|
||||
SectionRef SectionA = *SAI;
|
||||
bool IsCode;
|
||||
SectionA.isText(IsCode);
|
||||
bool IsCode = SectionA.isText();
|
||||
uint32_t SectionAID =
|
||||
findOrEmitSection(Obj, SectionA, IsCode, ObjSectionToID);
|
||||
|
||||
uint32_t AddrB = MachO->getScatteredRelocationValue(RE2);
|
||||
section_iterator SBI = getSectionByAddress(*MachO, AddrB);
|
||||
assert(SBI != MachO->section_end() && "Can't find section for address B");
|
||||
uint64_t SectionBBase;
|
||||
SBI->getAddress(SectionBBase);
|
||||
uint64_t SectionBBase = SBI->getAddress();
|
||||
uint64_t SectionBOffset = AddrB - SectionBBase;
|
||||
SectionRef SectionB = *SBI;
|
||||
uint32_t SectionBID =
|
||||
|
@ -152,20 +152,17 @@ private:
|
||||
uint32_t AddrA = MachO->getScatteredRelocationValue(RE);
|
||||
section_iterator SAI = getSectionByAddress(*MachO, AddrA);
|
||||
assert(SAI != MachO->section_end() && "Can't find section for address A");
|
||||
uint64_t SectionABase;
|
||||
SAI->getAddress(SectionABase);
|
||||
uint64_t SectionABase = SAI->getAddress();
|
||||
uint64_t SectionAOffset = AddrA - SectionABase;
|
||||
SectionRef SectionA = *SAI;
|
||||
bool IsCode;
|
||||
SectionA.isText(IsCode);
|
||||
bool IsCode = SectionA.isText();
|
||||
uint32_t SectionAID =
|
||||
findOrEmitSection(Obj, SectionA, IsCode, ObjSectionToID);
|
||||
|
||||
uint32_t AddrB = MachO->getScatteredRelocationValue(RE2);
|
||||
section_iterator SBI = getSectionByAddress(*MachO, AddrB);
|
||||
assert(SBI != MachO->section_end() && "Can't find section for address B");
|
||||
uint64_t SectionBBase;
|
||||
SBI->getAddress(SectionBBase);
|
||||
uint64_t SectionBBase = SBI->getAddress();
|
||||
uint64_t SectionBOffset = AddrB - SectionBBase;
|
||||
SectionRef SectionB = *SBI;
|
||||
uint32_t SectionBID =
|
||||
@ -211,11 +208,9 @@ private:
|
||||
unsigned SymbolBaseAddr = MachO->getScatteredRelocationValue(RE);
|
||||
section_iterator TargetSI = getSectionByAddress(*MachO, SymbolBaseAddr);
|
||||
assert(TargetSI != MachO->section_end() && "Can't find section for symbol");
|
||||
uint64_t SectionBaseAddr;
|
||||
TargetSI->getAddress(SectionBaseAddr);
|
||||
uint64_t SectionBaseAddr = TargetSI->getAddress();
|
||||
SectionRef TargetSection = *TargetSI;
|
||||
bool IsCode;
|
||||
TargetSection.isText(IsCode);
|
||||
bool IsCode = TargetSection.isText();
|
||||
uint32_t TargetSectionID =
|
||||
findOrEmitSection(Obj, TargetSection, IsCode, ObjSectionToID);
|
||||
|
||||
|
@ -260,18 +260,14 @@ std::error_code COFFObjectFile::getSectionName(DataRefImpl Ref,
|
||||
return getSectionName(Sec, Result);
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::getSectionAddress(DataRefImpl Ref,
|
||||
uint64_t &Result) const {
|
||||
uint64_t COFFObjectFile::getSectionAddress(DataRefImpl Ref) const {
|
||||
const coff_section *Sec = toSec(Ref);
|
||||
Result = Sec->VirtualAddress;
|
||||
return object_error::success;
|
||||
return Sec->VirtualAddress;
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::getSectionSize(DataRefImpl Ref,
|
||||
uint64_t &Result) const {
|
||||
uint64_t COFFObjectFile::getSectionSize(DataRefImpl Ref) const {
|
||||
const coff_section *Sec = toSec(Ref);
|
||||
Result = Sec->SizeOfRawData;
|
||||
return object_error::success;
|
||||
return Sec->SizeOfRawData;
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::getSectionContents(DataRefImpl Ref,
|
||||
@ -283,71 +279,52 @@ std::error_code COFFObjectFile::getSectionContents(DataRefImpl Ref,
|
||||
return EC;
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::getSectionAlignment(DataRefImpl Ref,
|
||||
uint64_t &Res) const {
|
||||
uint64_t COFFObjectFile::getSectionAlignment(DataRefImpl Ref) const {
|
||||
const coff_section *Sec = toSec(Ref);
|
||||
Res = uint64_t(1) << (((Sec->Characteristics & 0x00F00000) >> 20) - 1);
|
||||
return object_error::success;
|
||||
return uint64_t(1) << (((Sec->Characteristics & 0x00F00000) >> 20) - 1);
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::isSectionText(DataRefImpl Ref,
|
||||
bool &Result) const {
|
||||
bool COFFObjectFile::isSectionText(DataRefImpl Ref) const {
|
||||
const coff_section *Sec = toSec(Ref);
|
||||
Result = Sec->Characteristics & COFF::IMAGE_SCN_CNT_CODE;
|
||||
return object_error::success;
|
||||
return Sec->Characteristics & COFF::IMAGE_SCN_CNT_CODE;
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::isSectionData(DataRefImpl Ref,
|
||||
bool &Result) const {
|
||||
bool COFFObjectFile::isSectionData(DataRefImpl Ref) const {
|
||||
const coff_section *Sec = toSec(Ref);
|
||||
Result = Sec->Characteristics & COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;
|
||||
return object_error::success;
|
||||
return Sec->Characteristics & COFF::IMAGE_SCN_CNT_INITIALIZED_DATA;
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::isSectionBSS(DataRefImpl Ref,
|
||||
bool &Result) const {
|
||||
bool COFFObjectFile::isSectionBSS(DataRefImpl Ref) const {
|
||||
const coff_section *Sec = toSec(Ref);
|
||||
Result = Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;
|
||||
return object_error::success;
|
||||
return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;
|
||||
}
|
||||
|
||||
std::error_code
|
||||
COFFObjectFile::isSectionRequiredForExecution(DataRefImpl Ref,
|
||||
bool &Result) const {
|
||||
bool COFFObjectFile::isSectionRequiredForExecution(DataRefImpl Ref) const {
|
||||
// FIXME: Unimplemented
|
||||
Result = true;
|
||||
return object_error::success;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::isSectionVirtual(DataRefImpl Ref,
|
||||
bool &Result) const {
|
||||
bool COFFObjectFile::isSectionVirtual(DataRefImpl Ref) const {
|
||||
const coff_section *Sec = toSec(Ref);
|
||||
Result = Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;
|
||||
return object_error::success;
|
||||
return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA;
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::isSectionZeroInit(DataRefImpl Ref,
|
||||
bool &Result) const {
|
||||
bool COFFObjectFile::isSectionZeroInit(DataRefImpl Ref) const {
|
||||
// FIXME: Unimplemented.
|
||||
Result = false;
|
||||
return object_error::success;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::isSectionReadOnlyData(DataRefImpl Ref,
|
||||
bool &Result) const {
|
||||
bool COFFObjectFile::isSectionReadOnlyData(DataRefImpl Ref) const {
|
||||
// FIXME: Unimplemented.
|
||||
Result = false;
|
||||
return object_error::success;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::sectionContainsSymbol(DataRefImpl SecRef,
|
||||
DataRefImpl SymbRef,
|
||||
bool &Result) const {
|
||||
bool COFFObjectFile::sectionContainsSymbol(DataRefImpl SecRef,
|
||||
DataRefImpl SymbRef) const {
|
||||
const coff_section *Sec = toSec(SecRef);
|
||||
COFFSymbolRef Symb = getCOFFSymbol(SymbRef);
|
||||
int32_t SecNumber = (Sec - SectionTable) + 1;
|
||||
Result = SecNumber == Symb.getSectionNumber();
|
||||
return object_error::success;
|
||||
return SecNumber == Symb.getSectionNumber();
|
||||
}
|
||||
|
||||
relocation_iterator COFFObjectFile::section_rel_begin(DataRefImpl Ref) const {
|
||||
|
@ -144,11 +144,9 @@ static void printRelocationTargetName(const MachOObjectFile *O,
|
||||
// to find a section beginning instead.
|
||||
for (const SectionRef &Section : O->sections()) {
|
||||
std::error_code ec;
|
||||
uint64_t Addr;
|
||||
StringRef Name;
|
||||
|
||||
if ((ec = Section.getAddress(Addr)))
|
||||
report_fatal_error(ec.message());
|
||||
StringRef Name;
|
||||
uint64_t Addr = Section.getAddress();
|
||||
if (Addr != Val)
|
||||
continue;
|
||||
if ((ec = Section.getName(Name)))
|
||||
@ -394,11 +392,10 @@ std::error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI,
|
||||
EndOffset = Value;
|
||||
}
|
||||
if (!EndOffset) {
|
||||
uint64_t Size;
|
||||
DataRefImpl Sec;
|
||||
Sec.d.a = SectionIndex-1;
|
||||
getSectionSize(Sec, Size);
|
||||
getSectionAddress(Sec, EndOffset);
|
||||
uint64_t Size = getSectionSize(Sec);
|
||||
EndOffset = getSectionAddress(Sec);
|
||||
EndOffset += Size;
|
||||
}
|
||||
Result = EndOffset - BeginOffset;
|
||||
@ -495,29 +492,16 @@ std::error_code MachOObjectFile::getSectionName(DataRefImpl Sec,
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::getSectionAddress(DataRefImpl Sec,
|
||||
uint64_t &Res) const {
|
||||
if (is64Bit()) {
|
||||
MachO::section_64 Sect = getSection64(Sec);
|
||||
Res = Sect.addr;
|
||||
} else {
|
||||
MachO::section Sect = getSection(Sec);
|
||||
Res = Sect.addr;
|
||||
}
|
||||
return object_error::success;
|
||||
uint64_t MachOObjectFile::getSectionAddress(DataRefImpl Sec) const {
|
||||
if (is64Bit())
|
||||
return getSection64(Sec).addr;
|
||||
return getSection(Sec).addr;
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::getSectionSize(DataRefImpl Sec,
|
||||
uint64_t &Res) const {
|
||||
if (is64Bit()) {
|
||||
MachO::section_64 Sect = getSection64(Sec);
|
||||
Res = Sect.size;
|
||||
} else {
|
||||
MachO::section Sect = getSection(Sec);
|
||||
Res = Sect.size;
|
||||
}
|
||||
|
||||
return object_error::success;
|
||||
uint64_t MachOObjectFile::getSectionSize(DataRefImpl Sec) const {
|
||||
if (is64Bit())
|
||||
return getSection64(Sec).size;
|
||||
return getSection(Sec).size;
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::getSectionContents(DataRefImpl Sec,
|
||||
@ -539,8 +523,7 @@ std::error_code MachOObjectFile::getSectionContents(DataRefImpl Sec,
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::getSectionAlignment(DataRefImpl Sec,
|
||||
uint64_t &Res) const {
|
||||
uint64_t MachOObjectFile::getSectionAlignment(DataRefImpl Sec) const {
|
||||
uint32_t Align;
|
||||
if (is64Bit()) {
|
||||
MachO::section_64 Sect = getSection64(Sec);
|
||||
@ -550,92 +533,70 @@ std::error_code MachOObjectFile::getSectionAlignment(DataRefImpl Sec,
|
||||
Align = Sect.align;
|
||||
}
|
||||
|
||||
Res = uint64_t(1) << Align;
|
||||
return object_error::success;
|
||||
return uint64_t(1) << Align;
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::isSectionText(DataRefImpl Sec,
|
||||
bool &Res) const {
|
||||
bool MachOObjectFile::isSectionText(DataRefImpl Sec) const {
|
||||
uint32_t Flags = getSectionFlags(this, Sec);
|
||||
Res = Flags & MachO::S_ATTR_PURE_INSTRUCTIONS;
|
||||
return object_error::success;
|
||||
return Flags & MachO::S_ATTR_PURE_INSTRUCTIONS;
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::isSectionData(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
bool MachOObjectFile::isSectionData(DataRefImpl Sec) const {
|
||||
uint32_t Flags = getSectionFlags(this, Sec);
|
||||
unsigned SectionType = Flags & MachO::SECTION_TYPE;
|
||||
Result = !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) &&
|
||||
!(SectionType == MachO::S_ZEROFILL ||
|
||||
SectionType == MachO::S_GB_ZEROFILL);
|
||||
return object_error::success;
|
||||
return !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) &&
|
||||
!(SectionType == MachO::S_ZEROFILL ||
|
||||
SectionType == MachO::S_GB_ZEROFILL);
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::isSectionBSS(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
bool MachOObjectFile::isSectionBSS(DataRefImpl Sec) const {
|
||||
uint32_t Flags = getSectionFlags(this, Sec);
|
||||
unsigned SectionType = Flags & MachO::SECTION_TYPE;
|
||||
Result = !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) &&
|
||||
(SectionType == MachO::S_ZEROFILL ||
|
||||
SectionType == MachO::S_GB_ZEROFILL);
|
||||
return object_error::success;
|
||||
return !(Flags & MachO::S_ATTR_PURE_INSTRUCTIONS) &&
|
||||
(SectionType == MachO::S_ZEROFILL ||
|
||||
SectionType == MachO::S_GB_ZEROFILL);
|
||||
}
|
||||
|
||||
std::error_code
|
||||
MachOObjectFile::isSectionRequiredForExecution(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
bool MachOObjectFile::isSectionRequiredForExecution(DataRefImpl Sect) const {
|
||||
// FIXME: Unimplemented.
|
||||
Result = true;
|
||||
return object_error::success;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::isSectionVirtual(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
bool MachOObjectFile::isSectionVirtual(DataRefImpl Sec) const {
|
||||
// FIXME: Unimplemented.
|
||||
Result = false;
|
||||
return object_error::success;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::isSectionZeroInit(DataRefImpl Sec,
|
||||
bool &Res) const {
|
||||
bool MachOObjectFile::isSectionZeroInit(DataRefImpl Sec) const {
|
||||
uint32_t Flags = getSectionFlags(this, Sec);
|
||||
unsigned SectionType = Flags & MachO::SECTION_TYPE;
|
||||
Res = SectionType == MachO::S_ZEROFILL ||
|
||||
SectionType == MachO::S_GB_ZEROFILL;
|
||||
return object_error::success;
|
||||
return SectionType == MachO::S_ZEROFILL ||
|
||||
SectionType == MachO::S_GB_ZEROFILL;
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::isSectionReadOnlyData(DataRefImpl Sec,
|
||||
bool &Result) const {
|
||||
bool MachOObjectFile::isSectionReadOnlyData(DataRefImpl Sec) const {
|
||||
// Consider using the code from isSectionText to look for __const sections.
|
||||
// Alternately, emit S_ATTR_PURE_INSTRUCTIONS and/or S_ATTR_SOME_INSTRUCTIONS
|
||||
// to use section attributes to distinguish code from data.
|
||||
|
||||
// FIXME: Unimplemented.
|
||||
Result = false;
|
||||
return object_error::success;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::error_code MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec,
|
||||
DataRefImpl Symb,
|
||||
bool &Result) const {
|
||||
bool MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec,
|
||||
DataRefImpl Symb) const {
|
||||
SymbolRef::Type ST;
|
||||
this->getSymbolType(Symb, ST);
|
||||
if (ST == SymbolRef::ST_Unknown) {
|
||||
Result = false;
|
||||
return object_error::success;
|
||||
}
|
||||
if (ST == SymbolRef::ST_Unknown)
|
||||
return false;
|
||||
|
||||
uint64_t SectBegin, SectEnd;
|
||||
getSectionAddress(Sec, SectBegin);
|
||||
getSectionSize(Sec, SectEnd);
|
||||
uint64_t SectBegin = getSectionAddress(Sec);
|
||||
uint64_t SectEnd = getSectionSize(Sec);
|
||||
SectEnd += SectBegin;
|
||||
|
||||
uint64_t SymAddr;
|
||||
getSymbolAddress(Symb, SymAddr);
|
||||
Result = (SymAddr >= SectBegin) && (SymAddr < SectEnd);
|
||||
|
||||
return object_error::success;
|
||||
return (SymAddr >= SectBegin) && (SymAddr < SectEnd);
|
||||
}
|
||||
|
||||
relocation_iterator MachOObjectFile::section_rel_begin(DataRefImpl Sec) const {
|
||||
@ -673,8 +634,7 @@ std::error_code MachOObjectFile::getRelocationAddress(DataRefImpl Rel,
|
||||
|
||||
DataRefImpl Sec;
|
||||
Sec.d.a = Rel.d.a;
|
||||
uint64_t SecAddress;
|
||||
getSectionAddress(Sec, SecAddress);
|
||||
uint64_t SecAddress = getSectionAddress(Sec);
|
||||
Res = SecAddress + Offset;
|
||||
return object_error::success;
|
||||
}
|
||||
|
@ -132,10 +132,7 @@ const char *LLVMGetSectionName(LLVMSectionIteratorRef SI) {
|
||||
}
|
||||
|
||||
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI) {
|
||||
uint64_t ret;
|
||||
if (std::error_code ec = (*unwrap(SI))->getSize(ret))
|
||||
report_fatal_error(ec.message());
|
||||
return ret;
|
||||
return (*unwrap(SI))->getSize();
|
||||
}
|
||||
|
||||
const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) {
|
||||
@ -146,18 +143,12 @@ const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) {
|
||||
}
|
||||
|
||||
uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI) {
|
||||
uint64_t ret;
|
||||
if (std::error_code ec = (*unwrap(SI))->getAddress(ret))
|
||||
report_fatal_error(ec.message());
|
||||
return ret;
|
||||
return (*unwrap(SI))->getAddress();
|
||||
}
|
||||
|
||||
LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI,
|
||||
LLVMSymbolIteratorRef Sym) {
|
||||
bool ret;
|
||||
if (std::error_code ec = (*unwrap(SI))->containsSymbol(**unwrap(Sym), ret))
|
||||
report_fatal_error(ec.message());
|
||||
return ret;
|
||||
return (*unwrap(SI))->containsSymbol(**unwrap(Sym));
|
||||
}
|
||||
|
||||
// Section Relocation iterators
|
||||
|
@ -333,7 +333,8 @@ struct SectionData {
|
||||
std::error_code load(SectionRef &Section) {
|
||||
if (auto Err = Section.getContents(Data))
|
||||
return Err;
|
||||
return Section.getAddress(Address);
|
||||
Address = Section.getAddress();
|
||||
return instrprof_error::success;
|
||||
}
|
||||
|
||||
std::error_code get(uint64_t Pointer, size_t Size, StringRef &Result) {
|
||||
|
@ -67,11 +67,10 @@ int convert_for_testing_main(int argc, const char **argv) {
|
||||
return 1;
|
||||
|
||||
// Get the contents of the given sections.
|
||||
uint64_t ProfileNamesAddress = ProfileNames.getAddress();
|
||||
StringRef CoverageMappingData;
|
||||
uint64_t ProfileNamesAddress;
|
||||
StringRef ProfileNamesData;
|
||||
if (CoverageMapping.getContents(CoverageMappingData) ||
|
||||
ProfileNames.getAddress(ProfileNamesAddress) ||
|
||||
ProfileNames.getContents(ProfileNamesData))
|
||||
return 1;
|
||||
|
||||
|
@ -283,8 +283,7 @@ int SymbolizerGetOpInfo(void *DisInfo, uint64_t Pc, uint64_t Offset,
|
||||
return 0;
|
||||
// First search the section's relocation entries (if any) for an entry
|
||||
// for this section offset.
|
||||
uint64_t sect_addr;
|
||||
info->S.getAddress(sect_addr);
|
||||
uint64_t sect_addr = info->S.getAddress();
|
||||
uint64_t sect_offset = (Pc + Offset) - sect_addr;
|
||||
bool reloc_found = false;
|
||||
DataRefImpl Rel;
|
||||
@ -522,8 +521,7 @@ const char *GuessLiteralPointer(uint64_t ReferenceValue, uint64_t ReferencePC,
|
||||
return nullptr;
|
||||
|
||||
// First see if there is an external relocation entry at the ReferencePC.
|
||||
uint64_t sect_addr;
|
||||
info->S.getAddress(sect_addr);
|
||||
uint64_t sect_addr = info->S.getAddress();
|
||||
uint64_t sect_offset = ReferencePC - sect_addr;
|
||||
bool reloc_found = false;
|
||||
DataRefImpl Rel;
|
||||
@ -820,7 +818,7 @@ static void DisassembleInputMachO2(StringRef Filename,
|
||||
// Build a data in code table that is sorted on by the address of each entry.
|
||||
uint64_t BaseAddress = 0;
|
||||
if (Header.filetype == MachO::MH_OBJECT)
|
||||
Sections[0].getAddress(BaseAddress);
|
||||
BaseAddress = Sections[0].getAddress();
|
||||
else
|
||||
BaseAddress = BaseSegmentAddress;
|
||||
DiceTable Dices;
|
||||
@ -863,8 +861,7 @@ static void DisassembleInputMachO2(StringRef Filename,
|
||||
|
||||
for (unsigned SectIdx = 0; SectIdx != Sections.size(); SectIdx++) {
|
||||
|
||||
bool SectIsText = false;
|
||||
Sections[SectIdx].isText(SectIsText);
|
||||
bool SectIsText = Sections[SectIdx].isText();
|
||||
if (SectIsText == false)
|
||||
continue;
|
||||
|
||||
@ -881,8 +878,7 @@ static void DisassembleInputMachO2(StringRef Filename,
|
||||
|
||||
StringRef Bytes;
|
||||
Sections[SectIdx].getContents(Bytes);
|
||||
uint64_t SectAddress = 0;
|
||||
Sections[SectIdx].getAddress(SectAddress);
|
||||
uint64_t SectAddress = Sections[SectIdx].getAddress();
|
||||
DisasmMemoryObject MemoryObject((const uint8_t *)Bytes.data(), Bytes.size(),
|
||||
SectAddress);
|
||||
bool symbolTableWorked = false;
|
||||
@ -890,9 +886,9 @@ static void DisassembleInputMachO2(StringRef Filename,
|
||||
// Parse relocations.
|
||||
std::vector<std::pair<uint64_t, SymbolRef>> Relocs;
|
||||
for (const RelocationRef &Reloc : Sections[SectIdx].relocations()) {
|
||||
uint64_t RelocOffset, SectionAddress;
|
||||
uint64_t RelocOffset;
|
||||
Reloc.getOffset(RelocOffset);
|
||||
Sections[SectIdx].getAddress(SectionAddress);
|
||||
uint64_t SectionAddress = Sections[SectIdx].getAddress();
|
||||
RelocOffset -= SectionAddress;
|
||||
|
||||
symbol_iterator RelocSym = Reloc.getSymbol();
|
||||
@ -933,15 +929,13 @@ static void DisassembleInputMachO2(StringRef Filename,
|
||||
continue;
|
||||
|
||||
// Make sure the symbol is defined in this section.
|
||||
bool containsSym = false;
|
||||
Sections[SectIdx].containsSymbol(Symbols[SymIdx], containsSym);
|
||||
bool containsSym = Sections[SectIdx].containsSymbol(Symbols[SymIdx]);
|
||||
if (!containsSym)
|
||||
continue;
|
||||
|
||||
// Start at the address of the symbol relative to the section's address.
|
||||
uint64_t SectionAddress = 0;
|
||||
uint64_t Start = 0;
|
||||
Sections[SectIdx].getAddress(SectionAddress);
|
||||
uint64_t SectionAddress = Sections[SectIdx].getAddress();
|
||||
Symbols[SymIdx].getAddress(Start);
|
||||
Start -= SectionAddress;
|
||||
|
||||
@ -954,8 +948,8 @@ static void DisassembleInputMachO2(StringRef Filename,
|
||||
SymbolRef::Type NextSymType;
|
||||
Symbols[NextSymIdx].getType(NextSymType);
|
||||
if (NextSymType == SymbolRef::ST_Function) {
|
||||
Sections[SectIdx].containsSymbol(Symbols[NextSymIdx],
|
||||
containsNextSym);
|
||||
containsNextSym =
|
||||
Sections[SectIdx].containsSymbol(Symbols[NextSymIdx]);
|
||||
Symbols[NextSymIdx].getAddress(NextSym);
|
||||
NextSym -= SectionAddress;
|
||||
break;
|
||||
@ -963,8 +957,7 @@ static void DisassembleInputMachO2(StringRef Filename,
|
||||
++NextSymIdx;
|
||||
}
|
||||
|
||||
uint64_t SectSize;
|
||||
Sections[SectIdx].getSize(SectSize);
|
||||
uint64_t SectSize = Sections[SectIdx].getSize();
|
||||
uint64_t End = containsNextSym ? NextSym : SectSize;
|
||||
uint64_t Size;
|
||||
|
||||
@ -1050,11 +1043,9 @@ static void DisassembleInputMachO2(StringRef Filename,
|
||||
}
|
||||
}
|
||||
if (!symbolTableWorked) {
|
||||
// Reading the symbol table didn't work, disassemble the whole section.
|
||||
uint64_t SectAddress;
|
||||
Sections[SectIdx].getAddress(SectAddress);
|
||||
uint64_t SectSize;
|
||||
Sections[SectIdx].getSize(SectSize);
|
||||
// Reading the symbol table didn't work, disassemble the whole section.
|
||||
uint64_t SectAddress = Sections[SectIdx].getAddress();
|
||||
uint64_t SectSize = Sections[SectIdx].getSize();
|
||||
uint64_t InstSize;
|
||||
for (uint64_t Index = 0; Index < SectSize; Index += InstSize) {
|
||||
MCInst Inst;
|
||||
@ -1159,8 +1150,7 @@ static void findUnwindRelocNameAddend(const MachOObjectFile *Obj,
|
||||
auto RE = Obj->getRelocation(Reloc.getRawDataRefImpl());
|
||||
SectionRef RelocSection = Obj->getRelocationSection(RE);
|
||||
|
||||
uint64_t SectionAddr;
|
||||
RelocSection.getAddress(SectionAddr);
|
||||
uint64_t SectionAddr = RelocSection.getAddress();
|
||||
|
||||
auto Sym = Symbols.upper_bound(Addr);
|
||||
if (Sym == Symbols.begin()) {
|
||||
@ -2731,10 +2721,8 @@ SegInfo::SegInfo(const object::MachOObjectFile *Obj) {
|
||||
SectionInfo Info;
|
||||
if (error(Section.getName(Info.SectionName)))
|
||||
return;
|
||||
if (error(Section.getAddress(Info.Address)))
|
||||
return;
|
||||
if (error(Section.getSize(Info.Size)))
|
||||
return;
|
||||
Info.Address = Section.getAddress();
|
||||
Info.Size = Section.getSize();
|
||||
Info.SegmentName =
|
||||
Obj->getSectionFinalSegmentName(Section.getRawDataRefImpl());
|
||||
if (!Info.SegmentName.equals(CurSegName)) {
|
||||
|
@ -307,25 +307,17 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
|
||||
}
|
||||
|
||||
for (const SectionRef &Section : Obj->sections()) {
|
||||
bool Text;
|
||||
if (error(Section.isText(Text)))
|
||||
break;
|
||||
bool Text = Section.isText();
|
||||
if (!Text)
|
||||
continue;
|
||||
|
||||
uint64_t SectionAddr;
|
||||
if (error(Section.getAddress(SectionAddr)))
|
||||
break;
|
||||
|
||||
uint64_t SectSize;
|
||||
if (error(Section.getSize(SectSize)))
|
||||
break;
|
||||
uint64_t SectionAddr = Section.getAddress();
|
||||
uint64_t SectSize = Section.getSize();
|
||||
|
||||
// Make a list of all the symbols in this section.
|
||||
std::vector<std::pair<uint64_t, StringRef>> Symbols;
|
||||
for (const SymbolRef &Symbol : Obj->symbols()) {
|
||||
bool contains;
|
||||
if (!error(Section.containsSymbol(Symbol, contains)) && contains) {
|
||||
if (Section.containsSymbol(Symbol)) {
|
||||
uint64_t Address;
|
||||
if (error(Symbol.getAddress(Address)))
|
||||
break;
|
||||
@ -501,19 +493,11 @@ static void PrintSectionHeaders(const ObjectFile *Obj) {
|
||||
StringRef Name;
|
||||
if (error(Section.getName(Name)))
|
||||
return;
|
||||
uint64_t Address;
|
||||
if (error(Section.getAddress(Address)))
|
||||
return;
|
||||
uint64_t Size;
|
||||
if (error(Section.getSize(Size)))
|
||||
return;
|
||||
bool Text, Data, BSS;
|
||||
if (error(Section.isText(Text)))
|
||||
return;
|
||||
if (error(Section.isData(Data)))
|
||||
return;
|
||||
if (error(Section.isBSS(BSS)))
|
||||
return;
|
||||
uint64_t Address = Section.getAddress();
|
||||
uint64_t Size = Section.getSize();
|
||||
bool Text = Section.isText();
|
||||
bool Data = Section.isData();
|
||||
bool BSS = Section.isBSS();
|
||||
std::string Type = (std::string(Text ? "TEXT " : "") +
|
||||
(Data ? "DATA " : "") + (BSS ? "BSS" : ""));
|
||||
outs() << format("%3d %-13s %08" PRIx64 " %016" PRIx64 " %s\n", i,
|
||||
@ -527,20 +511,14 @@ static void PrintSectionContents(const ObjectFile *Obj) {
|
||||
for (const SectionRef &Section : Obj->sections()) {
|
||||
StringRef Name;
|
||||
StringRef Contents;
|
||||
uint64_t BaseAddr;
|
||||
bool BSS;
|
||||
if (error(Section.getName(Name)))
|
||||
continue;
|
||||
if (error(Section.getAddress(BaseAddr)))
|
||||
continue;
|
||||
if (error(Section.isBSS(BSS)))
|
||||
continue;
|
||||
uint64_t BaseAddr = Section.getAddress();
|
||||
bool BSS = Section.isBSS();
|
||||
|
||||
outs() << "Contents of section " << Name << ":\n";
|
||||
if (BSS) {
|
||||
uint64_t Size;
|
||||
if (error(Section.getSize(Size)))
|
||||
continue;
|
||||
uint64_t Size = Section.getSize();
|
||||
outs() << format("<skipping contents of bss section at [%04" PRIx64
|
||||
", %04" PRIx64 ")>\n",
|
||||
BaseAddr, BaseAddr + Size);
|
||||
|
@ -186,13 +186,8 @@ void Decoder::printRegisters(const std::pair<uint16_t, uint32_t> &RegisterMask)
|
||||
ErrorOr<object::SectionRef>
|
||||
Decoder::getSectionContaining(const COFFObjectFile &COFF, uint64_t VA) {
|
||||
for (const auto &Section : COFF.sections()) {
|
||||
uint64_t Address;
|
||||
uint64_t Size;
|
||||
|
||||
if (std::error_code EC = Section.getAddress(Address))
|
||||
return EC;
|
||||
if (std::error_code EC = Section.getSize(Size))
|
||||
return EC;
|
||||
uint64_t Address = Section.getAddress();
|
||||
uint64_t Size = Section.getSize();
|
||||
|
||||
if (VA >= Address && (VA - Address) <= Size)
|
||||
return Section;
|
||||
@ -525,10 +520,7 @@ bool Decoder::dumpXDataRecord(const COFFObjectFile &COFF,
|
||||
if (COFF.getSectionContents(COFF.getCOFFSection(Section), Contents))
|
||||
return false;
|
||||
|
||||
uint64_t SectionVA;
|
||||
if (Section.getAddress(SectionVA))
|
||||
return false;
|
||||
|
||||
uint64_t SectionVA = Section.getAddress();
|
||||
uint64_t Offset = VA - SectionVA;
|
||||
const ulittle32_t *Data =
|
||||
reinterpret_cast<const ulittle32_t *>(Contents.data() + Offset);
|
||||
|
@ -629,8 +629,7 @@ void COFFDumper::printSections() {
|
||||
if (opts::SectionSymbols) {
|
||||
ListScope D(W, "Symbols");
|
||||
for (const SymbolRef &Symbol : Obj->symbols()) {
|
||||
bool Contained = false;
|
||||
if (Sec.containsSymbol(Symbol, Contained) || !Contained)
|
||||
if (!Sec.containsSymbol(Symbol))
|
||||
continue;
|
||||
|
||||
printSymbol(Symbol);
|
||||
|
@ -257,8 +257,7 @@ void MachODumper::printSections(const MachOObjectFile *Obj) {
|
||||
if (opts::SectionSymbols) {
|
||||
ListScope D(W, "Symbols");
|
||||
for (const SymbolRef &Symbol : Obj->symbols()) {
|
||||
bool Contained = false;
|
||||
if (Section.containsSymbol(Symbol, Contained) || !Contained)
|
||||
if (!Section.containsSymbol(Symbol))
|
||||
continue;
|
||||
|
||||
printSymbol(Symbol);
|
||||
@ -266,9 +265,7 @@ void MachODumper::printSections(const MachOObjectFile *Obj) {
|
||||
}
|
||||
|
||||
if (opts::SectionData) {
|
||||
bool IsBSS;
|
||||
if (error(Section.isBSS(IsBSS)))
|
||||
break;
|
||||
bool IsBSS = Section.isBSS();
|
||||
if (!IsBSS) {
|
||||
StringRef Data;
|
||||
if (error(Section.getContents(Data)))
|
||||
|
@ -297,17 +297,13 @@ static void PrintObjectSectionSizes(ObjectFile *Obj) {
|
||||
std::size_t max_size_len = strlen("size");
|
||||
std::size_t max_addr_len = strlen("addr");
|
||||
for (const SectionRef &Section : Obj->sections()) {
|
||||
uint64_t size = 0;
|
||||
if (error(Section.getSize(size)))
|
||||
return;
|
||||
uint64_t size = Section.getSize();
|
||||
total += size;
|
||||
|
||||
StringRef name;
|
||||
uint64_t addr = 0;
|
||||
if (error(Section.getName(name)))
|
||||
return;
|
||||
if (error(Section.getAddress(addr)))
|
||||
return;
|
||||
uint64_t addr = Section.getAddress();
|
||||
max_name_len = std::max(max_name_len, name.size());
|
||||
max_size_len = std::max(max_size_len, getNumLengthAsString(size));
|
||||
max_addr_len = std::max(max_addr_len, getNumLengthAsString(addr));
|
||||
@ -337,14 +333,10 @@ static void PrintObjectSectionSizes(ObjectFile *Obj) {
|
||||
// Print each section.
|
||||
for (const SectionRef &Section : Obj->sections()) {
|
||||
StringRef name;
|
||||
uint64_t size = 0;
|
||||
uint64_t addr = 0;
|
||||
if (error(Section.getName(name)))
|
||||
return;
|
||||
if (error(Section.getSize(size)))
|
||||
return;
|
||||
if (error(Section.getAddress(addr)))
|
||||
return;
|
||||
uint64_t size = Section.getSize();
|
||||
uint64_t addr = Section.getAddress();
|
||||
std::string namestr = name;
|
||||
|
||||
outs() << format(fmt.str().c_str(), namestr.c_str(), size, addr);
|
||||
@ -365,18 +357,10 @@ static void PrintObjectSectionSizes(ObjectFile *Obj) {
|
||||
|
||||
// Make one pass over the section table to calculate sizes.
|
||||
for (const SectionRef &Section : Obj->sections()) {
|
||||
uint64_t size = 0;
|
||||
bool isText = false;
|
||||
bool isData = false;
|
||||
bool isBSS = false;
|
||||
if (error(Section.getSize(size)))
|
||||
return;
|
||||
if (error(Section.isText(isText)))
|
||||
return;
|
||||
if (error(Section.isData(isData)))
|
||||
return;
|
||||
if (error(Section.isBSS(isBSS)))
|
||||
return;
|
||||
uint64_t size = Section.getSize();
|
||||
bool isText = Section.isText();
|
||||
bool isData = Section.isData();
|
||||
bool isBSS = Section.isBSS();
|
||||
if (isText)
|
||||
total_text += size;
|
||||
else if (isData)
|
||||
|
@ -139,9 +139,8 @@ static void dumpVTables(const ObjectFile *Obj) {
|
||||
// Skip external symbols.
|
||||
if (SecI == Obj->section_end())
|
||||
continue;
|
||||
bool IsBSS, IsVirtual;
|
||||
if (error(SecI->isBSS(IsBSS)) || error(SecI->isVirtual(IsVirtual)))
|
||||
break;
|
||||
bool IsBSS = SecI->isBSS();
|
||||
bool IsVirtual = SecI->isVirtual();
|
||||
// Skip virtual or BSS sections.
|
||||
if (IsBSS || IsVirtual)
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user