Add R_386_GOT32X support to gas and ld
[deliverable/binutils-gdb.git] / ld / testsuite / ld-i386 / i386.exp
index 3fdd39ca20ba93a91673505acd5b4c9c2676d13a..3d28dcc08fa92617fd537511c72d6fd715929d73 100644 (file)
@@ -215,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"
@@ -236,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"
@@ -253,6 +293,19 @@ run_dump_test "lea1e"
 run_dump_test "lea1f"
 run_dump_test "mov1a"
 run_dump_test "mov1b"
+run_dump_test "branch1"
+run_dump_test "call1"
+run_dump_test "call2"
+run_dump_test "jmp1"
+run_dump_test "jmp2"
+run_dump_test "load1"
+run_dump_test "load2"
+run_dump_test "load3"
+run_dump_test "load4a"
+run_dump_test "load4b"
+run_dump_test "load5a"
+run_dump_test "load5b"
+run_dump_test "load6"
 
 if { !([istarget "i?86-*-linux*"]
        || [istarget "i?86-*-gnu*"]
@@ -269,6 +322,11 @@ run_dump_test "pr14215"
 run_dump_test "pr17057"
 run_dump_test "pr17935-1"
 run_dump_test "pr17935-2"
+run_dump_test "pr18801"
+run_dump_test "pr18815"
+
+# Add $PLT_CFLAGS if PLT is expected.
+global PLT_CFLAGS
 
 # Must be Linux native with the C compiler
 if { [isnative]
@@ -302,7 +360,7 @@ if { [isnative]
        [list \
            "Build libplt-main3.a" \
            "" \
-           "-fPIC" \
+           "-fPIC $PLT_CFLAGS" \
            { plt-main3.c } \
            {{readelf {-Wr} plt-main3.rd}} \
            "libplt-main3.a" \
@@ -310,7 +368,7 @@ if { [isnative]
        [list \
            "Build libplt-main4.a" \
            "" \
-           "-fPIC" \
+           "-fPIC $PLT_CFLAGS" \
            { plt-main4.c } \
            {{readelf {-Wr} plt-main4.rd}} \
            "libplt-main4.a" \
@@ -333,6 +391,142 @@ 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" \
+       ] \
+       [list \
+           "Build pr18900.so" \
+           "-shared" \
+           "-fPIC" \
+           { pr18900a.c } \
+           "" \
+           "pr18900.so" \
+       ] \
+       [list \
+           "Build pr18900a" \
+           "tmpdir/pr18900.so" \
+           "" \
+           { pr18900b.c pr18900c.c } \
+           {{readelf {-Wrd} pr18900a.rd}} \
+           "pr18900a" \
+       ] \
+       [list \
+           "Build pr18900b" \
+           "tmpdir/pr18900.so" \
+           "" \
+           { pr18900b.c pr18900c.c } \
+           {{readelf {-Wrd} pr18900b.rd}} \
+           "pr18900b" \
+       ] \
+       [list \
+           "Build pr19031.so" \
+           "-shared" \
+           "-fPIC" \
+           { pr19031a.c } \
+           "" \
+           "pr19031.so" \
+       ] \
+       [list \
+           "Build got1d.so" \
+           "-shared" \
+           "" \
+           { got1d.S } \
+           "" \
+           "got1d.so" \
+       ] \
+       [list \
+           "Build gotpc1" \
+           "tmpdir/got1d.so" \
+           "" \
+           { got1a.S got1b.c got1c.c } \
+           {{objdump {-dw} got1.dd}} \
+           "got1" \
+       ] \
     ]
 
     run_ld_link_exec_tests [] [list \
@@ -355,5 +549,70 @@ 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" \
+       ] \
+       [list \
+           "Run pr18900" \
+           "tmpdir/pr18900.so" \
+           "" \
+           { pr18900b.c pr18900c.c } \
+           "pr18900" \
+           "pr18900.out" \
+       ] \
+       [list \
+           "Run pr19031" \
+           "tmpdir/pr19031.so" \
+           "" \
+           { pr19031b.S pr19031c.c } \
+           "pr19031" \
+           "pr19031.out" \
+       ] \
+       [list \
+           "Run got1" \
+           "tmpdir/got1d.so" \
+           "" \
+           { got1a.S got1b.c got1c.c } \
+           "got1" \
+           "got1.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.029381 seconds and 4 git commands to generate.