[PATCH] D68352: [lld] Don't create hints-section if Hint/Name Table is empty

Stefan Schmidt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 02:13:23 PDT 2019


thrimbor updated this revision to Diff 223808.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68352/new/

https://reviews.llvm.org/D68352

Files:
  lld/COFF/Writer.cpp
  lld/test/COFF/Inputs/ordinal-only-implib.def
  lld/test/COFF/imports-ordinal-only.s


Index: lld/test/COFF/imports-ordinal-only.s
===================================================================
--- /dev/null
+++ lld/test/COFF/imports-ordinal-only.s
@@ -0,0 +1,20 @@
+# REQUIRES: x86
+#
+# RUN: llvm-dlltool -k -m i386 --input-def %p/Inputs/ordinal-only-implib.def --output-lib %t-implib.a
+# RUN: llvm-mc -triple=i386-pc-win32 %s -filetype=obj -o %t.obj
+# RUN: lld-link -out:%t.exe -entry:main -subsystem:console -safeseh:no -debug %t.obj %t-implib.a
+# RUN: llvm-objdump -private-headers %t.exe | FileCheck %s
+
+.text
+.global _main
+_main:
+call _ByOrdinalFunction
+ret
+
+# CHECK: The Import Tables:
+# CHECK-NEXT:   lookup 000020b4 time 00000000 fwd 00000000 name 000020c4 addr 000020bc
+# CHECK-EMPTY:
+# CHECK-NEXT:     DLL Name: test.dll
+# CHECK-NEXT:     Hint/Ord  Name
+# CHECK-NEXT:            1
+# CHECK-EMPTY:
Index: lld/test/COFF/Inputs/ordinal-only-implib.def
===================================================================
--- /dev/null
+++ lld/test/COFF/Inputs/ordinal-only-implib.def
@@ -0,0 +1,3 @@
+LIBRARY test.dll
+EXPORTS
+ByOrdinalFunction @ 1 NONAME
Index: lld/COFF/Writer.cpp
===================================================================
--- lld/COFF/Writer.cpp
+++ lld/COFF/Writer.cpp
@@ -743,7 +743,8 @@
   add(".idata$2", idata.dirs);
   add(".idata$4", idata.lookups);
   add(".idata$5", idata.addresses);
-  add(".idata$6", idata.hints);
+  if (!idata.hints.empty())
+    add(".idata$6", idata.hints);
   add(".idata$7", idata.dllNames);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68352.223808.patch
Type: text/x-patch
Size: 1504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191008/9b143fab/attachment.bin>


More information about the llvm-commits mailing list