[lld] r243372 - COFF: Fix 32-bit delay-import address table.
Rui Ueyama
ruiu at google.com
Mon Jul 27 19:54:18 PDT 2015
Author: ruiu
Date: Mon Jul 27 21:54:18 2015
New Revision: 243372
URL: http://llvm.org/viewvc/llvm-project?rev=243372&view=rev
Log:
COFF: Fix 32-bit delay-import address table.
The address table entry is 32-bit wide on 32-bit and 64-bit on 64-bit.
Previously, it was 64-bit even on 32-bit.
Modified:
lld/trunk/COFF/DLL.cpp
lld/trunk/test/COFF/delayimports32.test
Modified: lld/trunk/COFF/DLL.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DLL.cpp?rev=243372&r1=243371&r2=243372&view=diff
==============================================================================
--- lld/trunk/COFF/DLL.cpp (original)
+++ lld/trunk/COFF/DLL.cpp Mon Jul 27 21:54:18 2015
@@ -361,10 +361,14 @@ uint64_t DelayLoadContents::getDirSize()
class DelayAddressChunk : public Chunk {
public:
explicit DelayAddressChunk(Chunk *C) : Thunk(C) {}
- size_t getSize() const override { return 8; }
+ size_t getSize() const override { return ptrSize(); }
void writeTo(uint8_t *Buf) override {
- write64le(Buf + FileOff, Thunk->getRVA() + Config->ImageBase);
+ if (Config->is64()) {
+ write64le(Buf + FileOff, Thunk->getRVA() + Config->ImageBase);
+ } else {
+ write32le(Buf + FileOff, Thunk->getRVA() + Config->ImageBase);
+ }
}
void getBaserels(std::vector<Baserel> *Res) override {
Modified: lld/trunk/test/COFF/delayimports32.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/delayimports32.test?rev=243372&r1=243371&r2=243372&view=diff
==============================================================================
--- lld/trunk/test/COFF/delayimports32.test (original)
+++ lld/trunk/test/COFF/delayimports32.test Mon Jul 27 21:54:18 2015
@@ -23,7 +23,7 @@ IMPORT-NEXT: Address: 0x402029
IMPORT-NEXT: }
IMPORT-NEXT: Import {
IMPORT-NEXT: Symbol: MessageBoxA (0)
-IMPORT-NEXT: Address: 0x0
+IMPORT-NEXT: Address: 0x40203E
IMPORT-NEXT: }
IMPORT-NEXT: }
@@ -34,7 +34,7 @@ BASEREL-NEXT: Address: 0x1020
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
-BASEREL-NEXT: Address: 0x1028
+BASEREL-NEXT: Address: 0x1024
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
@@ -78,7 +78,7 @@ DISASM-NEXT: 203b: 59 popl
DISASM-NEXT: 203c: ff e0 jmpl *%eax
DISASM-NEXT: 203e: 51 pushl %ecx
DISASM-NEXT: 203f: 52 pushl %edx
-DISASM-NEXT: 2040: 68 28 10 40 00 pushl $4198440
+DISASM-NEXT: 2040: 68 24 10 40 00 pushl $4198436
DISASM-NEXT: 2045: 68 00 30 40 00 pushl $4206592
DISASM-NEXT: 204a: e8 b1 ff ff ff calll -79 <_main at 0>
DISASM-NEXT: 204f: 5a popl %edx
More information about the llvm-commits
mailing list