[binutils-gdb] LoongArch: Fix bfd ld failed test case

liu & zhensong liuzhensong@sourceware.org
Mon Dec 16 07:46:41 GMT 2024


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

commit 1c82e1ee93d57a2013c5acf94558c382e3e2e5c3
Author: Lulu Cai <cailulu@loongson.cn>
Date:   Tue Dec 10 19:42:14 2024 +0800

    LoongArch: Fix bfd ld failed test case
    
    This test case requires host gcc, and different distributions have
    different default configurations for gcc, which can cause address value
    mismatches.
    Therefore, it is fixed by passing consistent options and using regular
    expressions.

Diff:
---
 ld/testsuite/ld-loongarch-elf/call_undefweak.d     | 38 ++++++++--------------
 ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp |  2 +-
 2 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/ld/testsuite/ld-loongarch-elf/call_undefweak.d b/ld/testsuite/ld-loongarch-elf/call_undefweak.d
index 4761651817c..6eedfed3046 100644
--- a/ld/testsuite/ld-loongarch-elf/call_undefweak.d
+++ b/ld/testsuite/ld-loongarch-elf/call_undefweak.d
@@ -1,26 +1,16 @@
 #...
-Disassembly of section \.plt:
-#...
-0+1200004d0 <fn2@plt>:
-   1200004d0:	1c00010f 	pcaddu12i   	\$t3, 8
-   1200004d4:	28ed01ef 	ld.d        	\$t3, \$t3, -1216
-   1200004d8:	4c0001ed 	jirl        	\$t1, \$t3, 0
-   1200004dc:	03400000 	nop
-
-Disassembly of section \.text:
-#...
-0+120000668 <main>:
-   120000668:	4c000000 	jr          	\$zero
-   12000066c:	53fe67ff 	b           	-412	# 1200004d0 <fn2@plt>
-   120000670:	4c000001 	jirl        	\$ra, \$zero, 0
-   120000674:	57fe5fff 	bl          	-420	# 1200004d0 <fn2@plt>
+[0-9a-f]+ <main>:
+   +[0-9a-f]+:	4c000000 	jr          	\$zero
+   +[0-9a-f]+:	........ 	b           	.*	# [0-9a-f]+ <fn2@plt>
+   +[0-9a-f]+:	4c000001 	jirl        	\$ra, \$zero, 0
+   +[0-9a-f]+:	........ 	bl          	.*	# [0-9a-f]+ <fn2@plt>
 
-0+120000678 <medium_call_nop>:
-   120000678:	1e000001 	pcaddu18i   	\$ra, 0
-   12000067c:	4c000001 	jirl        	\$ra, \$zero, 0
-   120000680:	1e000001 	pcaddu18i   	\$ra, 0
-   120000684:	4ffe5021 	jirl        	\$ra, \$ra, -432
-   120000688:	1e00000c 	pcaddu18i   	\$t0, 0
-   12000068c:	4c000000 	jr          	\$zero
-   120000690:	1e00000c 	pcaddu18i   	\$t0, 0
-   120000694:	4ffe4180 	jirl        	\$zero, \$t0, -448
+[0-9a-f]+ <medium_call_nop>:
+   +[0-9a-f]+:	1e000001 	pcaddu18i   	\$ra, 0
+   +[0-9a-f]+:	4c000001 	jirl        	\$ra, \$zero, 0
+   +[0-9a-f]+:	1e000001 	pcaddu18i   	\$ra, 0
+   +[0-9a-f]+:	........ 	jirl        	\$ra, \$ra, .*
+   +[0-9a-f]+:	1e00000c 	pcaddu18i   	\$t0, 0
+   +[0-9a-f]+:	4c000000 	jr          	\$zero
+   +[0-9a-f]+:	1e00000c 	pcaddu18i   	\$t0, 0
+   +[0-9a-f]+:	........ 	jirl        	\$zero, \$t0, .*
diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
index d7c2b311f2f..004c1994673 100644
--- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
+++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
@@ -147,7 +147,7 @@ if [istarget "loongarch64-*-*"] {
   run_cc_link_tests [list \
       [list \
 	  "call undefweak symbol" \
-	  "" "" \
+	  "-no-pie" "" \
 	  {call_undefweak.s} \
 	  {{objdump {-d} call_undefweak.d}} \
 	  "call_undefweak" \


More information about the Binutils-cvs mailing list