ld/testsuite: adjust ld-arm to run shared tests only when supported
authorClément Chigot <chigot@adacore.com>
Thu, 20 Oct 2022 13:32:00 +0000 (15:32 +0200)
committerClément Chigot <chigot@adacore.com>
Mon, 24 Oct 2022 12:05:48 +0000 (14:05 +0200)
If a custom arm-elf target is disabling the shared support, a lot of
failures are reported by the testsuite.
Moreover, some tests try to access libraries which have been explicitly
skipped earlier (eg mixed-lib.so).

ld/ChangeLog:

* testsuite/ld-arm/arm-elf.exp: Separate tests needing shared
lib support.

ld/testsuite/ld-arm/arm-elf.exp

index 08dd0b828f1674d8426419ab320aa8fa9f452dd7..5a3df83e9f1354da98e16cda99ce23d4cf228b19 100644 (file)
@@ -520,9 +520,6 @@ set armeabitests_common {
     {"MOVW/MOVT and merged sections" "-T arm.ld" "" "" {movw-merge.s}
      {{objdump -dw movw-merge.d}}
      "movw-merge"}
-    {"MOVW/MOVT against shared libraries" "tmpdir/arm-lib.so" "" "" {arm-app-movw.s}
-     {{objdump -Rw arm-app.r}}
-     "arm-app-movw"}
 
     {"ARM-ARM farcall" "-Ttext 0x1000 --section-start .foo=0x2001020" "" "" {farcall-arm-arm.s}
      {{objdump -d farcall-arm-arm.d farcall-arm-nacl.d}}
@@ -548,6 +545,14 @@ set armeabitests_common {
      "abs-call-1"}
 }
 
+set armeabitests_common_shared {
+    {"MOVW/MOVT against shared libraries" "tmpdir/arm-lib.so" "" "" {arm-app-movw.s}
+       {{objdump -Rw arm-app.r}}
+       "arm-app-movw"}
+}
+if [check_shared_lib_support] { append armeabitests_common $armeabitests_common_shared}
+
+
 set armeabitests_nonacl {
     {"ARM-Thumb farcall" "-Ttext 0x1000 --section-start .foo=0x2001014" "" "" {farcall-arm-thumb.s}
      {{objdump -d farcall-arm-thumb.d}}
@@ -639,38 +644,6 @@ set armeabitests_nonacl {
      {{objdump -d farcall-mix2.d}}
      "farcall-mix2"}
 
-    {"Mixed ARM/Thumb dynamic application with farcalls"
-     "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" ""
-     "" {farcall-mixed-app.s}
-     {{objdump -fdw farcall-mixed-app.d} {objdump -Rw farcall-mixed-app.r}
-      {readelf -Ds farcall-mixed-app.sym}}
-     "farcall-mixed-app"}
-    {"Mixed ARM/Thumb arch5 dynamic application with farcalls"
-     "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --use-blx --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" ""
-     "" {farcall-mixed-app.s}
-     {{objdump -fdw farcall-mixed-app-v5.d} {objdump -Rw farcall-mixed-app.r}
-      {readelf -Ds farcall-mixed-app.sym}}
-     "farcall-mixed-app-v5"}
-
-    {"Mixed ARM/Thumb2 dynamic application with farcalls"
-     "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --section-start .mid_thumb=0x10081c0 --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" ""
-     "" {farcall-mixed-app2.s}
-     {{objdump -fdw farcall-mixed-app2.d} {objdump -Rw farcall-mixed-app2.r}
-      {readelf -Ds farcall-mixed-app2.sym}}
-     "farcall-mixed-app2"}
-
-    {"Mixed ARM/Thumb shared library with long branches (v4t)"
-     "-shared -T arm-lib.ld --hash-style=sysv" ""
-     "-march=armv4t" {farcall-mixed-lib1.s farcall-mixed-lib2.s}
-     {{objdump -fdw farcall-mixed-lib-v4t.d}}
-     "farcall-mixed-lib.so"}
-
-    {"Mixed ARM/Thumb shared library with long branches (v5t)"
-     "--no-fix-arm1176 -shared -T arm-lib.ld --hash-style=sysv" ""
-     "-march=armv5t" {farcall-mixed-lib1.s farcall-mixed-lib2.s}
-     {{objdump -fdw farcall-mixed-lib.d}}
-     "farcall-mixed-lib.so"}
-
     {"Thumb-2-as-Thumb-1 BL" "--no-fix-arm1176 -Ttext 0x1000 --section-start .foo=0x100100c" "" "" {thumb2-bl-as-thumb1-bad.s}
      {{objdump -d thumb2-bl-as-thumb1-bad.d}}
      "thumb2-bl-as-thumb1-bad"}
@@ -878,36 +851,6 @@ set armeabitests_nonacl {
      {{objdump -d farcall-group-limit.d}}
      "farcall-group-limit"}
 
-    {"TLS gnu shared library"
-     "--no-fix-arm1176 -shared -T arm-dyn.ld --hash-style=sysv" ""
-     "" {tls-gdesc.s}
-     {{objdump -fdw tls-gdesc.d} {objdump -Rw tls-gdesc.r}}
-     "tls-lib2.so"}
-    {"TLS gnu shared library non-lazy"
-     "-z now -shared -T arm-dyn.ld --hash-style=sysv" ""
-     "" {tls-gdesc.s}
-     {{readelf "-x .got" tls-gdesc-nlazy.g}}
-     "tls-lib2-nlazy.so"}
-    {"TLS gnu shared library negative addend"
-     "--no-fix-arm1176 -shared -T arm-dyn.ld --hash-style=sysv" ""
-     "" {tls-gdesc-neg.s}
-     {{objdump -fdw tls-gdesc-neg.d}}
-     "tls-lib2-neg.so"}
-    {"TLS long plt library"
-     "-shared -T arm-dyn.ld --hash-style=sysv --section-start .foo=0x4001000" ""
-     "" {tls-longplt-lib.s}
-     {{objdump -fdw tls-longplt-lib.d}}
-     "tls-longplt-lib.so"}
-    {"TLS long plt"
-     "-T arm-dyn.ld --hash-style=sysv --section-start .foo=0x4001000 tmpdir/tls-longplt-lib.so" ""
-     "" {tls-longplt.s}
-     {{objdump -fdw tls-longplt.d}}
-     "tls-longplt"}
-    {"TLS thumb1"
-     "-shared -T arm-dyn.ld --hash-style=sysv --section-start .foo=0x4001000" ""
-     "" {tls-thumb1.s}
-     {{objdump -fdw tls-thumb1.d}}
-     "tls-thumb1"}
     {"Cortex-A8 erratum fix, b.w"
      "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-b.s}
      {{objdump -dr cortex-a8-fix-b.d}}
@@ -966,6 +909,103 @@ set armeabitests_nonacl {
      "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-blx-bcond.s}
      {{objdump -dr cortex-a8-fix-blx-bcond.d}}
      "cortex-a8-fix-blx-bcond"}
+    {"IFUNC test 1" "-T ifunc-static.ld" "" "" {ifunc-1.s}
+     {{objdump -d ifunc-1.dd}
+      {objdump {-s -j.data -j.got} ifunc-1.gd}
+      {readelf -dr ifunc-1.rd}}
+     "ifunc-1"}
+    {"IFUNC test 2" "-T ifunc-static.ld" "" "" {ifunc-2.s}
+     {{objdump -d ifunc-2.dd}
+      {objdump {-s -j.data -j.got} ifunc-2.gd}
+      {readelf -dr ifunc-2.rd}}
+     "ifunc-2"}
+    {"IFUNC test 5" "-T ifunc-static.ld" "" "" {ifunc-5.s}
+     {{objdump -d ifunc-5.dd}
+      {objdump {-s -j.data -j.got} ifunc-5.gd}
+      {readelf -dr ifunc-5.rd}}
+     "ifunc-5"}
+    {"IFUNC test 6" "-T ifunc-static.ld" "" "" {ifunc-6.s}
+     {{objdump -d ifunc-6.dd}
+      {objdump {-s -j.data -j.got} ifunc-6.gd}
+      {readelf -dr ifunc-6.rd}}
+     "ifunc-6"}
+    {"IFUNC test 11" "-T ifunc-static.ld" "" "" {ifunc-11.s}
+     {{objdump -d ifunc-11.dd}
+      {objdump {-s -j.data -j.got} ifunc-11.gd}
+      {readelf -dr ifunc-11.rd}}
+     "ifunc-11"}
+    {"IFUNC test 17" "-T ifunc-static.ld" "" "" {ifunc-17.s}
+     {{objdump -d ifunc-17.dd}
+      {objdump {-s -j.data -j.got} ifunc-17.gd}
+      {readelf -r ifunc-17.rd}}
+     "ifunc-17"}
+    {"arm-pic-veneer" "-static -T arm.ld --pic-veneer" "" "" {arm-pic-veneer.s}
+     {{objdump -d arm-pic-veneer.d}}
+     "arm-pic-veneer"}
+}
+
+set armeabitests_nonacl_shared {
+    {"TLS gnu shared library"
+       "--no-fix-arm1176 -shared -T arm-dyn.ld --hash-style=sysv" ""
+       "" {tls-gdesc.s}
+       {{objdump -fdw tls-gdesc.d} {objdump -Rw tls-gdesc.r}}
+       "tls-lib2.so"}
+    {"TLS gnu shared library non-lazy"
+       "-z now -shared -T arm-dyn.ld --hash-style=sysv" ""
+       "" {tls-gdesc.s}
+       {{readelf "-x .got" tls-gdesc-nlazy.g}}
+       "tls-lib2-nlazy.so"}
+    {"TLS gnu shared library negative addend"
+       "--no-fix-arm1176 -shared -T arm-dyn.ld --hash-style=sysv" ""
+       "" {tls-gdesc-neg.s}
+       {{objdump -fdw tls-gdesc-neg.d}}
+       "tls-lib2-neg.so"}
+    {"TLS long plt library"
+       "-shared -T arm-dyn.ld --hash-style=sysv --section-start .foo=0x4001000" ""
+       "" {tls-longplt-lib.s}
+       {{objdump -fdw tls-longplt-lib.d}}
+       "tls-longplt-lib.so"}
+    {"TLS long plt"
+       "-T arm-dyn.ld --hash-style=sysv --section-start .foo=0x4001000 tmpdir/tls-longplt-lib.so" ""
+       "" {tls-longplt.s}
+       {{objdump -fdw tls-longplt.d}}
+       "tls-longplt"}
+    {"TLS thumb1"
+       "-shared -T arm-dyn.ld --hash-style=sysv --section-start .foo=0x4001000" ""
+       "" {tls-thumb1.s}
+       {{objdump -fdw tls-thumb1.d}}
+       "tls-thumb1"}
+
+    {"Mixed ARM/Thumb dynamic application with farcalls"
+     "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" ""
+     "" {farcall-mixed-app.s}
+     {{objdump -fdw farcall-mixed-app.d} {objdump -Rw farcall-mixed-app.r}
+      {readelf -Ds farcall-mixed-app.sym}}
+     "farcall-mixed-app"}
+    {"Mixed ARM/Thumb arch5 dynamic application with farcalls"
+     "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --use-blx --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" ""
+     "" {farcall-mixed-app.s}
+     {{objdump -fdw farcall-mixed-app-v5.d} {objdump -Rw farcall-mixed-app.r}
+      {readelf -Ds farcall-mixed-app.sym}}
+     "farcall-mixed-app-v5"}
+    {"Mixed ARM/Thumb2 dynamic application with farcalls"
+     "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --section-start .mid_thumb=0x10081c0 --section-start .far_arm=0x2100000 --section-start .far_thumb=0x2200000" ""
+     "" {farcall-mixed-app2.s}
+     {{objdump -fdw farcall-mixed-app2.d} {objdump -Rw farcall-mixed-app2.r}
+      {readelf -Ds farcall-mixed-app2.sym}}
+     "farcall-mixed-app2"}
+    {"Mixed ARM/Thumb shared library with long branches (v4t)"
+     "-shared -T arm-lib.ld --hash-style=sysv" ""
+     "-march=armv4t" {farcall-mixed-lib1.s farcall-mixed-lib2.s}
+     {{objdump -fdw farcall-mixed-lib-v4t.d}}
+     "farcall-mixed-lib.so"}
+
+    {"Mixed ARM/Thumb shared library with long branches (v5t)"
+     "--no-fix-arm1176 -shared -T arm-lib.ld --hash-style=sysv" ""
+     "-march=armv5t" {farcall-mixed-lib1.s farcall-mixed-lib2.s}
+     {{objdump -fdw farcall-mixed-lib.d}}
+     "farcall-mixed-lib.so"}
+
     {"Cortex-A8 erratum fix, b.w to PLT"
      "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "" "-EL"
      {cortex-a8-fix-b-plt.s}
@@ -991,111 +1031,78 @@ set armeabitests_nonacl {
      "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-bl-rel.s}
      {{objdump -dr cortex-a8-fix-bl-rel-plt.d}}
      "cortex-a8-fix-bl-rel-thumb"}
-    {"IFUNC test 1" "-T ifunc-static.ld" "" "" {ifunc-1.s}
-     {{objdump -d ifunc-1.dd}
-      {objdump {-s -j.data -j.got} ifunc-1.gd}
-      {readelf -dr ifunc-1.rd}}
-     "ifunc-1"}
-    {"IFUNC test 2" "-T ifunc-static.ld" "" "" {ifunc-2.s}
-     {{objdump -d ifunc-2.dd}
-      {objdump {-s -j.data -j.got} ifunc-2.gd}
-      {readelf -dr ifunc-2.rd}}
-     "ifunc-2"}
+
     {"IFUNC test 3" "-T ifunc-dynamic.ld -shared" "" "" {ifunc-3.s}
-     {{objdump -d ifunc-3.dd}
-      {objdump {-s -j.data -j.got} ifunc-3.gd}
-      {readelf -r ifunc-3.rd}}
-     "ifunc-3.so"}
+       {{objdump -d ifunc-3.dd}
+           {objdump {-s -j.data -j.got} ifunc-3.gd}
+           {readelf -r ifunc-3.rd}}
+       "ifunc-3.so"}
     {"IFUNC test 4" "-T ifunc-dynamic.ld -shared" "" "" {ifunc-4.s}
-     {{objdump -d ifunc-4.dd}
-      {objdump {-s -j.data -j.got} ifunc-4.gd}
-      {readelf -r ifunc-4.rd}}
-     "ifunc-4.so"}
-    {"IFUNC test 5" "-T ifunc-static.ld" "" "" {ifunc-5.s}
-     {{objdump -d ifunc-5.dd}
-      {objdump {-s -j.data -j.got} ifunc-5.gd}
-      {readelf -dr ifunc-5.rd}}
-     "ifunc-5"}
-    {"IFUNC test 6" "-T ifunc-static.ld" "" "" {ifunc-6.s}
-     {{objdump -d ifunc-6.dd}
-      {objdump {-s -j.data -j.got} ifunc-6.gd}
-      {readelf -dr ifunc-6.rd}}
-     "ifunc-6"}
+       {{objdump -d ifunc-4.dd}
+           {objdump {-s -j.data -j.got} ifunc-4.gd}
+           {readelf -r ifunc-4.rd}}
+       "ifunc-4.so"}
     {"IFUNC test 7" "-T ifunc-dynamic.ld tmpdir/ifunc-3.so -shared" ""
-     "" {ifunc-7.s}
-     {{objdump -d ifunc-7.dd}
-      {objdump {-s -j.data -j.got} ifunc-7.gd}
-      {readelf -r ifunc-7.rd}}
-     "ifunc-7.so"}
-    {"IFUNC test 8" "-T ifunc-dynamic.ld tmpdir/ifunc-4.so -shared" ""
-     "" {ifunc-8.s}
-     {{objdump -d ifunc-8.dd}
-      {objdump {-s -j.data -j.got} ifunc-8.gd}
-      {readelf -r ifunc-8.rd}}
-     "ifunc-8.so"}
+       "" {ifunc-7.s}
+       {{objdump -d ifunc-7.dd}
+           {objdump {-s -j.data -j.got} ifunc-7.gd}
+           {readelf -r ifunc-7.rd}}
+       "ifunc-7.so"}
+    {"IFUNC test 12" "-T ifunc-dynamic.ld -shared" "" "" {ifunc-12.s}
+       {{objdump -d ifunc-12.dd}
+           {objdump {-s -j.data -j.got} ifunc-12.gd}
+           {readelf -r ifunc-12.rd}}
+       "ifunc-12.so"}
     {"IFUNC test 9" "-T ifunc-dynamic.ld tmpdir/ifunc-3.so" "" "" {ifunc-9.s}
-     {{objdump -d ifunc-9.dd}
-      {objdump {-s -j.data -j.got} ifunc-9.gd}
-      {readelf -r ifunc-9.rd}}
-     "ifunc-9"}
+       {{objdump -d ifunc-9.dd}
+           {objdump {-s -j.data -j.got} ifunc-9.gd}
+           {readelf -r ifunc-9.rd}}
+       "ifunc-9"}
     {"IFUNC test 10" "-T ifunc-dynamic.ld tmpdir/ifunc-4.so" "" "" {ifunc-10.s}
-     {{objdump -d ifunc-10.dd}
-      {objdump {-s -j.data -j.got} ifunc-10.gd}
-      {readelf -r ifunc-10.rd}}
-     "ifunc-10"}
-    {"IFUNC test 11" "-T ifunc-static.ld" "" "" {ifunc-11.s}
-     {{objdump -d ifunc-11.dd}
-      {objdump {-s -j.data -j.got} ifunc-11.gd}
-      {readelf -dr ifunc-11.rd}}
-     "ifunc-11"}
-    {"IFUNC test 12" "-T ifunc-dynamic.ld -shared" "" "" {ifunc-12.s}
-     {{objdump -d ifunc-12.dd}
-      {objdump {-s -j.data -j.got} ifunc-12.gd}
-      {readelf -r ifunc-12.rd}}
-     "ifunc-12.so"}
+       {{objdump -d ifunc-10.dd}
+           {objdump {-s -j.data -j.got} ifunc-10.gd}
+           {readelf -r ifunc-10.rd}}
+       "ifunc-10"}
     {"IFUNC test 13" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-13.s}
-     {{objdump -d ifunc-13.dd}
-      {objdump {-s -j.data -j.got} ifunc-13.gd}
-      {readelf -r ifunc-13.rd}}
-     "ifunc-13"}
+       {{objdump -d ifunc-13.dd}
+           {objdump {-s -j.data -j.got} ifunc-13.gd}
+           {readelf -r ifunc-13.rd}}
+       "ifunc-13"}
     {"IFUNC test 14" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-14.s}
-     {{objdump -d ifunc-14.dd}
-      {objdump {-s -j.data -j.got} ifunc-14.gd}
-      {readelf -r ifunc-14.rd}}
-     "ifunc-14"}
+       {{objdump -d ifunc-14.dd}
+           {objdump {-s -j.data -j.got} ifunc-14.gd}
+           {readelf -r ifunc-14.rd}}
+       "ifunc-14"}
     {"IFUNC test 15" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-15.s}
-     {{objdump -d ifunc-15.dd}
-      {objdump {-s -j.data -j.got} ifunc-15.gd}
-      {readelf -r ifunc-15.rd}}
-     "ifunc-15"}
+       {{objdump -d ifunc-15.dd}
+           {objdump {-s -j.data -j.got} ifunc-15.gd}
+           {readelf -r ifunc-15.rd}}
+       "ifunc-15"}
     {"IFUNC test 16" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-16.s}
-     {{objdump -d ifunc-16.dd}
-      {objdump {-s -j.data -j.got} ifunc-16.gd}
-      {readelf -r ifunc-16.rd}}
-     "ifunc-16"}
-    {"IFUNC test 17" "-T ifunc-static.ld" "" "" {ifunc-17.s}
-     {{objdump -d ifunc-17.dd}
-      {objdump {-s -j.data -j.got} ifunc-17.gd}
-      {readelf -r ifunc-17.rd}}
-     "ifunc-17"}
+       {{objdump -d ifunc-16.dd}
+           {objdump {-s -j.data -j.got} ifunc-16.gd}
+           {readelf -r ifunc-16.rd}}
+       "ifunc-16"}
+
     {"Long PLT entries in executables" "--long-plt -shared --section-start=.plt=0x1000 --section-start=.got=0xf0001100" ""
-     "" {long-plt-format.s}
-     {{objdump "-d -j .plt" long-plt-format.d}}
-     "long-plt-format"}
+       "" {long-plt-format.s}
+       {{objdump "-d -j .plt" long-plt-format.d}}
+       "long-plt-format"}
+
     {"IFUNC and TLS descriptor shared library"
-     "-shared -T arm-lib.ld --hash-style=sysv --version-script=ifunc-gdesc.ver" ""
-     "" {ifunc-gdesc.s}
-     {{objdump "-Rw" ifunc-gdesc.r}}
-     "ifunc-gdesc.so"}
-    {"arm-pic-veneer" "-static -T arm.ld --pic-veneer" "" "" {arm-pic-veneer.s}
-     {{objdump -d arm-pic-veneer.d}}
-     "arm-pic-veneer"}
+       "-shared -T arm-lib.ld --hash-style=sysv --version-script=ifunc-gdesc.ver" ""
+       "" {ifunc-gdesc.s}
+       {{objdump "-Rw" ifunc-gdesc.r}}
+       "ifunc-gdesc.so"}
+
     {"Preempt Thumb symbol"
-     "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --use-blx" ""
-     "" {preempt-app.s}
-     {{readelf -Ds preempt-app.sym}}
-     "preempt-app"}
+       "tmpdir/mixed-lib.so -T arm-dyn.ld --hash-style=sysv --use-blx" ""
+       "" {preempt-app.s}
+       {{readelf -Ds preempt-app.sym}}
+       "preempt-app"}
 }
+if [check_shared_lib_support] { append armeabitests_nonacl $armeabitests_nonacl_shared}
+
 
 set armfdpiceabitests {
     {"FDPIC ARM shared library little endian"
@@ -1240,7 +1247,7 @@ run_dump_test "attr-merge-nosection-1"
 run_dump_test "attr-merge-hardfp-use-1"
 run_dump_test "attr-merge-hardfp-use-2"
 run_dump_test "unresolved-1"
-if { ![istarget "arm*-*-nacl*"] } {
+if { [check_shared_lib_support] } {
     run_dump_test "unresolved-1-dyn"
 }
 run_dump_test "unresolved-2"
@@ -1265,7 +1272,7 @@ run_dump_test "non-contiguous-arm4"
 run_dump_test "non-contiguous-arm5"
 run_dump_test "non-contiguous-arm6"
 
-if { ![istarget "arm*-*-nacl*"] } {
+if { [check_shared_lib_support] } {
     run_dump_test "thumb-plt"
     run_dump_test "thumb-plt-got"
 }