X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=lib%2FObject%2FCOFFObjectFile.cpp;h=c6ce56221a555ee0e2fecb20915989fdc94adc49;hb=790552c20fbd8daa77d343419f0f6ec4e7fa1457;hp=8344ca071d34faa42d57e0e91d2d1ef5f4780d0a;hpb=7096692fd9ab5753f17500a27d400d1544b6d3d8;p=oota-llvm.git diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp index 8344ca071d3..c6ce56221a5 100644 --- a/lib/Object/COFFObjectFile.cpp +++ b/lib/Object/COFFObjectFile.cpp @@ -101,7 +101,7 @@ error_code COFFObjectFile::getSymbolNext(DataRefImpl Symb, return getSymbolName(symb, Result); } -error_code COFFObjectFile::getSymbolFileOffset(DataRefImpl Symb, +error_code COFFObjectFile::getSymbolOffset(DataRefImpl Symb, uint64_t &Result) const { const coff_symbol *symb = toSymb(Symb); const coff_section *Section = NULL; @@ -113,7 +113,7 @@ error_code COFFObjectFile::getSymbolFileOffset(DataRefImpl Symb, if (Type == 'U' || Type == 'w') Result = UnknownAddressOrSize; else if (Section) - Result = Section->PointerToRawData + symb->Value; + Result = Section->VirtualAddress + symb->Value; else Result = symb->Value; return object_error::success; @@ -131,9 +131,11 @@ error_code COFFObjectFile::getSymbolAddress(DataRefImpl Symb, if (Type == 'U' || Type == 'w') Result = UnknownAddressOrSize; else if (Section) - Result = Section->VirtualAddress + symb->Value; + Result = reinterpret_cast(base() + + Section->PointerToRawData + + symb->Value); else - Result = symb->Value; + Result = reinterpret_cast(base() + symb->Value); return object_error::success; } @@ -622,11 +624,6 @@ error_code COFFObjectFile::getRelocationAddress(DataRefImpl Rel, Res = toRel(Rel)->VirtualAddress; return object_error::success; } -error_code COFFObjectFile::getRelocationOffset(DataRefImpl Rel, - uint64_t &Res) const { - Res = toRel(Rel)->VirtualAddress; - return object_error::success; -} error_code COFFObjectFile::getRelocationSymbol(DataRefImpl Rel, SymbolRef &Res) const { const coff_relocation* R = toRel(Rel);