diff options
Diffstat (limited to 'ld/testsuite/ld-x86-64/x86-64.exp')
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 7248377..214b08b 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -355,6 +355,82 @@ run_dump_test "pr19162" run_dump_test "pr19175" run_dump_test "pr18591" run_dump_test "pr19615" +run_dump_test "pr19636-1a" +run_dump_test "pr19636-1b" +run_dump_test "pr19636-1c" +run_dump_test "pr19636-1d" +run_dump_test "pr19636-1e" +run_dump_test "pr19636-1f" +run_dump_test "pr19636-1g" +run_dump_test "pr19636-2a" +run_dump_test "pr19636-2b" +run_dump_test "pr19636-2c" +run_dump_test "pr19636-2d" +run_dump_test "pr19636-2d-nacl" +run_dump_test "pr19636-2e" +run_dump_test "pr19636-2f" +run_dump_test "pr19636-2g" +run_dump_test "pr19636-2h" +run_dump_test "pr19636-2i" +run_dump_test "pr19636-3a" +run_dump_test "pr19636-3b" +run_dump_test "pr19636-3c" + +proc undefined_weak {cflags ldflags} { + set testname "Undefined weak symbol" + if { ![ string match "" $cflags$ldflags] } { + set testname "$testname ($cflags $ldflags)" + } + + if { [ regexp "\-fPIE" $cflags] + && ![ regexp "\-z nodynamic-undefined-weak" $ldflags] } { + set weak_symbol "Weak defined" + } else { + set weak_symbol "Weak undefined" + } + + run_cc_link_tests [list \ + [list \ + "Build libpr19704a.so" \ + "-shared -Wl,-soname,libpr19704.so" \ + "" \ + { dummy.s } \ + {} \ + "libpr19704a.so" \ + ] \ + [list \ + "Build libpr19704b.so" \ + "-shared -Wl,-soname,libpr19704.so" \ + "-fPIC" \ + { pr19704b.c } \ + {} \ + "libpr19704b.so" \ + ] \ + ] + + exec cp tmpdir/libpr19704a.so tmpdir/libpr19704.so + + run_ld_link_exec_tests [] [list \ + [list \ + "Run pr19704" \ + "$ldflags tmpdir/libpr19704.so -R tmpdir" \ + "" \ + { pr19704a.c } \ + "pr19704" \ + "pr19704.out" \ + "$cflags" \ + ] \ + ] + + exec cp tmpdir/libpr19704b.so tmpdir/libpr19704.so + + set exec_output [run_host_cmd tmpdir/pr19704 ""] + if {![string match $weak_symbol $exec_output]} { + fail $testname + } else { + pass $testname + } +} # Add $PLT_CFLAGS if PLT is expected. global PLT_CFLAGS @@ -686,6 +762,12 @@ if { [isnative] && [which $CC] != 0 } { ] \ ] } + + undefined_weak "" "" + undefined_weak "-fPIE" "" + undefined_weak "-fPIE" "-pie" + undefined_weak "-fPIE" "-z nodynamic-undefined-weak" + undefined_weak "-fPIE" "-pie -z nodynamic-undefined-weak" } if { ![istarget "x86_64-*-linux*"]} { |