[x86] Resolve non-PIC undefweak symbols in executable
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / shared.exp
index a8644304cc954064a0ea28d5a786aab11e3576f4..e615f55b95156d82f650be00dba343db10d00956 100644 (file)
@@ -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"
This page took 0.030396 seconds and 4 git commands to generate.