diff options
author | Rui Ueyama <ruiu@google.com> | 2013-12-05 02:27:30 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2013-12-05 02:27:30 +0000 |
commit | 6cfe07b9eb6ae233b30bdd1bad914b0cf02fc1a9 (patch) | |
tree | 1a3dd8a6a6b6b2aa6320e93958eaf0b1662a9050 | |
parent | 57b20a7e542d1a98fa8ce45eb582a939c3a2a50c (diff) | |
download | bcm5719-llvm-6cfe07b9eb6ae233b30bdd1bad914b0cf02fc1a9.tar.gz bcm5719-llvm-6cfe07b9eb6ae233b30bdd1bad914b0cf02fc1a9.zip |
[PECOFF] Emit the import table to .idata section.
Emitting idata atoms to their own section would make debugging easier.
The Windows loader do not really care about whether the DLL import table is
in .rdata or its own .idata section, so there is no change in functionality.
llvm-svn: 196458
-rw-r--r-- | lld/lib/ReaderWriter/PECOFF/IdataPass.h | 2 | ||||
-rw-r--r-- | lld/test/pecoff/importlib.test | 54 |
2 files changed, 33 insertions, 23 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/IdataPass.h b/lld/lib/ReaderWriter/PECOFF/IdataPass.h index 5b784185cb0..49ff3693a47 100644 --- a/lld/lib/ReaderWriter/PECOFF/IdataPass.h +++ b/lld/lib/ReaderWriter/PECOFF/IdataPass.h @@ -69,6 +69,8 @@ struct Context { /// The root class of all idata atoms. class IdataAtom : public COFFLinkerInternalAtom { public: + virtual SectionChoice sectionChoice() const { return sectionCustomRequired; } + virtual StringRef customSectionName() const { return ".idata"; }; virtual ContentType contentType() const { return typeData; } virtual ContentPermissions permissions() const { return permR__; } diff --git a/lld/test/pecoff/importlib.test b/lld/test/pecoff/importlib.test index 5ea86f1744d..b302b3e2ee8 100644 --- a/lld/test/pecoff/importlib.test +++ b/lld/test/pecoff/importlib.test @@ -4,35 +4,43 @@ # RUN: yaml2obj %p/Inputs/vars-main.obj.yaml > %t.obj # # RUN: lld -flavor link /out:%t1 /subsystem:console /entry:main /opt:noref \ -# RUN: -- %t.obj %p/Inputs/vars.lib && llvm-objdump -d %t1 | FileCheck %s +# RUN: -- %t.obj %p/Inputs/vars.lib +# RUN: llvm-objdump -d %t1 | FileCheck -check-prefix=TEXT %s +# RUN: llvm-readobj -sections %t1 | FileCheck -check-prefix=SECTION %s # # RUN: lld -flavor link /out:%t1 /subsystem:console /entry:main /opt:noref \ -# RUN: /libpath:%p/Inputs -- %t.obj vars.lib && llvm-objdump -d %t1 \ -# RUN: | FileCheck %s +# RUN: /libpath:%p/Inputs -- %t.obj vars.lib +# RUN: llvm-objdump -d %t1 | FileCheck -check-prefix=TEXT %s +# RUN: llvm-readobj -sections %t1 | FileCheck -check-prefix=SECTION %s # # RUN: lld -flavor link /out:%t1 /subsystem:console /entry:main /opt:noref \ -# RUN: /libpath:%p/Inputs /defaultlib:vars.lib -- %t.obj \ -# RUN: && llvm-objdump -d %t1 | FileCheck %s +# RUN: /libpath:%p/Inputs /defaultlib:vars.lib -- %t.obj +# RUN: llvm-objdump -d %t1 | FileCheck -check-prefix=TEXT %s +# RUN: llvm-readobj -sections %t1 | FileCheck -check-prefix=SECTION %s # # RUN: env LIB=%p/Inputs lld -flavor link /out:%t1 /subsystem:console \ -# RUN: /opt:noref /entry:main -- %t.obj vars.lib \ -# RUN: && llvm-objdump -d %t1 | FileCheck %s +# RUN: /opt:noref /entry:main -- %t.obj vars.lib +# RUN: llvm-objdump -d %t1 | FileCheck -check-prefix=TEXT %s +# RUN: llvm-readobj -sections %t1 | FileCheck -check-prefix=SECTION %s # # RUN: env LINK="/out:%t1 /subsystem:console /entry:main /opt:noref \ -# RUN: -- %t.obj" lld -flavor link %p/Inputs/vars.lib \ -# RUN: && llvm-objdump -d %t1 | FileCheck %s +# RUN: -- %t.obj" lld -flavor link %p/Inputs/vars.lib +# RUN: llvm-objdump -d %t1 | FileCheck -check-prefix=TEXT %s +# RUN: llvm-readobj -sections %t1 | FileCheck -check-prefix=SECTION %s -CHECK: Disassembly of section .text: -CHECK-NEXT: .text: -CHECK-NEXT: pushl %ebp -CHECK-NEXT: movl %esp, %ebp -CHECK-NEXT: pushl %esi -CHECK-NEXT: calll *{{[0-9]+}} -CHECK-NEXT: movl {{[0-9]+}}, %ecx -CHECK-NEXT: movl (%ecx), %esi -CHECK-NEXT: addl %eax, %esi -CHECK-NEXT: calll *{{[0-9]+}} -CHECK-NEXT: addl %esi, %eax -CHECK-NEXT: popl %esi -CHECK-NEXT: popl %ebp -CHECK-NEXT: ret +TEXT: Disassembly of section .text: +TEXT-NEXT: .text: +TEXT-NEXT: pushl %ebp +TEXT-NEXT: movl %esp, %ebp +TEXT-NEXT: pushl %esi +TEXT-NEXT: calll *{{[0-9]+}} +TEXT-NEXT: movl {{[0-9]+}}, %ecx +TEXT-NEXT: movl (%ecx), %esi +TEXT-NEXT: addl %eax, %esi +TEXT-NEXT: calll *{{[0-9]+}} +TEXT-NEXT: addl %esi, %eax +TEXT-NEXT: popl %esi +TEXT-NEXT: popl %ebp +TEXT-NEXT: ret + +SECTION: Name: .idata (2E 69 64 61 74 61 00 00) |