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] Fix PR6744 (--export-dynamic not supported on PE)


Dave Korn wrote:

>   I'll follow up with a testcase shortly.  

  Updated patch attached; contains testcase, plus a minor tweak to the wording
of the docs.


ld/ChangeLog

	PR ld/6744
	* ld.texinfo (--export-dynamic):  Mention --export-all-symbols.
	* emultempl/pe.em (gld_${EMULATION_NAME}_after_parse):  Issue
	warning if --export-dynamic was passed on command-line.
	* emultempl/pep.em (gld_${EMULATION_NAME}_after_parse):  Likewise.

ld/testsuite/ChangeLog

	PR ld/6744
	* ld-pe/export_dynamic_warning.d:  New test control file.
	* ld-pe/export_dynamic_warning.s:  New test source file.
	* ld-pe/pe.exp:  Also run export_dynamic_warning dump test.

  Ok?

    cheers,
      DaveK
Index: ld/ld.texinfo
===================================================================
RCS file: /cvs/src/src/ld/ld.texinfo,v
retrieving revision 1.236
diff -p -u -r1.236 ld.texinfo
--- ld/ld.texinfo	14 Mar 2009 03:30:25 -0000	1.236
+++ ld/ld.texinfo	2 Apr 2009 05:10:26 -0000
@@ -510,6 +510,10 @@ You can also use the dynamic list to con
 be added to the dynamic symbol table if the output format supports it.
 See the description of @samp{--dynamic-list}.
 
+Note that this option is specific to ELF targeted ports.  PE targets
+support a similar function to export all symbols from a DLL or EXE; see
+the description of @samp{--export-all-symbols} below.
+
 @ifclear SingleFormat
 @cindex big-endian objects
 @cindex endianness
Index: ld/emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.147
diff -p -u -r1.147 pe.em
--- ld/emultempl/pe.em	14 Mar 2009 03:30:26 -0000	1.147
+++ ld/emultempl/pe.em	2 Apr 2009 05:10:27 -0000
@@ -887,6 +887,12 @@ gld_${EMULATION_NAME}_after_parse (void)
 
   if (! link_info.relocatable && entry_symbol.name != NULL)
     ldlang_add_undef (entry_symbol.name);
+
+  /* PR ld/6744:  Warn the user if they have used an ELF-only
+     option hoping it will work on PE.  */
+  if (link_info.export_dynamic)
+    einfo (_("%P: warning: --export-dynamic is not supported for PE "
+      "targets, did you mean --export-all-symbols?\n"));
 }
 
 /* pe-dll.c directly accesses pe_data_import_dll,
Index: ld/emultempl/pep.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pep.em,v
retrieving revision 1.24
diff -p -u -r1.24 pep.em
--- ld/emultempl/pep.em	14 Mar 2009 03:30:26 -0000	1.24
+++ ld/emultempl/pep.em	2 Apr 2009 05:10:27 -0000
@@ -824,6 +824,12 @@ gld_${EMULATION_NAME}_after_parse (void)
 
   if (! link_info.relocatable && entry_symbol.name != NULL)
     ldlang_add_undef (entry_symbol.name);
+
+  /* PR ld/6744:  Warn the user if they have used an ELF-only
+     option hoping it will work on PE+.  */
+  if (link_info.export_dynamic)
+    einfo (_("%P: warning: --export-dynamic is not supported for PE+ "
+      "targets, did you mean --export-all-symbols?\n"));
 }
 
 /* pep-dll.c directly accesses pep_data_import_dll,
Index: ld/testsuite/ld-pe/export_dynamic_warning.d
===================================================================
RCS file: ld/testsuite/ld-pe/export_dynamic_warning.d
diff -N ld/testsuite/ld-pe/export_dynamic_warning.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-pe/export_dynamic_warning.d	2 Apr 2009 05:10:28 -0000
@@ -0,0 +1,4 @@
+#name: PE-COFF --export-dynamic warning
+#ld: --export-dynamic
+#warning: warning: --export-dynamic is not supported for PE targets, did you mean --export-all-symbols?
+
Index: ld/testsuite/ld-pe/export_dynamic_warning.s
===================================================================
RCS file: ld/testsuite/ld-pe/export_dynamic_warning.s
diff -N ld/testsuite/ld-pe/export_dynamic_warning.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-pe/export_dynamic_warning.s	2 Apr 2009 05:10:28 -0000
@@ -0,0 +1,5 @@
+
+_start:
+	xor	%eax,%eax
+	ret
+
Index: ld/testsuite/ld-pe/pe.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-pe/pe.exp,v
retrieving revision 1.9
diff -p -u -r1.9 pe.exp
--- ld/testsuite/ld-pe/pe.exp	27 Feb 2009 19:01:56 -0000	1.9
+++ ld/testsuite/ld-pe/pe.exp	2 Apr 2009 05:10:28 -0000
@@ -49,3 +49,4 @@ if {[istarget x86_64-*-mingw*] } {
 run_ld_link_tests $pe_tests
 
 run_dump_test "image_size"
+run_dump_test "export_dynamic_warning"

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