From 177b81d66a6cf42aaa2b15ccc499bb7b292c3955 Mon Sep 17 00:00:00 2001 From: Dave Korn Date: Sun, 17 May 2009 05:10:21 +0000 Subject: [PATCH] Committed on behalf of 2008-08-07 Aaron W. LaFramboise ld/ChangeLog: * pe-dll.c (process_def_file): Do not create empty export table. ld/testsuite/ChangeLog: * ld-pe/exports.d: New file. * ld-pe/exports.s: New file. * ld-pe/pe.exp: New test for empty export table. --- ld/ChangeLog | 6 ++++++ ld/pe-dll.c | 4 ++++ ld/testsuite/ChangeLog | 8 ++++++++ ld/testsuite/ld-pe/exports.d | 4 ++++ ld/testsuite/ld-pe/exports.s | 2 ++ ld/testsuite/ld-pe/exports64.d | 4 ++++ ld/testsuite/ld-pe/pe.exp | 8 +++++++- 7 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 ld/testsuite/ld-pe/exports.d create mode 100644 ld/testsuite/ld-pe/exports.s create mode 100755 ld/testsuite/ld-pe/exports64.d diff --git a/ld/ChangeLog b/ld/ChangeLog index 01323e0bae6..52364ef83bd 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2009-05-17 Dave Korn + + 2008-08-07 Aaron W. LaFramboise + + * pe-dll.c (process_def_file): Do not create empty export table. + 2009-05-15 Alan Modra * ldlang.c (lang_output_section_statement_lookup): Add function diff --git a/ld/pe-dll.c b/ld/pe-dll.c index b5470c5c75b..3f2815e37af 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -720,6 +720,10 @@ process_def_file (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) #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) { diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 839a40393f8..4aef6b764da 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2009-05-17 Dave Korn + + 2008-08-07 Aaron W. LaFramboise + + * 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 * ld-elf/orphan3.d, * ld-elf/orphan3a.s, * ld-elf/orphan3b.s, diff --git a/ld/testsuite/ld-pe/exports.d b/ld/testsuite/ld-pe/exports.d new file mode 100644 index 00000000000..bbeda11d891 --- /dev/null +++ b/ld/testsuite/ld-pe/exports.d @@ -0,0 +1,4 @@ +#... +The Data Directory +Entry 0 00000000 00000000 Export Directory \[\.edata \(or where ever we found it\)\] +#... diff --git a/ld/testsuite/ld-pe/exports.s b/ld/testsuite/ld-pe/exports.s new file mode 100644 index 00000000000..aac7075e7b4 --- /dev/null +++ b/ld/testsuite/ld-pe/exports.s @@ -0,0 +1,2 @@ +# Deliberately left empty. + diff --git a/ld/testsuite/ld-pe/exports64.d b/ld/testsuite/ld-pe/exports64.d new file mode 100755 index 00000000000..5fc5aeb15db --- /dev/null +++ b/ld/testsuite/ld-pe/exports64.d @@ -0,0 +1,4 @@ +#... +The Data Directory +Entry 0 0000000000000000 00000000 Export Directory \[\.edata \(or where ever we found it\)\] +#... diff --git a/ld/testsuite/ld-pe/pe.exp b/ld/testsuite/ld-pe/pe.exp index 3cff6b4ebc9..ad91f06c44c 100644 --- a/ld/testsuite/ld-pe/pe.exp +++ b/ld/testsuite/ld-pe/pe.exp @@ -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"} } } -- 2.30.2