diff options
author | Tristan Gingold <gingold@adacore.com> | 2017-03-31 15:25:18 +0200 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2017-04-07 10:03:17 +0200 |
commit | 1fd6d111905e76dfa7af9fbee5229f3f1d360b4c (patch) | |
tree | cb8f9e966484f2911a9ef1f3d0df62d338701922 /ld | |
parent | 436252de3e9de546001c4312d0863ce7e10aa200 (diff) | |
download | fsf-binutils-gdb-1fd6d111905e76dfa7af9fbee5229f3f1d360b4c.zip fsf-binutils-gdb-1fd6d111905e76dfa7af9fbee5229f3f1d360b4c.tar.gz fsf-binutils-gdb-1fd6d111905e76dfa7af9fbee5229f3f1d360b4c.tar.bz2 |
pe/coff: handle weak defined symbol for gc-sections.
bfd/
* coffgen.c (_bfd_coff_gc_mark_hook): Handle PE weak
external symbols with a definition.
(_bfd_coff_gc_mark_extra_sections): Fix typo.
ld/
* testsuite/ld-pe/pe.exp: New test.
* testsuite/ld-pe/weakdef-1.s: New test source.
* testsuite/ld-pe/weakdef-1.d: New test.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-pe/pe.exp | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-pe/weakdef-1.d | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-pe/weakdef-1.s | 19 |
4 files changed, 35 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 1bd90a2..1d2f43b 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2017-04-07 gingold <gingold@gingold-Precision-7510> + + * testsuite/ld-pe/pe.exp: New test. + * testsuite/ld-pe/weakdef-1.s: New test source. + * testsuite/ld-pe/weakdef-1.d: New test. + 2017-04-07 Alan Modra <amodra@gmail.com> * testsuite/ld-elf/mbind1a.d: Remove matches for PT_LOAD segments. diff --git a/ld/testsuite/ld-pe/pe.exp b/ld/testsuite/ld-pe/pe.exp index 8d20056..b69f36a 100644 --- a/ld/testsuite/ld-pe/pe.exp +++ b/ld/testsuite/ld-pe/pe.exp @@ -76,6 +76,8 @@ run_dump_test "longsecn-5" run_dump_test "orphan" run_dump_test "orphan_nu" +run_dump_test "weakdef-1" + run_dump_test "pr19803" set pr19803_dll { { "PR 19803: not exporting swept symbols" diff --git a/ld/testsuite/ld-pe/weakdef-1.d b/ld/testsuite/ld-pe/weakdef-1.d new file mode 100644 index 0000000..57a8565 --- /dev/null +++ b/ld/testsuite/ld-pe/weakdef-1.d @@ -0,0 +1,8 @@ +#source: weakdef-1.s +#target: i*86-*-cygwin* i*86-*-pe i*86-*-mingw* +#ld: -e _start --gc-sections +#objdump: -d + +#... + 401003: a1 00 20 40 00 mov 0x402000,%eax +#pass diff --git a/ld/testsuite/ld-pe/weakdef-1.s b/ld/testsuite/ld-pe/weakdef-1.s new file mode 100644 index 0000000..ddce4fb --- /dev/null +++ b/ld/testsuite/ld-pe/weakdef-1.s @@ -0,0 +1,19 @@ + .weak _wsym + .section .data$wsym,"w" + .align 4 +_wsym: + .long 1 + + .section .text$start,"x" + .globl _start + .def _start; .scl 2; .type 32; .endef +_start: + pushl %ebp + movl %esp, %ebp + movl _wsym, %eax + testl %eax, %eax + sete %al + movzbl %al, %eax + nop + popl %ebp + ret |