diff options
Diffstat (limited to 'ld/testsuite/ld-elf/shared.exp')
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index a864430..e615f55 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -582,3 +582,63 @@ if { [istarget *-*-linux*] ] \ ] } + +proc mix_pic_and_non_pic {cflags ldflags} { + set testname "Mixing PIC and non-PIC" + if { ![ string match "" $cflags$ldflags] } { + set testname "$testname ($cflags $ldflags)" + } + + run_cc_link_tests [list \ + [list \ + "Build libpr19719a.so" \ + "-shared -Wl,-soname,libpr19719.so" \ + "-fPIC" \ + { pr19719d.c } \ + {} \ + "libpr19719a.so" \ + ] \ + [list \ + "Build libpr19719b.so" \ + "-shared -Wl,-soname,libpr19719.so" \ + "-fPIC" \ + { dummy.c } \ + {} \ + "libpr19719b.so" \ + ] \ + [list \ + "Build pr19073b.o" \ + "-r -nostdlib" \ + "-fPIC" \ + { pr19719b.c } \ + {} \ + "libpr19719b.o" \ + ] \ + ] + + exec cp tmpdir/libpr19719b.so tmpdir/libpr19719.so + + run_ld_link_exec_tests [] [list \ + [list \ + "Run pr19719" \ + "$ldflags tmpdir/libpr19719b.o tmpdir/libpr19719.so -R tmpdir" \ + "" \ + { pr19719a.c pr19719c.c } \ + "pr19719" \ + "pass.out" \ + "$cflags" \ + ] \ + ] + + exec cp tmpdir/libpr19719a.so tmpdir/libpr19719.so + + set exec_output [run_host_cmd tmpdir/pr19719 ""] + if {![string match "PASS" $exec_output]} { + fail $testname + } else { + pass $testname + } +} + +mix_pic_and_non_pic "" "" +mix_pic_and_non_pic "-fPIE" "-pie" |