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]

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


Aaron W. LaFramboise wrote:
> 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?

  The patch is OK.  I've refreshed it up to HEAD, extended the testcase to
also cover Cygwin and MinGW-w64, retested it and applied it.  Thanks, guys,
and Kai too, for digging up this lost patch.

    cheers,
      DaveK

Index: pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.118
diff -p -u -r1.118 pe-dll.c
--- pe-dll.c	4 May 2009 12:09:30 -0000	1.118
+++ pe-dll.c	17 May 2009 05:07:21 -0000
@@ -720,6 +720,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: ChangeLog
===================================================================
RCS file: /cvs/src/src/ld/ChangeLog,v
retrieving revision 1.1985
diff -p -u -r1.1985 ChangeLog
--- ChangeLog	15 May 2009 14:22:34 -0000	1.1985
+++ ChangeLog	17 May 2009 05:07:21 -0000
@@ -1,3 +1,9 @@
+2009-05-17  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+  2008-08-07  Aaron W. LaFramboise  <aaron98wiridge9@aaronwl.com>
+
+	* pe-dll.c (process_def_file): Do not create empty export table.
+
 2009-05-15  Alan Modra  <amodra@bigpond.net.au>
 
 	* ldlang.c (lang_output_section_statement_lookup): Add function
Index: testsuite/ld-pe/exports.d
===================================================================
RCS file: testsuite/ld-pe/exports.d
diff -N testsuite/ld-pe/exports.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/ld-pe/exports.d	17 May 2009 05:07:21 -0000
@@ -0,0 +1,4 @@
+#...
+The Data Directory
+Entry 0 00000000 00000000 Export Directory \[\.edata \(or where ever we found it\)\]
+#...
Index: testsuite/ld-pe/exports.s
===================================================================
RCS file: testsuite/ld-pe/exports.s
diff -N testsuite/ld-pe/exports.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/ld-pe/exports.s	17 May 2009 05:07:21 -0000
@@ -0,0 +1,2 @@
+# Deliberately left empty.
+
Index: testsuite/ld-pe/exports64.d
===================================================================
RCS file: testsuite/ld-pe/exports64.d
diff -N testsuite/ld-pe/exports64.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/ld-pe/exports64.d	17 May 2009 05:07:21 -0000
@@ -0,0 +1,4 @@
+#...
+The Data Directory
+Entry 0 0000000000000000 00000000 Export Directory \[\.edata \(or where ever we found it\)\]
+#...
Index: testsuite/ld-pe/pe.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-pe/pe.exp,v
retrieving revision 1.11
diff -p -u -r1.11 pe.exp
--- testsuite/ld-pe/pe.exp	15 May 2009 14:22:36 -0000	1.11
+++ testsuite/ld-pe/pe.exp	17 May 2009 05:07:21 -0000
@@ -35,17 +35,23 @@ if {[istarget i*86-*-cygwin*]
     if {[istarget x86_64-*-mingw*] } {
       set pe_tests {
 	{".secrel32" "" "" {secrel1.s secrel2.s}
-	{{objdump -s secrel_64.d}} "secrel.x"}
+	 {{objdump -s secrel_64.d}} "secrel.x"}
+	{"Empty export table" "" "" "exports.s"
+	 {{objdump -p exports64.d}} "exports.dll"}
       }
     } elseif {[istarget i*86-*-cygwin*] } {
       set pe_tests {
 	{".secrel32" "--disable-auto-import" "" {secrel1.s secrel2.s}
 	 {{objdump -s secrel.d}} "secrel.x"}
+	{"Empty export table" "" "" "exports.s"
+	 {{objdump -p exports.d}} "exports.dll"}
       }
     } else {
       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: testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ChangeLog,v
retrieving revision 1.1095
diff -p -u -r1.1095 ChangeLog
--- testsuite/ChangeLog	16 May 2009 01:56:44 -0000	1.1095
+++ testsuite/ChangeLog	17 May 2009 05:07:21 -0000
@@ -1,3 +1,11 @@
+2009-05-17  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+  2008-08-07  Aaron W. LaFramboise  <aaron98wiridge9@aaronwl.com>
+
+	* ld-pe/exports.d: New file.
+	* ld-pe/exports.s: New file.
+	* ld-pe/pe.exp: New test for empty export table.
+
 2009-05-16  Alan Modra  <amodra@bigpond.net.au>
 
 	* ld-elf/orphan3.d, * ld-elf/orphan3a.s, * ld-elf/orphan3b.s,

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