[v4,7/7] MIPS: Fix Irix gas testcases
Checks
Commit Message
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. Add irix-no-pdr.d.
3. Add and use call-nonpic-1-irix.d for Irix targets.
Gas doesn't set O32 flags for Irix objects in e_flags. See
`use_e_mips_abi_o32` in gas/configure.ac.
4. Add mips16-e-irix.d: g1 is marked as O on Irix.
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/call-nonpic-1-irix.d | 30 +++++++++++++
gas/testsuite/gas/mips/elf-rel26.d | 2 +-
gas/testsuite/gas/mips/irix-no-pdr.d | 8 ++++
gas/testsuite/gas/mips/mips.exp | 11 ++++-
gas/testsuite/gas/mips/mips16-e-irix.d | 50 +++++++++++++++++++++
gas/testsuite/gas/mips/mips16-e.d | 2 +-
gas/testsuite/gas/mips/mips16-f.d | 2 +-
gas/testsuite/gas/mips/mips16-hilo-match.d | 2 +-
9 files changed, 105 insertions(+), 6 deletions(-)
create mode 100644 gas/testsuite/gas/mips/call-nonpic-1-irix.d
create mode 100644 gas/testsuite/gas/mips/irix-no-pdr.d
create mode 100644 gas/testsuite/gas/mips/mips16-e-irix.d
Comments
YunQiang Su <yunqiang.su@cipunited.com> 于2023年6月16日周五 14:41写道:
>
> 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. Add irix-no-pdr.d.
>
> 3. Add and use call-nonpic-1-irix.d for Irix targets.
> Gas doesn't set O32 flags for Irix objects in e_flags. See
> `use_e_mips_abi_o32` in gas/configure.ac.
>
> 4. Add mips16-e-irix.d: g1 is marked as O on Irix.
> 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.
@Maciej W. Rozycki ping.
> ---
> gas/testsuite/gas/elf/elf.exp | 4 ++
> gas/testsuite/gas/mips/call-nonpic-1-irix.d | 30 +++++++++++++
> gas/testsuite/gas/mips/elf-rel26.d | 2 +-
> gas/testsuite/gas/mips/irix-no-pdr.d | 8 ++++
> gas/testsuite/gas/mips/mips.exp | 11 ++++-
> gas/testsuite/gas/mips/mips16-e-irix.d | 50 +++++++++++++++++++++
> gas/testsuite/gas/mips/mips16-e.d | 2 +-
> gas/testsuite/gas/mips/mips16-f.d | 2 +-
> gas/testsuite/gas/mips/mips16-hilo-match.d | 2 +-
> 9 files changed, 105 insertions(+), 6 deletions(-)
> create mode 100644 gas/testsuite/gas/mips/call-nonpic-1-irix.d
> create mode 100644 gas/testsuite/gas/mips/irix-no-pdr.d
> create mode 100644 gas/testsuite/gas/mips/mips16-e-irix.d
>
> 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/call-nonpic-1-irix.d b/gas/testsuite/gas/mips/call-nonpic-1-irix.d
> new file mode 100644
> index 00000000000..3cff1ca672b
> --- /dev/null
> +++ b/gas/testsuite/gas/mips/call-nonpic-1-irix.d
> @@ -0,0 +1,30 @@
> +#as: -mabi=32 -mips2 -call_nonpic
> +#objdump: -pdr
> +#source: call-nonpic-1.s
> +
> +.*
> +private flags = 10000004: .*
> +
> +MIPS ABI Flags Version: 0
> +
> +ISA: MIPS2
> +GPR size: 32
> +CPR1 size: 32
> +CPR2 size: 0
> +FP ABI: Hard float \(double precision\)
> +ISA Extension: None
> +ASEs:
> + None
> +FLAGS 1: 00000000
> +FLAGS 2: 00000000
> +
> +
> +Disassembly of section \.text:
> +
> +0+0 <\.text>:
> +.* lui t9,0x0
> +.*: R_MIPS_HI16 foo
> +.* addiu t9,t9,0
> +.*: R_MIPS_LO16 foo
> +.* jalr t9
> +.* nop
> 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/irix-no-pdr.d b/gas/testsuite/gas/mips/irix-no-pdr.d
> new file mode 100644
> index 00000000000..7268e020c9f
> --- /dev/null
> +++ b/gas/testsuite/gas/mips/irix-no-pdr.d
> @@ -0,0 +1,8 @@
> +#objdump: -rst
> +#name: Irix has no .pdr section
> +#as: -32 -mips32
> +#source: sync.s
> +
> +#failif
> +.*\.pdr.*
> +#pass
> diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
> index 4bfb350beb9..336eb6afbde 100644
> --- a/gas/testsuite/gas/mips/mips.exp
> +++ b/gas/testsuite/gas/mips/mips.exp
> @@ -1254,7 +1254,7 @@ if { [istarget mips*-*-vxworks*] } {
> run_dump_test "comdat-reloc"
> run_dump_test "comdat-reloc-r6"
>
> - run_dump_test "${tmips}mips${el}16-e"
> + run_dump_test "${tmips}mips${el}16-e${imips}"
> run_dump_test "${tmips}mips${el}16-f"
>
> run_dump_test "elf-consthilo"
> @@ -1553,7 +1553,8 @@ if { [istarget mips*-*-vxworks*] } {
> [mips_arch_list_matching mips1 !singlefloat]
>
> run_dump_test "mips16-vis-1"
> - run_dump_test "call-nonpic-1"
> + # Irix sets use_e_mips_abi_o32=0. See gas/configure.ac.
> + run_dump_test "call-nonpic-1${imips}"
> run_dump_test "mips32-sync"
> run_dump_test_arches "mips32r2-sync" [lsort -dictionary -unique [concat \
> [mips_arch_list_matching mips32r2] \
> @@ -2187,4 +2188,10 @@ if { [istarget mips*-*-vxworks*] } {
> run_dump_test "global-local-symtab-sort-n32${tmips}"
> run_dump_test "global-local-symtab-sort-n64${tmips}"
> }
> +
> + # Gas doesn't generate .pdr section for Irix objects by default.
> + # See `int mips_flag_pdr` in tc-mips.c.
> + if [istarget *-*-irix*] {
> + run_dump_test "irix-no-pdr"
> + }
> }
> diff --git a/gas/testsuite/gas/mips/mips16-e-irix.d b/gas/testsuite/gas/mips/mips16-e-irix.d
> new file mode 100644
> index 00000000000..1b473deb281
> --- /dev/null
> +++ b/gas/testsuite/gas/mips/mips16-e-irix.d
> @@ -0,0 +1,50 @@
> +#objdump: -rst --special-syms -mips16
> +#name: MIPS16 reloc
> +#as: -32 -mips16 -mips32 -mpdr
> +#source: mips16-e.s
> +
> +# 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.
> +
> +# Check MIPS16 reloc processing
> +
> +.*: +file format elf.*mips.*
> +
> +SYMBOL TABLE:
> +0+0000000 l d \.text 0+0000000 (|\.text)
> +0+0000000 l d \.data 0+0000000 (|\.data)
> +0+0000000 l d \.bss 0+0000000 (|\.bss)
> +0+0000000 l d foo 0+0000000 (|foo)
> +0+0000000 l d \.reginfo 0+0000000 (|\.reginfo)
> +0+0000000 l d \.MIPS\.abiflags 0+0000000 (|\.MIPS\.abiflags)
> +0+0000000 l d \.(mdebug|pdr) 0+0000000 (|\.mdebug|\.pdr)
> +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 O \*UND\* 0+0000000 g1
> +
> +
> +RELOCATION RECORDS FOR \[foo\]:
> +OFFSET +TYPE +VALUE
> +0+0000000 R_MIPS_32 l1
> +0+0000004 R_MIPS_32 l1
> +0+0000008 R_MIPS_32 \.L1.*1
> +0+000000c R_MIPS_32 \.L1.*1
> +0+0000010 R_MIPS_32 g1
> +0+0000014 R_MIPS_32 g1
> +
> +
> +Contents of section \.text:
> + 0000 65006500 65006500 65006500 65006500 .*
> +Contents of section \.reginfo:
> + 0000 00010000 00000000 00000000 00000000 .*
> + 0010 00000000 00000000 .*
> +Contents of section \.MIPS\.abiflags:
> + .*
> + .*
> +Contents of section foo:
> + 0000 00000000 00000008 00000000 00000003 .*
> + 0010 00000000 00000008 00000000 00000000 .*
> +Contents of section \.gnu\.attributes:
> + .*
> diff --git a/gas/testsuite/gas/mips/mips16-e.d b/gas/testsuite/gas/mips/mips16-e.d
> index d4522d6e7c8..9a7c3e82c0c 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
>
> 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
>
On 15.08.2023 06:40, YunQiang Su wrote:
> YunQiang Su <yunqiang.su@cipunited.com> 于2023年6月16日周五 14:41写道:
>>
>> 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. Add irix-no-pdr.d.
>>
>> 3. Add and use call-nonpic-1-irix.d for Irix targets.
>> Gas doesn't set O32 flags for Irix objects in e_flags. See
>> `use_e_mips_abi_o32` in gas/configure.ac.
>>
>> 4. Add mips16-e-irix.d: g1 is marked as O on Irix.
>> 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.
>
> @Maciej W. Rozycki ping.
From what I can tell, you've addressed all of Maciej's comments on v1.
On that basis this patch is provisionally approved in case he or
Chenghua don't respond within another two weeks time. Btw., it often
helps to send pings To: the person(s) pinged, not just Cc-ing them.
Jan
On Tue, 15 Aug 2023, Jan Beulich wrote:
> >> 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. Add irix-no-pdr.d.
> >>
> >> 3. Add and use call-nonpic-1-irix.d for Irix targets.
> >> Gas doesn't set O32 flags for Irix objects in e_flags. See
> >> `use_e_mips_abi_o32` in gas/configure.ac.
> >>
> >> 4. Add mips16-e-irix.d: g1 is marked as O on Irix.
> >> 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.
> >
> > @Maciej W. Rozycki ping.
>
> >From what I can tell, you've addressed all of Maciej's comments on v1.
> On that basis this patch is provisionally approved in case he or
> Chenghua don't respond within another two weeks time. Btw., it often
> helps to send pings To: the person(s) pinged, not just Cc-ing them.
This was sent as a part of a patch set that has been superseded by later
changes. How do I know it is still relevant? It is the responsibility of
the submitter to track changes in the tree and ping and/or resubmit as
required.
In this case four different classes of changes have been grouped into a
single change, as listed in the change description, so this has to be
split accordingly into four self-contained patches before I can consider
it.
Maciej
@@ -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" ""
}
new file mode 100644
@@ -0,0 +1,30 @@
+#as: -mabi=32 -mips2 -call_nonpic
+#objdump: -pdr
+#source: call-nonpic-1.s
+
+.*
+private flags = 10000004: .*
+
+MIPS ABI Flags Version: 0
+
+ISA: MIPS2
+GPR size: 32
+CPR1 size: 32
+CPR2 size: 0
+FP ABI: Hard float \(double precision\)
+ISA Extension: None
+ASEs:
+ None
+FLAGS 1: 00000000
+FLAGS 2: 00000000
+
+
+Disassembly of section \.text:
+
+0+0 <\.text>:
+.* lui t9,0x0
+.*: R_MIPS_HI16 foo
+.* addiu t9,t9,0
+.*: R_MIPS_LO16 foo
+.* jalr t9
+.* nop
@@ -1,4 +1,4 @@
-#as: -mips32 -32 -EL -KPIC
+#as: -mips32 -32 -EL -KPIC -mpdr
#readelf: --relocs
#name: MIPS ELF reloc 26
new file mode 100644
@@ -0,0 +1,8 @@
+#objdump: -rst
+#name: Irix has no .pdr section
+#as: -32 -mips32
+#source: sync.s
+
+#failif
+.*\.pdr.*
+#pass
@@ -1254,7 +1254,7 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "comdat-reloc"
run_dump_test "comdat-reloc-r6"
- run_dump_test "${tmips}mips${el}16-e"
+ run_dump_test "${tmips}mips${el}16-e${imips}"
run_dump_test "${tmips}mips${el}16-f"
run_dump_test "elf-consthilo"
@@ -1553,7 +1553,8 @@ if { [istarget mips*-*-vxworks*] } {
[mips_arch_list_matching mips1 !singlefloat]
run_dump_test "mips16-vis-1"
- run_dump_test "call-nonpic-1"
+ # Irix sets use_e_mips_abi_o32=0. See gas/configure.ac.
+ run_dump_test "call-nonpic-1${imips}"
run_dump_test "mips32-sync"
run_dump_test_arches "mips32r2-sync" [lsort -dictionary -unique [concat \
[mips_arch_list_matching mips32r2] \
@@ -2187,4 +2188,10 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "global-local-symtab-sort-n32${tmips}"
run_dump_test "global-local-symtab-sort-n64${tmips}"
}
+
+ # Gas doesn't generate .pdr section for Irix objects by default.
+ # See `int mips_flag_pdr` in tc-mips.c.
+ if [istarget *-*-irix*] {
+ run_dump_test "irix-no-pdr"
+ }
}
new file mode 100644
@@ -0,0 +1,50 @@
+#objdump: -rst --special-syms -mips16
+#name: MIPS16 reloc
+#as: -32 -mips16 -mips32 -mpdr
+#source: mips16-e.s
+
+# 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.
+
+# Check MIPS16 reloc processing
+
+.*: +file format elf.*mips.*
+
+SYMBOL TABLE:
+0+0000000 l d \.text 0+0000000 (|\.text)
+0+0000000 l d \.data 0+0000000 (|\.data)
+0+0000000 l d \.bss 0+0000000 (|\.bss)
+0+0000000 l d foo 0+0000000 (|foo)
+0+0000000 l d \.reginfo 0+0000000 (|\.reginfo)
+0+0000000 l d \.MIPS\.abiflags 0+0000000 (|\.MIPS\.abiflags)
+0+0000000 l d \.(mdebug|pdr) 0+0000000 (|\.mdebug|\.pdr)
+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 O \*UND\* 0+0000000 g1
+
+
+RELOCATION RECORDS FOR \[foo\]:
+OFFSET +TYPE +VALUE
+0+0000000 R_MIPS_32 l1
+0+0000004 R_MIPS_32 l1
+0+0000008 R_MIPS_32 \.L1.*1
+0+000000c R_MIPS_32 \.L1.*1
+0+0000010 R_MIPS_32 g1
+0+0000014 R_MIPS_32 g1
+
+
+Contents of section \.text:
+ 0000 65006500 65006500 65006500 65006500 .*
+Contents of section \.reginfo:
+ 0000 00010000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 .*
+Contents of section \.MIPS\.abiflags:
+ .*
+ .*
+Contents of section foo:
+ 0000 00000000 00000008 00000000 00000003 .*
+ 0010 00000000 00000008 00000000 00000000 .*
+Contents of section \.gnu\.attributes:
+ .*
@@ -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
@@ -1,6 +1,6 @@
#objdump: -rst -mips16
#name: MIPS16 reloc 2
-#as: -32 -mips16 -mips32
+#as: -32 -mips16 -mips32 -mpdr
# Check MIPS16 reloc processing
@@ -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.*