Disallow copy relocation against protected data symbol
[deliverable/binutils-gdb.git] / ld / testsuite / ld-i386 / i386.exp
index 34f03e04702a516e5363c294824f3034cfe62e3f..bd1561024c5c6976cff35f5a6752bffa25a83273 100644 (file)
@@ -308,6 +308,7 @@ run_dump_test "protected4"
 run_dump_test "protected5"
 run_dump_test "protected6a"
 run_dump_test "protected6b"
+run_dump_test "protected7"
 run_dump_test "tlspie1"
 run_dump_test "tlspie2"
 run_dump_test "tlspie3a"
@@ -438,6 +439,7 @@ run_dump_test "property-x86-shstk5"
 run_dump_test "pie1"
 run_dump_test "pie1-nacl"
 run_dump_test "pr21884"
+run_dump_test "pr21884-nacl"
 
 if { !([istarget "i?86-*-linux*"]
        || [istarget "i?86-*-gnu*"]
@@ -466,8 +468,8 @@ proc undefined_weak {cflags ldflags} {
        set testname "$testname ($cflags $ldflags)"
     }
 
-    if { [ regexp "\-fPIE" $cflags]
-        && ![ regexp "\-z nodynamic-undefined-weak" $ldflags] } {
+    if { [string match "*-fPIE*" $cflags]
+        && ![string match "*-z nodynamic-undefined-weak*" $ldflags] } {
        set weak_symbol "Weak defined"
     } else {
        set weak_symbol "Weak undefined"
@@ -1243,6 +1245,25 @@ if { [isnative]
 if { [isnative]
      && [istarget "i?86-*-*"]
      && [which $CC] != 0 } {
+    run_cc_link_tests [list \
+       [list \
+           "Build pr22001-1.so" \
+           "-shared" \
+           "" \
+           { pr22001-1a.c } \
+           {} \
+           "pr22001-1.so" \
+       ] \
+       [list \
+           "Build pr21997-1.so" \
+           "-shared" \
+           "" \
+           { property-stack.S property-no-copy.S pr21997-1a.S } \
+           {} \
+           "pr21997-1.so" \
+       ] \
+    ]
+
     run_ld_link_exec_tests [list \
        [list \
            "Run weakundef1 without PIE" \
@@ -1253,7 +1274,94 @@ if { [isnative]
            "pass.out" \
            "$NOPIE_CFLAGS" \
        ] \
+       [list \
+           "Run pr22001-1" \
+           "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+           "" \
+           { pr22001-1b.c } \
+           "pr22001-1" \
+           "pass.out" \
+           "$NOPIE_CFLAGS" \
+       ] \
+       [list \
+           "Run pr22001-1 (PIE 1)" \
+           "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+           "" \
+           { pr22001-1c.S } \
+           "pr22001-1-pie-1" \
+           "pass.out" \
+       ] \
+       [list \
+           "Run pr22001-1 (PIE 2)" \
+           "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+           "" \
+           { pr22001-1c.S } \
+           "pr22001-1-pie-2" \
+           "pass.out" \
+       ] \
+       [list \
+           "Run pr22001-1 (PIC 1)" \
+           "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+           "" \
+           { pr22001-1b.c } \
+           "pr22001-1-pic-1" \
+           "pass.out" \
+           "-fPIC" \
+       ] \
+       [list \
+           "Run pr22001-1 (PIC 2)" \
+           "-pie -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \
+           "" \
+           { pr22001-1b.c } \
+           "pr22001-1-pic-2" \
+           "pass.out" \
+           "-fPIC" \
+       ] \
+       [list \
+           "Run pr21997-1" \
+           "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+           "" \
+           { pr21997-1b.c } \
+           "pr21997-1" \
+           "pass.out" \
+           "$NOPIE_CFLAGS" \
+       ] \
+       [list \
+           "Run pr21997-1 (PIC 1)" \
+           "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+           "" \
+           { pr21997-1b.c } \
+           "pr21997-1-pic-1" \
+           "pass.out" \
+           "-fPIC" \
+       ] \
+       [list \
+           "Run pr21997-1 (PIC 2)" \
+           "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+           "" \
+           { pr21997-1b.c } \
+           "pr21997-1-pic-2" \
+           "pass.out" \
+           "-fPIC" \
+       ] \
+       [list \
+           "Run pr21997-1 (PIE 1)" \
+           "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+           "" \
+           { pr21997-1c.S } \
+           "pr21997-1-pie-1" \
+           "pass.out" \
+       ] \
+       [list \
+           "Run pr21997-1 (PIE 2)" \
+           "-pie -Wl,--no-as-needed tmpdir/pr21997-1.so" \
+           "" \
+           { pr21997-1c.S } \
+           "pr21997-1-pie-2" \
+           "pass.out" \
+       ] \
     ]
+
     if { [at_least_gcc_version 5 0] } {
        run_ld_link_exec_tests [list \
            [list \
This page took 0.024635 seconds and 4 git commands to generate.