From 41f46ed9fea1a066de95b6a85c56393beef0b8b8 Mon Sep 17 00:00:00 2001 From: Senthil Kumar Selvaraj Date: Fri, 18 Mar 2016 09:51:47 +0000 Subject: Fix possible failure in the AVR linker tests. * ld-avr/gc-section-debugline.d: Relax regex check for CU. --- ld/testsuite/ld-avr/gc-section-debugline.d | 2 +- ld/testsuite/ld-pe/pe.exp | 14 ++++++++++++++ ld/testsuite/ld-pe/pr19803.d | 17 +++++++++++++++++ ld/testsuite/ld-pe/pr19803.e | 3 +++ ld/testsuite/ld-pe/pr19803.s | 14 ++++++++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 ld/testsuite/ld-pe/pr19803.d create mode 100644 ld/testsuite/ld-pe/pr19803.e create mode 100644 ld/testsuite/ld-pe/pr19803.s (limited to 'ld/testsuite') diff --git a/ld/testsuite/ld-avr/gc-section-debugline.d b/ld/testsuite/ld-avr/gc-section-debugline.d index e98ff6c..f8c07de 100644 --- a/ld/testsuite/ld-avr/gc-section-debugline.d +++ b/ld/testsuite/ld-avr/gc-section-debugline.d @@ -9,7 +9,7 @@ Decoded dump of debug contents of section .debug_line: -CU: .*: +.*: File name Line number Starting address per-function-debugline.s 39 0 diff --git a/ld/testsuite/ld-pe/pe.exp b/ld/testsuite/ld-pe/pe.exp index 622caed..a31f6e7 100644 --- a/ld/testsuite/ld-pe/pe.exp +++ b/ld/testsuite/ld-pe/pe.exp @@ -76,6 +76,20 @@ run_dump_test "longsecn-5" run_dump_test "orphan" run_dump_test "orphan_nu" +run_dump_test "pr19803" +set pr19803_dll { + { "PR 19803: not exporting swept symbols" + "-shared --out-implib dx.dll --gc-sections" + "" "" {pr19803.s} + {{objdump "--syms dx.dll" pr19803.e}} + "a.exe"} +} +# This test is *supposed* to fail. If the symbol defined in pr19803.e is +# found then it was not stripped from the export dll, despite the fact that +# it (should have been) garbage collected from the executable. +setup_xfail *-*-* +run_ld_link_tests $pr19803_dll + if {[istarget x86_64-*-mingw*] } { run_dump_test "cfi" } elseif {[istarget i*86-*-cygwin*] || [istarget i*86-*-mingw*] } { diff --git a/ld/testsuite/ld-pe/pr19803.d b/ld/testsuite/ld-pe/pr19803.d new file mode 100644 index 0000000..1fc6daf --- /dev/null +++ b/ld/testsuite/ld-pe/pr19803.d @@ -0,0 +1,17 @@ +#ld: -shared --out-implib dx.dll.a --gc-sections +#objdump: --syms +#notarget: mcore-* arm-epoc-pe +# +# Check that the target specific entry symbol _DllMainCRTStartup is still +# a defined (sec > 0), public (scl == 2) symbol, even after garbage +# collection. +# +# Check that the symbol _testval is undefined (sec == 0) and hidden +# (scl == 106) in the output. It should have been changed to this state when +# garbage collection was performed. + +#... +.*\(sec 0\)\(fl 0x00\)\(ty 0\)\(scl 106\) \(nx 0\) 0x0+000 _testval +#... +.*\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 2\) \(nx 0\) 0x0+000 .*Startup.* +#pass diff --git a/ld/testsuite/ld-pe/pr19803.e b/ld/testsuite/ld-pe/pr19803.e new file mode 100644 index 0000000..a2f8162 --- /dev/null +++ b/ld/testsuite/ld-pe/pr19803.e @@ -0,0 +1,3 @@ +#... +.*__imp__testval +#pass diff --git a/ld/testsuite/ld-pe/pr19803.s b/ld/testsuite/ld-pe/pr19803.s new file mode 100644 index 0000000..290a698 --- /dev/null +++ b/ld/testsuite/ld-pe/pr19803.s @@ -0,0 +1,14 @@ + .text + .globl "_DllMainCRTStartup@12" +"_DllMainCRTStartup@12": + .globl _DllMainCRTStartup +_DllMainCRTStartup: + .globl DllMainCRTStartup +DllMainCRTStartup: + nop + + .section .rdata,"dr" + .globl _testval +_testval: + .long 1 + .long 2 -- cgit v1.1