diff options
Diffstat (limited to 'lib/Object/COFFObjectFile.cpp')
-rw-r--r-- | lib/Object/COFFObjectFile.cpp | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp index d5ff7d6..cde6fdc 100644 --- a/lib/Object/COFFObjectFile.cpp +++ b/lib/Object/COFFObjectFile.cpp @@ -362,39 +362,11 @@ bool COFFObjectFile::isSectionBSS(DataRefImpl Ref) const { return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA; } -bool COFFObjectFile::isSectionRequiredForExecution(DataRefImpl Ref) const { - // Sections marked 'Info', 'Remove', or 'Discardable' aren't required for - // execution. - const coff_section *Sec = toSec(Ref); - return !(Sec->Characteristics & - (COFF::IMAGE_SCN_LNK_INFO | COFF::IMAGE_SCN_LNK_REMOVE | - COFF::IMAGE_SCN_MEM_DISCARDABLE)); -} - bool COFFObjectFile::isSectionVirtual(DataRefImpl Ref) const { const coff_section *Sec = toSec(Ref); return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA; } -bool COFFObjectFile::isSectionZeroInit(DataRefImpl Ref) const { - const coff_section *Sec = toSec(Ref); - return Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA; -} - -bool COFFObjectFile::isSectionReadOnlyData(DataRefImpl Ref) const { - const coff_section *Sec = toSec(Ref); - // Check if it's any sort of data section. - if (!(Sec->Characteristics & (COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA | - COFF::IMAGE_SCN_CNT_INITIALIZED_DATA))) - return false; - // If it's writable or executable or contains code, it isn't read-only data. - if (Sec->Characteristics & - (COFF::IMAGE_SCN_CNT_CODE | COFF::IMAGE_SCN_MEM_EXECUTE | - COFF::IMAGE_SCN_MEM_WRITE)) - return false; - return true; -} - bool COFFObjectFile::sectionContainsSymbol(DataRefImpl SecRef, DataRefImpl SymbRef) const { const coff_section *Sec = toSec(SecRef); @@ -414,7 +386,8 @@ static uint32_t getNumberOfRelocations(const coff_section *Sec, if (getObject(FirstReloc, M, reinterpret_cast<const coff_relocation*>( base + Sec->PointerToRelocations))) return 0; - return FirstReloc->VirtualAddress; + // -1 to exclude this first relocation entry. + return FirstReloc->VirtualAddress - 1; } return Sec->NumberOfRelocations; } @@ -1060,7 +1033,7 @@ symbol_iterator COFFObjectFile::getRelocationSymbol(DataRefImpl Rel) const { else if (SymbolTable32) Ref.p = reinterpret_cast<uintptr_t>(SymbolTable32 + R->SymbolTableIndex); else - return symbol_end(); + llvm_unreachable("no symbol table pointer!"); return symbol_iterator(SymbolRef(Ref, this)); } |