diff options
| author | Rui Ueyama <ruiu@google.com> | 2015-07-10 04:30:54 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2015-07-10 04:30:54 +0000 |
| commit | c851ccc3bd38b0887615f9b39950d07ffc66da0a (patch) | |
| tree | afa3f9c5a5619c8f5d81a466880b3df85df61ed4 | |
| parent | 0de292f5d0cd12c2e8630b4b1c848460377ae58d (diff) | |
| download | bcm5719-llvm-c851ccc3bd38b0887615f9b39950d07ffc66da0a.tar.gz bcm5719-llvm-c851ccc3bd38b0887615f9b39950d07ffc66da0a.zip | |
COFF: Fix locally-imported symbol's base relocations.
Base relocations are RVA and not VA, so we shouldn't add ImageBase.
llvm-svn: 241883
| -rw-r--r-- | lld/COFF/Chunks.cpp | 2 | ||||
| -rw-r--r-- | lld/test/COFF/locally-imported.test | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp index 0c4e99acdd7..873d2a7be0d 100644 --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -263,7 +263,7 @@ void ImportThunkChunk::writeTo(uint8_t *Buf) { void LocalImportChunk::getBaserels(std::vector<uint32_t> *Res, Defined *ImageBase) { - Res->push_back(getRVA() + Config->ImageBase); + Res->push_back(getRVA()); } size_t LocalImportChunk::getSize() const { diff --git a/lld/test/COFF/locally-imported.test b/lld/test/COFF/locally-imported.test index 7f985536e7a..406a4a66eed 100644 --- a/lld/test/COFF/locally-imported.test +++ b/lld/test/COFF/locally-imported.test @@ -1,13 +1,24 @@ # RUN: yaml2obj < %s > %t.obj # RUN: lld -flavor link2 /out:%t.exe /entry:main %t.obj # RUN: llvm-objdump -s %t.exe | FileCheck %s +# RUN: llvm-readobj -coff-basereloc %t.exe | FileCheck -check-prefix=BASEREL %s # CHECK: Contents of section .text: # CHECK-NEXT: 1000 00200000 - # CHECK: Contents of section .rdata: # CHECK-NEXT: 2000 04100040 01000000 +# BASEREL: BaseReloc [ +# BASEREL-NEXT: Entry { +# BASEREL-NEXT: Type: DIR64 +# BASEREL-NEXT: Address: 0x2000 +# BASEREL-NEXT: } +# BASEREL-NEXT: Entry { +# BASEREL-NEXT: Type: ABSOLUTE +# BASEREL-NEXT: Address: 0x2000 +# BASEREL-NEXT: } +# BASEREL-NEXT: ] + --- header: Machine: IMAGE_FILE_MACHINE_AMD64 |

