Add $PLT_CFLAGS to -fPIC for run_cc_link_tests
[deliverable/binutils-gdb.git] / ld / testsuite / ld-i386 / i386.exp
index 4fc2359879977c8ba8d4a5ffb99afbd276e719d4..0dbdd1e06e054f635920ac0bbec11d5b5d46ca67 100644 (file)
@@ -191,6 +191,10 @@ set i386tests {
      "--32" {pr17306b.s} {} ""}
     {"PR ld/17306 (2)" "-melf_i386 -shared -Bsymbolic --just-symbols=tmpdir/pr17306b.o" ""
      "--32" {pr17306a.s} {} "libpr17306.so"}
+    {"PR ld/17709 (1)" "-melf_i386 -shared" ""
+     "--32" {pr17709a.s} {} "libpr17709.so"}
+    {"PR ld/17709 (2)" "-melf_i386 tmpdir/libpr17709.so" ""
+     "--32" {pr17709b.s} {{readelf -r pr17709.rd}} "pr17709"}
 }
 
 # So as to avoid rewriting every last test case here in a nacl variant,
@@ -211,6 +215,44 @@ if [istarget "*-*-nacl*"] {
     regsub -all -- {([a-z0-9]+)\.pd} $i386tests {\1-nacl.pd} i386tests
 }
 
+proc iamcu_tests {} {
+    if {[istarget "*-*-nacl*"]} then {
+       return
+    }
+
+    global as
+    global srcdir
+    global subdir
+
+    if ![ld_assemble $as "--32 -march=iamcu $srcdir/$subdir/start.s" tmpdir/startiamcu.o] {
+       unresolved "Build Intel MCU start.o"
+       return
+    }
+
+    if ![ld_assemble $as "--32 $srcdir/$subdir/start.s" tmpdir/start32.o] {
+       unresolved "Build ia32 start.o"
+       return
+     }
+
+    if ![ld_assemble $as "--32 -march=iamcu $srcdir/$subdir/foo.s" tmpdir/fooiamcu.o] {
+       unresolved "Build Intel MCU foo.o"
+       return
+    }
+
+    if ![ld_assemble $as "--32 $srcdir/$subdir/foo.s" tmpdir/foo32.o] {
+       unresolved "Build ia32 foo.o"
+       return
+    }
+
+    run_dump_test "abs-iamcu"
+    run_dump_test "iamcu-1"
+    run_dump_test "iamcu-2"
+    run_dump_test "iamcu-3"
+    run_dump_test "iamcu-4"
+}
+
+iamcu_tests
+
 run_ld_link_tests $i386tests
 
 run_dump_test "abs"
@@ -232,6 +274,8 @@ run_dump_test "protected2"
 run_dump_test "protected3"
 run_dump_test "protected4"
 run_dump_test "protected5"
+run_dump_test "protected6a"
+run_dump_test "protected6b"
 run_dump_test "tlspie1"
 run_dump_test "tlspie2"
 run_dump_test "nogot1"
@@ -266,6 +310,9 @@ run_dump_test "pr17057"
 run_dump_test "pr17935-1"
 run_dump_test "pr17935-2"
 
+# Add $PLT_CFLAGS if PLT is expected.
+global PLT_CFLAGS
+
 # Must be Linux native with the C compiler
 if { [isnative]
      && [istarget "i?86-*-linux*"]
@@ -298,7 +345,7 @@ if { [isnative]
        [list \
            "Build libplt-main3.a" \
            "" \
-           "-fPIC" \
+           "-fPIC $PLT_CFLAGS" \
            { plt-main3.c } \
            {{readelf {-Wr} plt-main3.rd}} \
            "libplt-main3.a" \
@@ -306,7 +353,7 @@ if { [isnative]
        [list \
            "Build libplt-main4.a" \
            "" \
-           "-fPIC" \
+           "-fPIC $PLT_CFLAGS" \
            { plt-main4.c } \
            {{readelf {-Wr} plt-main4.rd}} \
            "libplt-main4.a" \
@@ -329,6 +376,94 @@ if { [isnative]
            {{readelf {-Wr} plt-main.rd}} \
            "plt-main" \
        ] \
+       [list \
+           "Build copyreloc-lib.so" \
+           "-shared" \
+           "-fPIC" \
+           { copyreloc-lib.c } \
+           {} \
+           "copyreloc-lib.so" \
+       ] \
+       [list \
+           "Build copyreloc-main with PIE and GOTOFF (1)" \
+           "tmpdir/copyreloc-lib.so -pie" \
+           "" \
+           { copyreloc-main.S } \
+           {{readelf {-Wr} copyreloc-main1.rd}} \
+           "copyreloc-main" \
+       ] \
+       [list \
+           "Build copyreloc-main with PIE and GOTOFF (2)" \
+           "tmpdir/copyreloc-lib.so -pie" \
+           "" \
+           { copyreloc-main.S } \
+           {{readelf {-Wr} copyreloc-main2.rd}} \
+           "copyreloc-main" \
+       ] \
+       [list \
+           "Build pr17689.so" \
+           "-shared" \
+           "-fPIC" \
+           { pr17689a.c } \
+           {} \
+           "pr17689.so" \
+       ] \
+       [list \
+           "Build pr17689.so with -z now" \
+           "-shared -Wl,-z,now" \
+           "-fPIC" \
+           { pr17689a.c } \
+           {{readelf {-Wr} pr17689now.rd}} \
+           "pr17689now.so" \
+       ] \
+       [list \
+           "Build pr17689ver.so" \
+           "-shared -Wl,--version-script,pr17689a.t" \
+           "-fPIC" \
+           { pr17689a.c } \
+           {} \
+           "pr17689ver.so" \
+       ] \
+       [list \
+           "Build pr17689.a" \
+           "" \
+           "" \
+           { pr17689b.S } \
+           {} \
+           "pr17689.a" \
+       ] \
+       [list \
+           "Build pr17689 with PIE and GOTOFF" \
+           "tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \
+           "" \
+           { dummy.c } \
+           {{readelf {-Wr} pr17689.rd}} \
+           "pr17689" \
+       ] \
+       [list \
+           "Build pr17689 with PIE, -z now and GOTOFF" \
+           "tmpdir/pr17689b.o tmpdir/pr17689.so -pie -Wl,-z,now" \
+           "" \
+           { dummy.c } \
+           {{readelf {-Wr} pr17689now.rd}} \
+           "pr17689now" \
+       ] \
+       [list \
+           "Build pr17689ver with PIE and GOTOFF" \
+           "tmpdir/pr17689b.o tmpdir/pr17689ver.so -pie" \
+           "" \
+           { dummy.c } \
+           {{readelf {-Wr} pr17689ver.rd}} \
+           "pr17689ver" \
+       ] \
+       [list \
+           "Build pr17827 with PIE and GOTOFF" \
+           "tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \
+           "" \
+           { dummy.c } \
+           {{readelf {-Wr} pr17827.rd}} \
+           "pr17827" \
+       ] \
     ]
 
     run_ld_link_exec_tests [] [list \
@@ -351,5 +486,46 @@ if { [isnative]
            "plt-main.out" \
            "-fPIC" \
        ] \
+       [list \
+           "Run copyreloc-main with PIE and GOTOFF" \
+           "tmpdir/copyreloc-lib.so -pie" \
+           "" \
+           { copyreloc-main.S } \
+           "copyreloc-main" \
+           "copyreloc-main.out" \
+       ] \
+       [list \
+           "Run pr17689 with PIE and GOTOFF" \
+           "tmpdir/pr17689b.o tmpdir/pr17689.so -pie" \
+           "" \
+           { dummy.c } \
+           "pr17689" \
+           "pr17689.out" \
+       ] \
+       [list \
+           "Run pr17689 with PIE, -z now and GOTOFF" \
+           "tmpdir/pr17689b.o tmpdir/pr17689.so -pie -z now" \
+           "" \
+           { dummy.c } \
+           "pr17689now" \
+           "pr17689.out" \
+       ] \
+       [list \
+           "Run pr17689ver with PIE and GOTOFF" \
+           "tmpdir/pr17689b.o tmpdir/pr17689ver.so -pie" \
+           "" \
+           { dummy.c } \
+           "pr17689ver" \
+           "pr17689.out" \
+       ] \
     ]
 }
+
+if { !([istarget "i?86-*-linux*"]
+       || [istarget "x86_64-*-linux*"]) } {
+    return
+}
+
+# Linux only tests
+run_dump_test "pltgot-1"
+run_dump_test "pltgot-2"
This page took 0.027147 seconds and 4 git commands to generate.