Fix loongarch*-elf target ld testsuite failure.

Message ID 20231228061804.2783702-1-cailulu@loongson.cn
State Unresolved
Headers
Series Fix loongarch*-elf target ld testsuite failure. |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Lulu Cai Dec. 28, 2023, 6:18 a.m. UTC
  The loongarch*-elf target does not support SHARED and PIE, so this
target is skipped for some tests that require these options.
---
 .../ld-loongarch-elf/ld-loongarch-elf.exp     | 30 +++++++++++--------
 .../ld-loongarch-elf/local-ifunc-reloc.d      |  1 +
 ld/testsuite/ld-loongarch-elf/relax.exp       |  4 +++
 3 files changed, 22 insertions(+), 13 deletions(-)
  

Patch

diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
index 2a5709a5b55..8dc04fea707 100644
--- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
+++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
@@ -43,19 +43,21 @@  if [istarget "loongarch32-*-*"] {
 }
 
 if [istarget "loongarch64-*-*"] {
-  run_ld_link_tests \
-      [list \
-	  [list \
-	      "64_pcrel" \
-	      "-e 0x0 -z relro" "" \
-	      "" \
-	      {64_pcrel.s} \
-	      [list \
-		  [list objdump -D 64_pcrel.d] \
-	      ] \
-	      "64_pcrel" \
-	  ] \
-      ]
+  if [check_shared_lib_support] {
+    run_ld_link_tests \
+	[list \
+	    [list \
+		"64_pcrel" \
+		"-e 0x0 -z relro" "" \
+		"" \
+		{64_pcrel.s} \
+		[list \
+		    [list objdump -D 64_pcrel.d] \
+		] \
+		"64_pcrel" \
+	    ] \
+	]
+  }
 
   run_ld_link_tests \
       [list \
@@ -71,10 +73,12 @@  if [istarget "loongarch64-*-*"] {
 }
 
 if [istarget "loongarch64-*-*"] {
+  if [check_shared_lib_support] {
     run_dump_test "desc-ie"
     run_dump_test "desc-le"
     run_dump_test "ie-le"
     run_dump_test "tlsdesc-dso"
     run_dump_test "desc-norelax"
     run_dump_test "desc-relax"
+  }
 }
diff --git a/ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d b/ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d
index bf73d9f2875..8e1d3f0d266 100644
--- a/ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d
+++ b/ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d
@@ -1,6 +1,7 @@ 
 #as:
 #ld: -shared -z combreloc
 #objdump: -R
+#skip: loongarch*-elf
 
 .*: +file format .*
 
diff --git a/ld/testsuite/ld-loongarch-elf/relax.exp b/ld/testsuite/ld-loongarch-elf/relax.exp
index 77323d8d7a3..d0faa23c57a 100644
--- a/ld/testsuite/ld-loongarch-elf/relax.exp
+++ b/ld/testsuite/ld-loongarch-elf/relax.exp
@@ -68,6 +68,7 @@  if [istarget loongarch64-*-*] {
       }
     }
 
+  if [check_shared_lib_support] {
     run_ld_link_tests \
 	[list \
 	    [list \
@@ -114,8 +115,10 @@  if [istarget loongarch64-*-*] {
 		"relax-segment-max" \
 	    ] \
 	]
+    }
   }
 
+  if [check_shared_lib_support] {
   run_ld_link_tests \
       [list \
 	  [list \
@@ -129,6 +132,7 @@  if [istarget loongarch64-*-*] {
 	      "relax-align" \
 	  ] \
       ]
+  }
 
   set objdump_flags "-s -j .data"
   run_ld_link_tests \