public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v1] LoongArch: ld: Adjusted some code order in relax.exp.
@ 2024-01-05  9:17 changjiachen
  0 siblings, 0 replies; only message in thread
From: changjiachen @ 2024-01-05  9:17 UTC (permalink / raw)
  To: binutils
  Cc: xuchenghua, chenglulu, liuzhensong, xry111, i.swmail, maskray,
	cailulu, luweining, wanglei, hejinyang, Lazy_Linux, mengqinggang,
	changjiachen

	ld/testsuite/ChangeLog:

	* ld/testsuite/ld-loongarch-elf/relax.exp: Modify test.
---
 ld/testsuite/ld-loongarch-elf/relax.exp | 290 ++++++++++++------------
 1 file changed, 145 insertions(+), 145 deletions(-)

diff --git a/ld/testsuite/ld-loongarch-elf/relax.exp b/ld/testsuite/ld-loongarch-elf/relax.exp
index b697d01563c..5da297533ac 100644
--- a/ld/testsuite/ld-loongarch-elf/relax.exp
+++ b/ld/testsuite/ld-loongarch-elf/relax.exp
@@ -33,90 +33,8 @@ if [istarget loongarch64-*-*] {
 	"relax" \
       ] \
     ]
-    set tls_relax_builds [list \
-      [list \
-	"tls_relax_builds" \
-	"" \
-	"" \
-	{relax-tls-le.s} \
-	{}        \
-	"relax-tls-le" \
-      ] \
-    ]
-    set tls_no_relax_builds [list \
-      [list \
-	"tls_no_relax_builds" \
-	"-Wl,--no-relax" \
-	"" \
-	{relax-tls-le.s} \
-	{}        \
-	"no-relax-tls-le" \
-      ] \
-    ]
-
-    set relax_bound_check [list \
-      [list \
-	"relax_bound_check" \
-	"" \
-	"" \
-	{relax-bound-check-tls-le.s} \
-	{}        \
-	"relax-bound-check-tls-le" \
-      ] \
-    ]
-    set no_relax_bound_check [list \
-      [list \
-	"no_relax_bound_check" \
-	"-Wl,--no-relax" \
-	"" \
-	{relax-bound-check-tls-le.s} \
-	{}        \
-	"no-relax-bound-check-tls-le" \
-      ] \
-    ]
-
-    set old_tls_le [list \
-      [list \
-	"old_tls_le" \
-	"" \
-	"" \
-	{old-tls-le.s} \
-	{}        \
-	"old-tls-le" \
-      ] \
-    ]
-
-     set relax_compatible [list \
-      [list \
-	"relax_compatible" \
-	"" \
-	"" \
-	{tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \
-	{}        \
-	"realx-compatible" \
-      ] \
-    ]
-
-    set no_relax_compatible [list \
-      [list \
-	"no_relax_compatible" \
-	"-Wl,--no-relax" \
-	"" \
-	{tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \
-	{}        \
-	"no-realx-compatible" \
-      ] \
-    ]
-
 
     run_cc_link_tests $pre_builds
-    run_cc_link_tests $tls_relax_builds
-    run_cc_link_tests $tls_no_relax_builds
-    run_cc_link_tests $relax_bound_check
-    run_cc_link_tests $no_relax_bound_check
-    run_cc_link_tests $old_tls_le
-    run_cc_link_tests $relax_compatible
-    run_cc_link_tests $no_relax_compatible
 
     if [file exist "tmpdir/relax"] {
       set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax"]
@@ -171,98 +89,180 @@ 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" "" \
+		"loongarch tls le relax .exe build" \
+		"" "" \
 		"" \
-		{relax-segment-min.s} \
+		{relax-tls-le.s} \
 		{} \
-		"relax-segment-min" \
+		"relax-tls-le" \
 	    ] \
 	]
 
+      if [file exist "tmpdir/relax-tls-le"] {
+	set objdump_output1 [run_host_cmd "objdump" "-d tmpdir/relax-tls-le"]
+	if { [ regexp ".addi.*st.*" $objdump_output1] } {
+	  pass "loongarch relax success"
+	} {
+	  fail "loongarch relax fail"
+	}
+      }
+
     run_ld_link_tests \
 	[list \
 	    [list \
-		"loongarch relax segment alignment max" \
-		"-e0 -Ttext 0x120004000 -pie -z relro" "" \
+		"loongarch tls le no relax .exe build" \
+		"--no-relax" "" \
 		"" \
-		{relax-segment-max.s} \
+		{relax-tls-le.s} \
 		{} \
-		"relax-segment-max" \
+		"no-relax-tls-le" \
 	    ] \
 	]
 
-    if [file exist "tmpdir/relax-tls-le"] {
-      set objdump_output1 [run_host_cmd "objdump" "-d tmpdir/relax-tls-le"]
-      if { [ regexp ".addi.*st.*" $objdump_output1] } {
-	pass "loongarch relax success"
-      } {
-	fail "loongarch relax fail"
-      }
-    }
-    if [file exist "tmpdir/no-relax-tls-le"] {
-      set objdump_output2 [run_host_cmd "objdump" "-d tmpdir/no-relax-tls-le"]
-      if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output2] } {
-	pass "loongarch no-relax success"
-      } {
-	fail "loongarch no-relax fail"
+      if [file exist "tmpdir/no-relax-tls-le"] {
+	set objdump_output2 [run_host_cmd "objdump" "-d tmpdir/no-relax-tls-le"]
+	if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output2] } {
+	  pass "loongarch no-relax success"
+	} {
+	  fail "loongarch no-relax fail"
+	}
       }
 
-    }
-    if [file exist "tmpdir/old-tls-le"] {
-      set objdump_output3 [run_host_cmd "objdump" "-d tmpdir/old-tls-le"]
-      if { [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output3] } {
-	pass "loongarch old tls le success"
-      } {
-	fail "loongarch old tls le fail"
+    run_ld_link_tests \
+	[list \
+	    [list \
+		"loongarch old tls le .exe build" \
+		"" "" \
+		"" \
+		{old-tls-le.s} \
+		{} \
+		"old-tls-le" \
+	    ] \
+	]
+
+      if [file exist "tmpdir/old-tls-le"] {
+	set objdump_output3 [run_host_cmd "objdump" "-d tmpdir/old-tls-le"]
+	if { [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output3] } {
+	  pass "loongarch old tls le success"
+	} {
+	  fail "loongarch old tls le fail"
+	}
       }
 
-    }
+    run_ld_link_tests \
+	[list \
+	    [list \
+		"loongarch tls le realx compatible .exe build" \
+		"" "" \
+		"" \
+		{tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \
+		{} \
+		"realx-compatible" \
+	    ] \
+	]
 
-    if [file exist "tmpdir/realx-compatible"] {
-      set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/realx-compatible"]
-      if { [ regexp ".addi.*st.*" $objdump_output4] && \
-	   [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } {
-	pass "loongarch tls le relax compatible check success"
-      } {
-	fail "loongarch tls le relax compatible check fail"
+      if [file exist "tmpdir/realx-compatible"] {
+	set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/realx-compatible"]
+	if { [ regexp ".addi.*st.*" $objdump_output4] && \
+	     [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } {
+	  pass "loongarch tls le relax compatible check success"
+	} {
+	  fail "loongarch tls le relax compatible check fail"
+	}
       }
-    }
 
-    if [file exist "tmpdir/no-realx-compatible"] {
-      set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/realx-compatible"]
-      if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output4] && \
-	   [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } {
-	pass "loongarch tls le no-relax compatible check success"
-      } {
-	fail "loongarch tls le no-relax compatible check fail"
+    run_ld_link_tests \
+	[list \
+	    [list \
+		"loongarch tls le no realx compatible .exe build" \
+		"--no-relax" "" \
+		"" \
+		{tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \
+		{} \
+		"no-realx-compatible" \
+	    ] \
+	]
+      if [file exist "tmpdir/no-realx-compatible"] {
+	set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/no-realx-compatible"]
+	if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output4] && \
+	     [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } {
+	  pass "loongarch tls le no-relax compatible check success"
+	} {
+	  fail "loongarch tls le no-relax compatible check fail"
+	}
       }
-    }
 
+    run_ld_link_tests \
+	[list \
+	    [list \
+		"loongarch tls le realx bound-check .exe build" \
+		"" "" \
+		"" \
+		{relax-bound-check-tls-le.s} \
+		{} \
+		"relax-bound-check-tls-le" \
+	    ] \
+	]
 
-    if [file exist "tmpdir/relax-bound-check-tls-le"] {
-      set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/relax-bound-check-tls-le"]
-      if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output5] && \
-	   [ regexp ".addi.*st.*" $objdump_output5] } {
-	pass "loongarch no-relax success"
-      } {
-	fail "loongarch no-relax fail"
+      if [file exist "tmpdir/relax-bound-check-tls-le"] {
+	set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/relax-bound-check-tls-le"]
+	if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output5] && \
+	     [ regexp ".addi.*st.*" $objdump_output5] } {
+	  pass "loongarch no-relax success"
+	} {
+	  fail "loongarch no-relax fail"
+	}
       }
 
-    }
-    if [file exist "tmpdir/no-relax-bound-check-tls-le"] {
-      set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/no-relax-bound-check-tls-le"]
-      if { [ regexp ".*addi.*st.*" $objdump_output5] } {
-	pass "loongarch no-relax success"
-      } {
-	fail "loongarch no-relax fail"
+    run_ld_link_tests \
+	[list \
+	    [list \
+		"loongarch tls le no realx bound-check .exe build" \
+		"--no-relax" "" \
+		"" \
+		{relax-bound-check-tls-le.s} \
+		{} \
+		"no-relax-bound-check-tls-le" \
+	    ] \
+	]
+
+      if [file exist "tmpdir/no-relax-bound-check-tls-le"] {
+	set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/no-relax-bound-check-tls-le"]
+	if { [ regexp ".*addi.*st.*" $objdump_output5] } {
+	  pass "loongarch no-relax success"
+	} {
+	  fail "loongarch no-relax fail"
+	}
       }
-    }
+
+    # 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" \
+	    ] \
+	]
+
+    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 \
-- 
2.40.0


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

only message in thread, other threads:[~2024-01-05  9:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-05  9:17 [PATCH v1] LoongArch: ld: Adjusted some code order in relax.exp changjiachen

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).