[lld] r241883 - COFF: Fix locally-imported symbol's base relocations.
Rui Ueyama
ruiu at google.com
Thu Jul 9 21:30:54 PDT 2015
Author: ruiu
Date: Thu Jul 9 23:30:54 2015
New Revision: 241883
URL: http://llvm.org/viewvc/llvm-project?rev=241883&view=rev
Log:
COFF: Fix locally-imported symbol's base relocations.
Base relocations are RVA and not VA, so we shouldn't add ImageBase.
Modified:
lld/trunk/COFF/Chunks.cpp
lld/trunk/test/COFF/locally-imported.test
Modified: lld/trunk/COFF/Chunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.cpp?rev=241883&r1=241882&r2=241883&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.cpp (original)
+++ lld/trunk/COFF/Chunks.cpp Thu Jul 9 23:30:54 2015
@@ -263,7 +263,7 @@ void ImportThunkChunk::writeTo(uint8_t *
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 {
Modified: lld/trunk/test/COFF/locally-imported.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/locally-imported.test?rev=241883&r1=241882&r2=241883&view=diff
==============================================================================
--- lld/trunk/test/COFF/locally-imported.test (original)
+++ lld/trunk/test/COFF/locally-imported.test Thu Jul 9 23:30:54 2015
@@ -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
More information about the llvm-commits
mailing list