mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-10-25 03:03:31 +00:00
[COFF] Return symbol VAs instead of RVAs for PE files
This makes llvm-nm consistent with binutils nm on executables and DLLs. For a vanilla hello world executable, the address of main should include the default image base of 0x400000. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243755 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
0dd663b598
commit
c136e5507a
4 files changed
+39
No files matched your search
@@ -171,6 +171,14 @@ ErrorOr<uint64_t> COFFObjectFile::getSymbolAddress(DataRefImpl Ref) const {
|
||||
if (std::error_code EC = getSection(SectionNumber, Section))
|
||||
return EC;
|
||||
Result += Section->VirtualAddress;
|
||||
|
||||
// The section VirtualAddress does not include ImageBase, and we want to
|
||||
// return virtual addresses.
|
||||
if (PE32Header)
|
||||
Result += PE32Header->ImageBase;
|
||||
else if (PE32PlusHeader)
|
||||
Result += PE32Header->ImageBase;
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user