[PATCH] D68352: [lld] Don't create hints-section if Hint/Name Table is empty
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 8 23:52:53 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc3c5e0fbbf76: [lld] Don't create hints-section if Hint/Name Table is empty (authored by ruiu).
Repository:
rG LLVM Github Monorepo
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,18 @@
+# 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 --match-full-lines %s
+
+.text
+.global _main
+_main:
+call _ByOrdinalFunction
+ret
+
+# CHECK: The Import Tables:
+# CHECK: 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.223993.patch
Type: text/x-patch
Size: 1414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191009/b6f58ec6/attachment.bin>
More information about the llvm-commits
mailing list