This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Windows/PE: Do not create empty export table.


Danny Smith wrote:

This patch will also change the default behaviour to "export
everything else the default way"
when there is no .def file and no symbols marked with  export directive"

Shouldn't we rather test for an empty export table later on like so:

You're right; checking here seems a lot better.


I've tested this version on i386-pc-mingw32 with a build and testsuite run, with no regressions.

OK to commit?

2004-08-07  Aaron W. LaFramboise  <aaron98wiridge9@aaronwl.com>

	* pe-dll.c (process_def_file): Do not create empty export table.

	* ld-pe/exports.d: New file.
	* ld-pe/exports.s: New file.
	* ld-pe/pe.exp: New test for empty export table.

Index: ld/pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.107
diff -u -p -r1.107 pe-dll.c
--- ld/pe-dll.c	31 Jul 2008 07:27:52 -0000	1.107
+++ ld/pe-dll.c	7 Aug 2008 17:07:14 -0000
@@ -667,6 +667,10 @@ process_def_file (bfd *abfd ATTRIBUTE_UN
 #undef NE
 #define NE pe_def_file->num_exports
 
+  /* Don't create an empty export table.  */
+  if (NE == 0)
+    return;
+
   /* Canonicalize the export list.  */
   if (pe_dll_kill_ats)
     {
Index: ld/testsuite/ld-pe/exports.d
===================================================================
RCS file: ld/testsuite/ld-pe/exports.d
diff -N ld/testsuite/ld-pe/exports.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-pe/exports.d	7 Aug 2008 17:07:16 -0000
@@ -0,0 +1,4 @@
+#...
+The Data Directory
+Entry 0 00000000 00000000 Export Directory \[\.edata \(or where ever we found it\)\]
+#...
Index: ld/testsuite/ld-pe/exports.s
===================================================================
RCS file: ld/testsuite/ld-pe/exports.s
diff -N ld/testsuite/ld-pe/exports.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-pe/exports.s	7 Aug 2008 17:07:16 -0000
@@ -0,0 +1,2 @@
+# Deliberately left empty.
+
Index: ld/testsuite/ld-pe/pe.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-pe/pe.exp,v
retrieving revision 1.8
diff -u -p -r1.8 pe.exp
--- ld/testsuite/ld-pe/pe.exp	6 Aug 2007 14:41:51 -0000	1.8
+++ ld/testsuite/ld-pe/pe.exp	7 Aug 2008 17:07:16 -0000
@@ -38,6 +38,8 @@ if {[istarget x86_64-*-mingw*] } {
   set pe_tests {
     {".secrel32" "" "" {secrel1.s secrel2.s}
      {{objdump -s secrel.d}} "secrel.x"}
+    {"Empty export table" "" "" "exports.s"
+     {{objdump -p exports.d}} "exports.dll"}
   }
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]