This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Fix PR6744 (--export-dynamic not supported on PE)
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 02 Apr 2009 04:46:09 +0100
- Subject: [PATCH] Fix PR6744 (--export-dynamic not supported on PE)
Hi all,
As suggested in PR6744, it would be helpful to make clearer that
--export-dynamic is not the way to get all your symbols exported from a shared
object on PE targets. The attached patch enhances the documentation for
--export-dynamic to refer readers to --export-all-symbols, and updates the PE
and PE+ emulations to issue a warning if --export-dynamic is given on the
command-line, as suggested there.
Tested on i686-pc-cygwin, natively and crossed to i686-pc-mingw32 and
x86_64-pc-mingw32 with no regressions, and eyeballed the info pages to ensure
the docs built right.
I'll follow up with a testcase shortly. Ok for HEAD?
ld/ChangeLog
* 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.
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 1 Apr 2009 18:08:43 -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; 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 1 Apr 2009 18:08:44 -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 1 Apr 2009 18:08:44 -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,