[binutils-gdb] MIPS/GAS/testsuite: Cover microMIPS HI/LO relocation pairing

Maciej W. Rozycki macro@sourceware.org
Sun Jul 6 18:24:25 GMT 2025


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

commit a7d3bda83bdc5164c14fea57a095c497d06ae724
Author: Maciej W. Rozycki <macro@orcam.me.uk>
Date:   Sun Jul 6 19:22:48 2025 +0100

    MIPS/GAS/testsuite: Cover microMIPS HI/LO relocation pairing
    
    Add a GAS test case for R_MICROMIPS_HI16/R_MICROMIPS_LO16 REL relocation
    pairing, analogous to one for R_MIPS16_HI16/R_MIPS16_LO16 relocations.

Diff:
---
 gas/testsuite/gas/mips/micromips-hilo-match.d      | 39 ++++++++++++++++++++++
 .../{mips16-hilo-match.s => mips-hilo-match.s}     |  5 +++
 gas/testsuite/gas/mips/mips.exp                    |  1 +
 gas/testsuite/gas/mips/mips16-hilo-match.d         |  1 +
 4 files changed, 46 insertions(+)

diff --git a/gas/testsuite/gas/mips/micromips-hilo-match.d b/gas/testsuite/gas/mips/micromips-hilo-match.d
new file mode 100644
index 00000000000..216d0671f1d
--- /dev/null
+++ b/gas/testsuite/gas/mips/micromips-hilo-match.d
@@ -0,0 +1,39 @@
+#objdump: -r
+#as: -mabi=32 -march=mips1 -mpdr --defsym micromips=1
+#name: microMIPS micromips-hilo-match
+#source: mips-hilo-match.s
+
+.*: +file format .*mips.*
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET +TYPE +VALUE
+00000010 R_MIPS_HI16       var4
+00000018 R_MIPS_LO16       var4
+00000008 R_MIPS_HI16       __var1
+00000020 R_MIPS_LO16       __var1
+0000001c R_MIPS_HI16       .sbss
+0000002c R_MIPS_LO16       .sbss
+00000030 R_MIPS_26         func4
+00000028 R_MIPS_HI16       __var3
+00000034 R_MIPS_LO16       __var3
+00000038 R_MIPS_LO16       hilo_match
+0000003c R_MIPS_HI16       .bss
+00000044 R_MIPS_LO16       .bss
+00000040 R_MIPS_HI16       .bss
+00000048 R_MIPS_LO16       .bss
+0000004c R_MIPS_26         func3
+00000024 R_MIPS_HI16       hilo_match
+00000050 R_MIPS_LO16       hilo_match
+0000005e R_MICROMIPS_HI16  .data
+00000068 R_MICROMIPS_LO16  .data
+0000006c R_MICROMIPS_26_S1  func1
+00000074 R_MICROMIPS_26_S1  func2
+0000007c R_MICROMIPS_HI16  hilo_match
+00000084 R_MICROMIPS_LO16  hilo_match
+0000008a R_MICROMIPS_LO16  hilo_match
+0000008e R_MICROMIPS_26_S1  func1
+
+RELOCATION RECORDS FOR \[\.pdr\]:
+OFFSET +TYPE +VALUE
+00000000 R_MIPS_32         _pinit
+00000020 R_MIPS_32         pdelt
diff --git a/gas/testsuite/gas/mips/mips16-hilo-match.s b/gas/testsuite/gas/mips/mips-hilo-match.s
similarity index 96%
rename from gas/testsuite/gas/mips/mips16-hilo-match.s
rename to gas/testsuite/gas/mips/mips-hilo-match.s
index 7510d5d1ec9..f69264eacba 100644
--- a/gas/testsuite/gas/mips/mips16-hilo-match.s
+++ b/gas/testsuite/gas/mips/mips-hilo-match.s
@@ -1,6 +1,7 @@
 	.align	2
 	.globl	_pinit
 .LFB84:
+	.set	nomicromips
 	.set	nomips16
 	.ent	_pinit
 _pinit:
@@ -43,7 +44,11 @@ _pinit:
 	.align	2
 	.globl	pdelt
 .LFB120:
+	.ifdef	micromips
+	.set	micromips
+	.else
 	.set	mips16
+	.endif
 	.ent	pdelt
 pdelt:
 	.set	macro
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 1dace1cac7e..ea07a8c9068 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -1635,6 +1635,7 @@ if { [istarget mips*-*-vxworks*] } {
     }
     run_dump_test "micromips-b16"
     run_list_test "micromips-ill"
+    run_dump_test "micromips-hilo-match"
 
     run_dump_test_arches "mcu"		[mips_arch_list_matching mips32r2 \
 					    !octeon]
diff --git a/gas/testsuite/gas/mips/mips16-hilo-match.d b/gas/testsuite/gas/mips/mips16-hilo-match.d
index a9151a3ea65..8b77da599ce 100644
--- a/gas/testsuite/gas/mips/mips16-hilo-match.d
+++ b/gas/testsuite/gas/mips/mips16-hilo-match.d
@@ -1,6 +1,7 @@
 #objdump: -r
 #as: -mabi=32 -march=mips1 -mpdr
 #name: MIPS16 mips16-hilo-match
+#source: mips-hilo-match.s
 
 .*: +file format .*mips.*


More information about the Binutils-cvs mailing list