[lld] r240844 - COFF: Add base relocation for delay-import table.
Rui Ueyama
ruiu at google.com
Fri Jun 26 15:05:32 PDT 2015
Author: ruiu
Date: Fri Jun 26 17:05:32 2015
New Revision: 240844
URL: http://llvm.org/viewvc/llvm-project?rev=240844&view=rev
Log:
COFF: Add base relocation for delay-import table.
Because the address table of the delay-import table contains
absolute address, it needs to be added to the base relocation
table.
Modified:
lld/trunk/COFF/DLL.cpp
lld/trunk/test/COFF/delayimports.test
Modified: lld/trunk/COFF/DLL.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DLL.cpp?rev=240844&r1=240843&r2=240844&view=diff
==============================================================================
--- lld/trunk/COFF/DLL.cpp (original)
+++ lld/trunk/COFF/DLL.cpp Fri Jun 26 17:05:32 2015
@@ -326,6 +326,10 @@ public:
write64le(Buf + FileOff, Thunk->getRVA() + Config->ImageBase);
}
+ void getBaserels(std::vector<uint32_t> *Res, Defined *ImageBase) override {
+ Res->push_back(RVA);
+ }
+
Chunk *Thunk;
};
Modified: lld/trunk/test/COFF/delayimports.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/delayimports.test?rev=240844&r1=240843&r2=240844&view=diff
==============================================================================
--- lld/trunk/test/COFF/delayimports.test (original)
+++ lld/trunk/test/COFF/delayimports.test Fri Jun 26 17:05:32 2015
@@ -1,26 +1,41 @@
# RUN: lld -flavor link2 /out:%t.exe /entry:main /subsystem:console \
# RUN: %p/Inputs/hello64.obj %p/Inputs/std64.lib /delayload:std64.dll \
# RUN: /alternatename:__delayLoadHelper2=main
-# RUN: llvm-readobj -coff-imports %t.exe | FileCheck %s
+# RUN: llvm-readobj -coff-imports %t.exe | FileCheck -check-prefix=IMPORT %s
+# RUN: llvm-readobj -coff-basereloc %t.exe | FileCheck -check-prefix=BASEREL %s
-CHECK: DelayImport {
-CHECK-NEXT: Name: std64.dll
-CHECK-NEXT: Attributes: 0x1
-CHECK-NEXT: ModuleHandle: 0x1018
-CHECK-NEXT: ImportAddressTable: 0x1020
-CHECK-NEXT: ImportNameTable: 0x3040
-CHECK-NEXT: BoundDelayImportTable: 0x0
-CHECK-NEXT: UnloadDelayImportTable: 0x0
-CHECK-NEXT: Import {
-CHECK-NEXT: Symbol: ExitProcess (0)
-CHECK-NEXT: Address: 0x140002066
-CHECK-NEXT: }
-CHECK-NEXT: Import {
-CHECK-NEXT: Symbol: (50)
-CHECK-NEXT: Address: 0x1400020BD
-CHECK-NEXT: }
-CHECK-NEXT: Import {
-CHECK-NEXT: Symbol: MessageBoxA (1)
-CHECK-NEXT: Address: 0x140002114
-CHECK-NEXT: }
-CHECK-NEXT: }
+IMPORT: DelayImport {
+IMPORT-NEXT: Name: std64.dll
+IMPORT-NEXT: Attributes: 0x1
+IMPORT-NEXT: ModuleHandle: 0x1018
+IMPORT-NEXT: ImportAddressTable: 0x1020
+IMPORT-NEXT: ImportNameTable: 0x3040
+IMPORT-NEXT: BoundDelayImportTable: 0x0
+IMPORT-NEXT: UnloadDelayImportTable: 0x0
+IMPORT-NEXT: Import {
+IMPORT-NEXT: Symbol: ExitProcess (0)
+IMPORT-NEXT: Address: 0x140002066
+IMPORT-NEXT: }
+IMPORT-NEXT: Import {
+IMPORT-NEXT: Symbol: (50)
+IMPORT-NEXT: Address: 0x1400020BD
+IMPORT-NEXT: }
+IMPORT-NEXT: Import {
+IMPORT-NEXT: Symbol: MessageBoxA (1)
+IMPORT-NEXT: Address: 0x140002114
+IMPORT-NEXT: }
+IMPORT-NEXT: }
+
+BASEREL: BaseReloc [
+BASEREL-NEXT: Entry {
+BASEREL-NEXT: Type: DIR64
+BASEREL-NEXT: Address: 0x1020
+BASEREL-NEXT: }
+BASEREL-NEXT: Entry {
+BASEREL-NEXT: Type: DIR64
+BASEREL-NEXT: Address: 0x1028
+BASEREL-NEXT: }
+BASEREL-NEXT: Entry {
+BASEREL-NEXT: Type: DIR64
+BASEREL-NEXT: Address: 0x1030
+BASEREL-NEXT: }
More information about the llvm-commits
mailing list