summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/COFFObjectFile.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-11-27 10:37:47 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-11-27 10:37:47 +0000
commit37ab257b88fe1b3c006bb513f8991168b066d402 (patch)
treefecd58abcc0e31f48e8338bb194408b62f915432 /llvm/lib/Object/COFFObjectFile.cpp
parent9e4668415495f396200b525ba4868c42abe2c9bd (diff)
downloadbcm5719-llvm-37ab257b88fe1b3c006bb513f8991168b066d402.tar.gz
bcm5719-llvm-37ab257b88fe1b3c006bb513f8991168b066d402.zip
Revert r145180 as it is causing test failures on all the bots.
Original commit message: Fixed ObjectFile functions: - getSymbolOffset() renamed as getSymbolFileOffset() - getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile. - added getRelocationOffset() - fixed MachOObjectFile::getSymbolSize() - fixed MachOObjectFile::getSymbolSection() - fixed MachOObjectFile::getSymbolOffset() for symbols without section data. llvm-svn: 145182
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 8344ca071d3..c6ce56221a5 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/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<uintptr_t>(base() +
+ Section->PointerToRawData +
+ symb->Value);
else
- Result = symb->Value;
+ Result = reinterpret_cast<uintptr_t>(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);
OpenPOWER on IntegriCloud