[PATCH 2/2] MIPS: fix Irix gas testcases

YunQiang Su yunqiang.su@cipunited.com
Mon Jun 5 10:22:25 GMT 2023


1. add -mpdr to some cases.
   gas doesn't generate .pdr section for Irix objects by default. See
   `int mips_flag_pdr` in tc-mips.c.
2. disable call-nonpic-1 for Irix.
   gas doesn't set O32 flags for Irix objects in e_flags. See
   `use_e_mips_abi_o32` in gas/configure.ac.
3. mips16-e.d: g1 may be marked as O.
   The Irix 5 and 6 assemblers set the type of any common symbol and
   any undefined non-function symbol to STT_OBJECT.
   See `mips_frob_symbol` in tc-mips.c.
---
 gas/testsuite/gas/elf/elf.exp              | 4 ++++
 gas/testsuite/gas/mips/elf-rel26.d         | 2 +-
 gas/testsuite/gas/mips/mips.exp            | 5 ++++-
 gas/testsuite/gas/mips/mips16-e.d          | 4 ++--
 gas/testsuite/gas/mips/mips16-f.d          | 2 +-
 gas/testsuite/gas/mips/mips16-hilo-match.d | 2 +-
 6 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 4890dd93420..0abe730c375 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -207,6 +207,10 @@ if { [is_elf_format] } then {
 	    riscv*-*-* {
 		set as_flags "$as_flags -march-attr"
 	    }
+	    mips*-*-* {
+		# Irix has no pdr section by default.
+		set as_flags "$as_flags -mpdr"
+	    }
 	}
 	run_elf_list_test "section2" "$target_machine" "$as_flags" "-s" ""
     }
diff --git a/gas/testsuite/gas/mips/elf-rel26.d b/gas/testsuite/gas/mips/elf-rel26.d
index aeb4e16d178..71fbe83d4b6 100644
--- a/gas/testsuite/gas/mips/elf-rel26.d
+++ b/gas/testsuite/gas/mips/elf-rel26.d
@@ -1,4 +1,4 @@
-#as: -mips32 -32 -EL -KPIC
+#as: -mips32 -32 -EL -KPIC -mpdr
 #readelf: --relocs
 #name: MIPS ELF reloc 26
 
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 0ea673906a7..08e5655b0fd 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -1551,7 +1551,10 @@ if { [istarget mips*-*-vxworks*] } {
 	[mips_arch_list_matching mips1 !singlefloat]
 
     run_dump_test "mips16-vis-1"
-    run_dump_test "call-nonpic-1"
+    if { ![istarget *-*-irix*] } {
+      # irix sets use_e_mips_abi_o32=0. See gas/configure.ac
+      run_dump_test "call-nonpic-1"
+    }
     run_dump_test "mips32-sync"
     run_dump_test_arches "mips32r2-sync" [lsort -dictionary -unique [concat \
 					[mips_arch_list_matching mips32r2] \
diff --git a/gas/testsuite/gas/mips/mips16-e.d b/gas/testsuite/gas/mips/mips16-e.d
index d4522d6e7c8..e9960e965e7 100644
--- a/gas/testsuite/gas/mips/mips16-e.d
+++ b/gas/testsuite/gas/mips/mips16-e.d
@@ -1,6 +1,6 @@
 #objdump: -rst --special-syms -mips16
 #name: MIPS16 reloc
-#as: -32 -mips16 -mips32
+#as: -32 -mips16 -mips32 -mpdr
 
 # Check MIPS16 reloc processing
 
@@ -17,7 +17,7 @@ SYMBOL TABLE:
 0+0000000 l    d  \.gnu\.attributes	0+0000000 (|\.gnu\.attributes)
 0+0000002 l       \.text	0+0000000 0xf0 l1
 0+0000004 l       \.text	0+0000000 0xf0 \.L1.*1
-0+0000000         \*UND\*	0+0000000 g1
+0+0000000       [ O] \*UND\*	0+0000000 g1
 
 
 RELOCATION RECORDS FOR \[foo\]:
diff --git a/gas/testsuite/gas/mips/mips16-f.d b/gas/testsuite/gas/mips/mips16-f.d
index 62e30a31840..0ed246cfbba 100644
--- a/gas/testsuite/gas/mips/mips16-f.d
+++ b/gas/testsuite/gas/mips/mips16-f.d
@@ -1,6 +1,6 @@
 #objdump: -rst -mips16
 #name: MIPS16 reloc 2
-#as: -32 -mips16 -mips32
+#as: -32 -mips16 -mips32 -mpdr
 
 # Check MIPS16 reloc processing
 
diff --git a/gas/testsuite/gas/mips/mips16-hilo-match.d b/gas/testsuite/gas/mips/mips16-hilo-match.d
index 76ad7b39cdd..7b42f6946c1 100644
--- a/gas/testsuite/gas/mips/mips16-hilo-match.d
+++ b/gas/testsuite/gas/mips/mips16-hilo-match.d
@@ -1,5 +1,5 @@
 #objdump: -r 
-#as: -mabi=32 -march=mips1
+#as: -mabi=32 -march=mips1 -mpdr
 #name: MIPS16 mips16-hilo-match
 
 .*: +file format .*mips.*
-- 
2.30.2



More information about the Binutils mailing list