aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Object/COFFObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Object/COFFObjectFile.cpp')
-rw-r--r--lib/Object/COFFObjectFile.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp
index 18aad9a..07de6bc 100644
--- a/lib/Object/COFFObjectFile.cpp
+++ b/lib/Object/COFFObjectFile.cpp
@@ -117,7 +117,7 @@ error_code COFFObjectFile::getSymbolNext(DataRefImpl Symb,
error_code COFFObjectFile::getSymbolAddress(DataRefImpl Symb,
uint64_t &Result) const {
const coff_symbol *symb = toSymb(Symb);
- const coff_section *Section;
+ const coff_section *Section = NULL;
if (error_code ec = getSection(symb->SectionNumber, Section))
return ec;
char Type;
@@ -138,7 +138,7 @@ error_code COFFObjectFile::getSymbolSize(DataRefImpl Symb,
// in the same section as this symbol, and looking for either the next
// symbol, or the end of the section.
const coff_symbol *symb = toSymb(Symb);
- const coff_section *Section;
+ const coff_section *Section = NULL;
if (error_code ec = getSection(symb->SectionNumber, Section))
return ec;
char Type;
@@ -171,7 +171,7 @@ error_code COFFObjectFile::getSymbolNMTypeChar(DataRefImpl Symb,
uint32_t Characteristics = 0;
if (symb->SectionNumber > 0) {
- const coff_section *Section;
+ const coff_section *Section = NULL;
if (error_code ec = getSection(symb->SectionNumber, Section))
return ec;
Characteristics = Section->Characteristics;
@@ -293,6 +293,14 @@ error_code COFFObjectFile::isSectionText(DataRefImpl Sec,
return object_error::success;
}
+error_code COFFObjectFile::sectionContainsSymbol(DataRefImpl Sec,
+ DataRefImpl Symb,
+ bool &Result) const {
+ // FIXME: Unimplemented.
+ Result = false;
+ return object_error::success;
+}
+
COFFObjectFile::COFFObjectFile(MemoryBuffer *Object, error_code &ec)
: ObjectFile(Binary::isCOFF, Object, ec) {
// Check that we at least have enough room for a header.
@@ -309,8 +317,7 @@ COFFObjectFile::COFFObjectFile(MemoryBuffer *Object, error_code &ec)
if (!checkSize(Data, ec, 0x3c + 8)) return;
HeaderStart += *reinterpret_cast<const ulittle32_t *>(base() + 0x3c);
// Check the PE header. ("PE\0\0")
- if (StringRef(reinterpret_cast<const char *>(base() + HeaderStart), 4)
- != "PE\0\0") {
+ if (std::memcmp(base() + HeaderStart, "PE\0\0", 4) != 0) {
ec = object_error::parse_failed;
return;
}