public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] LoongArch: Fix loongarch*-elf target ld testsuite failure
@ 2024-01-04  8:44 liu & zhensong
  0 siblings, 0 replies; only message in thread
From: liu & zhensong @ 2024-01-04  8:44 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=06bfdc6e5ee0745877ef941f50f680d342b5c585

commit 06bfdc6e5ee0745877ef941f50f680d342b5c585
Author: Lulu Cai <cailulu@loongson.cn>
Date:   Wed Dec 27 17:10:41 2023 +0800

    LoongArch: Fix loongarch*-elf target ld testsuite failure
    
    The loongarch*-elf target does not support SHARED and PIE, so this
    target is skipped for some tests that require these options.

Diff:
---
 ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp | 30 ++++---
 ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d  |  1 +
 ld/testsuite/ld-loongarch-elf/relax.exp            | 99 ++++++++++++----------
 3 files changed, 71 insertions(+), 59 deletions(-)

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 b697d01563c..6c65318a120 100644
--- a/ld/testsuite/ld-loongarch-elf/relax.exp
+++ b/ld/testsuite/ld-loongarch-elf/relax.exp
@@ -150,17 +150,19 @@ if [istarget loongarch64-*-*] {
       }
     }
 
-    run_ld_link_tests \
-	[list \
-	    [list \
-		"loongarch relax .so build" \
-		"-shared -e 0x0" "" \
-		"" \
-		{relax-so.s} \
-		{} \
-		"relax-so" \
-	    ] \
-	]
+    if [check_shared_lib_support] {
+      run_ld_link_tests \
+	  [list \
+	      [list \
+		  "loongarch relax .so build" \
+		  "-shared -e 0x0" "" \
+		  "" \
+		  {relax-so.s} \
+		  {} \
+		  "relax-so" \
+	      ] \
+	  ]
+    }
 
       if [file exist "tmpdir/relax-so"] {
 	set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax-so"]
@@ -173,29 +175,31 @@ if [istarget loongarch64-*-*] {
 
     # If symbol in data segment, offset need to sub segment align to prevent
     # overflow.
-    run_ld_link_tests \
-	[list \
-	    [list \
-		"loongarch relax segment alignment min" \
-		"-e0 -Ttext 0x120004000 -pie -z relro" "" \
-		"" \
-		{relax-segment-min.s} \
-		{} \
-		"relax-segment-min" \
-	    ] \
-	]
+    if [check_pie_support] {
+      run_ld_link_tests \
+	  [list \
+	      [list \
+		  "loongarch relax segment alignment min" \
+		  "-e0 -Ttext 0x120004000 -pie -z relro" "" \
+		  "" \
+		  {relax-segment-min.s} \
+		  {} \
+		  "relax-segment-min" \
+	      ] \
+	  ]
 
-    run_ld_link_tests \
-	[list \
-	    [list \
-		"loongarch relax segment alignment max" \
-		"-e0 -Ttext 0x120004000 -pie -z relro" "" \
-		"" \
-		{relax-segment-max.s} \
-		{} \
-		"relax-segment-max" \
-	    ] \
-	]
+      run_ld_link_tests \
+	  [list \
+	      [list \
+		  "loongarch relax segment alignment max" \
+		  "-e0 -Ttext 0x120004000 -pie -z relro" "" \
+		  "" \
+		  {relax-segment-max.s} \
+		  {} \
+		  "relax-segment-max" \
+	      ] \
+	  ]
+    }
 
     if [file exist "tmpdir/relax-tls-le"] {
       set objdump_output1 [run_host_cmd "objdump" "-d tmpdir/relax-tls-le"]
@@ -265,19 +269,22 @@ if [istarget loongarch64-*-*] {
     }
 
   }
-  run_ld_link_tests \
-      [list \
-	  [list \
-	      "loongarch relax-align" \
-	      "-e 0x0 -z relro" "" \
-	      "--no-warn" \
-	      {relax-align.s} \
-	      [list \
-		  [list objdump -d relax-align.dd] \
-	      ] \
-	      "relax-align" \
-	  ] \
-      ]
+
+  if [check_shared_lib_support] {
+    run_ld_link_tests \
+	[list \
+	    [list \
+		"loongarch relax-align" \
+		"-e 0x0 -z relro" "" \
+		"--no-warn" \
+		{relax-align.s} \
+		[list \
+		    [list objdump -d relax-align.dd] \
+		] \
+		"relax-align" \
+	    ] \
+	]
+  }
 
   set objdump_flags "-s -j .data"
   run_ld_link_tests \

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-04  8:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-04  8:44 [binutils-gdb] LoongArch: Fix loongarch*-elf target ld testsuite failure liu & zhensong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).