[lld] r196458 - [PECOFF] Emit the import table to .idata section.

Rui Ueyama ruiu at google.com
Wed Dec 4 18:27:30 PST 2013


Author: ruiu
Date: Wed Dec  4 20:27:30 2013
New Revision: 196458

URL: http://llvm.org/viewvc/llvm-project?rev=196458&view=rev
Log:
[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.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h
    lld/trunk/test/pecoff/importlib.test

Modified: lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h?rev=196458&r1=196457&r2=196458&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h Wed Dec  4 20:27:30 2013
@@ -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__; }
 

Modified: lld/trunk/test/pecoff/importlib.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/importlib.test?rev=196458&r1=196457&r2=196458&view=diff
==============================================================================
--- lld/trunk/test/pecoff/importlib.test (original)
+++ lld/trunk/test/pecoff/importlib.test Wed Dec  4 20:27:30 2013
@@ -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)





More information about the llvm-commits mailing list