From 8b747e1a27742bcf9075999a49cf6ed7408e0a31 Mon Sep 17 00:00:00 2001 From: Dave Korn Date: Thu, 2 Apr 2009 14:42:41 +0000 Subject: [PATCH] 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. --- ld/ChangeLog | 8 ++++++++ ld/emultempl/pe.em | 6 ++++++ ld/emultempl/pep.em | 6 ++++++ ld/ld.texinfo | 4 ++++ ld/testsuite/ChangeLog | 7 +++++++ ld/testsuite/ld-pe/export_dynamic_warning.d | 5 +++++ ld/testsuite/ld-pe/export_dynamic_warning.s | 5 +++++ ld/testsuite/ld-pe/pe.exp | 1 + 8 files changed, 42 insertions(+) create mode 100644 ld/testsuite/ld-pe/export_dynamic_warning.d create mode 100755 ld/testsuite/ld-pe/export_dynamic_warning.s diff --git a/ld/ChangeLog b/ld/ChangeLog index 378e85557c..0d4e0159b5 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2009-04-02 Dave Korn + + 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. + 2009-04-01 Richard Sandiford * emultempl/aix.em (gld${EMULATION_NAME}_open_dynamic_archive): New diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 04d7229524..2bfd5faf73 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -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, diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index ee4eeeb744..9c79e5acfd 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -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, diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 32e8783be8..b6f0a0b00a 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -510,6 +510,10 @@ You can also use the dynamic list to control what symbols should 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 diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 60ed315a24..7290e1b2b6 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2009-04-02 Dave Korn + + 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. + 2009-04-02 Christophe Lyon * ld-arm/farcall-thumb-thumb-pic-veneer.d: Update expected diff --git a/ld/testsuite/ld-pe/export_dynamic_warning.d b/ld/testsuite/ld-pe/export_dynamic_warning.d new file mode 100644 index 0000000000..57cecb6aa5 --- /dev/null +++ b/ld/testsuite/ld-pe/export_dynamic_warning.d @@ -0,0 +1,5 @@ +#name: PE-COFF --export-dynamic warning +#target: *-*-mingw32 *-*-cygwin *-*-pe +#ld: --export-dynamic +#warning: warning: --export-dynamic is not supported for PE targets, did you mean --export-all-symbols? + diff --git a/ld/testsuite/ld-pe/export_dynamic_warning.s b/ld/testsuite/ld-pe/export_dynamic_warning.s new file mode 100755 index 0000000000..e221c36100 --- /dev/null +++ b/ld/testsuite/ld-pe/export_dynamic_warning.s @@ -0,0 +1,5 @@ + +_start: + xor %eax,%eax + ret + diff --git a/ld/testsuite/ld-pe/pe.exp b/ld/testsuite/ld-pe/pe.exp index f489e89d93..2aa4d20f24 100644 --- a/ld/testsuite/ld-pe/pe.exp +++ b/ld/testsuite/ld-pe/pe.exp @@ -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" -- 2.34.1