public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets
@ 2023-06-05 10:22 YunQiang Su
  2023-06-05 10:22 ` [PATCH 2/2] MIPS: fix Irix gas testcases YunQiang Su
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: YunQiang Su @ 2023-06-05 10:22 UTC (permalink / raw)
  To: binutils; +Cc: amodra, YunQiang Su

For triples mips*-elf without vendor, such as mipsisa32r2el-elf,
mipstx39-elf, the NUBI is used. These targets use non-trad VECs.

Currently, N32 VECs are missing from targ_selvecs in bfd/config.bfd.
Let's add them.

This patch also fixes gas testcases for these targets.

bfd:
	* config.bfd (mips*-*-elf*): add N32 VECs.
	(mips*el-*-elf*): Ditto.
---
 bfd/config.bfd                           | 4 ++--
 gas/testsuite/gas/mips/comdat-reloc-r6.d | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bfd/config.bfd b/bfd/config.bfd
index 78752994456..2927f35b614 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -923,11 +923,11 @@ case "${targ}" in
     ;;
   mips*el-*-elf* | mips*-*-chorus*)
     targ_defvec=mips_elf32_le_vec
-    targ_selvecs="mips_elf32_be_vec mips_elf64_be_vec mips_elf64_le_vec"
+    targ_selvecs="mips_elf32_be_vec mips_elf64_be_vec mips_elf64_le_vec mips_elf32_n_be_vec mips_elf32_n_le_vec"
     ;;
   mips*-*-elf* | mips*-*-rtems* | mips*-*-windiss | mips*-*-none)
     targ_defvec=mips_elf32_be_vec
-    targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec"
+    targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_elf32_n_be_vec mips_elf32_n_le_vec"
     ;;
   mips64*-*-openbsd*)
     targ_defvec=mips_elf64_trad_be_vec
diff --git a/gas/testsuite/gas/mips/comdat-reloc-r6.d b/gas/testsuite/gas/mips/comdat-reloc-r6.d
index 513589e73d3..f7d9a4e57c0 100644
--- a/gas/testsuite/gas/mips/comdat-reloc-r6.d
+++ b/gas/testsuite/gas/mips/comdat-reloc-r6.d
@@ -26,9 +26,9 @@ Relocation section '\.rel\.text\.bar' at offset .+ contains .+ entries:
  Offset     Info    Type            Sym\.Value  Sym\. Name
 00000000  ......05 R_MIPS_HI16       00000000   _gp_disp
 00000004  ......06 R_MIPS_LO16       00000000   _gp_disp
-0000000c  0000070a R_MIPS_PC16       00000020   \.L1\^B1
+0000000c  00000[7d]0a R_MIPS_PC16       00000020   \.L1\^B1
 00000014  ......09 R_MIPS_GOT16      00000000   foo
 00000024  ......09 R_MIPS_GOT16      00000000   foo
 0000001c  ......06 R_MIPS_LO16       00000000   foo
-00000020  0000080a R_MIPS_PC16       00000018   \.L0\^B1
+00000020  00000[8e]0a R_MIPS_PC16       00000018   \.L0\^B1
 #pass
-- 
2.30.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] MIPS: fix Irix gas testcases
  2023-06-05 10:22 [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets YunQiang Su
@ 2023-06-05 10:22 ` YunQiang Su
  2023-06-05 23:38   ` Maciej W. Rozycki
  2023-06-05 23:37 ` [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets Maciej W. Rozycki
  2023-06-06  4:03 ` [PATCH v2 1/3] MIPS: disable fix-rm7000-2 and llpscp-64 if not has_newabi YunQiang Su
  2 siblings, 1 reply; 9+ messages in thread
From: YunQiang Su @ 2023-06-05 10:22 UTC (permalink / raw)
  To: binutils; +Cc: amodra, YunQiang Su

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets
  2023-06-05 10:22 [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets YunQiang Su
  2023-06-05 10:22 ` [PATCH 2/2] MIPS: fix Irix gas testcases YunQiang Su
@ 2023-06-05 23:37 ` Maciej W. Rozycki
  2023-06-06  3:24   ` YunQiang Su
  2023-06-06  4:03 ` [PATCH v2 1/3] MIPS: disable fix-rm7000-2 and llpscp-64 if not has_newabi YunQiang Su
  2 siblings, 1 reply; 9+ messages in thread
From: Maciej W. Rozycki @ 2023-06-05 23:37 UTC (permalink / raw)
  To: YunQiang Su; +Cc: binutils, Alan Modra

On Mon, 5 Jun 2023, YunQiang Su wrote:

> For triples mips*-elf without vendor, such as mipsisa32r2el-elf,
> mipstx39-elf, the NUBI is used. These targets use non-trad VECs.

 I guess you mean the IRIX variant of the psABI.  NUBI has never been 
deployed.

> Currently, N32 VECs are missing from targ_selvecs in bfd/config.bfd.
> Let's add them.

 NAK, the submitters of these targets had their reasons not to include 
n32.

> This patch also fixes gas testcases for these targets.

 This is backwards.  Any irrelevant tests just need to be disabled for 
targets that do not have n32 support enabled.

 Please follow the ${has_newabi} approach for now, or if you can be 
bothered port binutils/testsuite/binutils-all/mips/mips.exp approach, 
which I implemented a while ago that is cleaner (it has an advantage of 
also supporting targets that do not have o32 support enabled; yes, we do 
have such ones too).

> diff --git a/gas/testsuite/gas/mips/comdat-reloc-r6.d b/gas/testsuite/gas/mips/comdat-reloc-r6.d
> index 513589e73d3..f7d9a4e57c0 100644
> --- a/gas/testsuite/gas/mips/comdat-reloc-r6.d
> +++ b/gas/testsuite/gas/mips/comdat-reloc-r6.d
> @@ -26,9 +26,9 @@ Relocation section '\.rel\.text\.bar' at offset .+ contains .+ entries:
>   Offset     Info    Type            Sym\.Value  Sym\. Name
>  00000000  ......05 R_MIPS_HI16       00000000   _gp_disp
>  00000004  ......06 R_MIPS_LO16       00000000   _gp_disp
> -0000000c  0000070a R_MIPS_PC16       00000020   \.L1\^B1
> +0000000c  00000[7d]0a R_MIPS_PC16       00000020   \.L1\^B1
>  00000014  ......09 R_MIPS_GOT16      00000000   foo
>  00000024  ......09 R_MIPS_GOT16      00000000   foo
>  0000001c  ......06 R_MIPS_LO16       00000000   foo
> -00000020  0000080a R_MIPS_PC16       00000018   \.L0\^B1
> +00000020  00000[8e]0a R_MIPS_PC16       00000018   \.L0\^B1
>  #pass

 Where do these differences come from?

  Maciej

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] MIPS: fix Irix gas testcases
  2023-06-05 10:22 ` [PATCH 2/2] MIPS: fix Irix gas testcases YunQiang Su
@ 2023-06-05 23:38   ` Maciej W. Rozycki
  0 siblings, 0 replies; 9+ messages in thread
From: Maciej W. Rozycki @ 2023-06-05 23:38 UTC (permalink / raw)
  To: YunQiang Su; +Cc: binutils, Alan Modra

On Mon, 5 Jun 2023, YunQiang Su 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.

 Non-PDR variants of the respective dumps need to be added then, veryfying 
that PDR data is not produced where applicable.  We have prior art in the 
testsuite for such arrangements; cf. ${imips}.  This can be reused for all 
IRIX psABI targets.

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

 This needs to be verified then too.

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

 This is minor enough, so probably OK.  It might be worth checking if it's 
covered elsewhere.

 Please use correct capitalisation; in English sentences start with a 
capital letter.  Also use two spaces after every full stop as per the GNU 
Coding Standards.  This applies both to change headings/descriptions and 
pieces of text included with the change proper.

  Maciej

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets
  2023-06-05 23:37 ` [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets Maciej W. Rozycki
@ 2023-06-06  3:24   ` YunQiang Su
  2023-06-06 16:57     ` Maciej W. Rozycki
  0 siblings, 1 reply; 9+ messages in thread
From: YunQiang Su @ 2023-06-06  3:24 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: YunQiang Su, binutils, Alan Modra

Maciej W. Rozycki <macro@orcam.me.uk> 于2023年6月6日周二 07:37写道:
>
> On Mon, 5 Jun 2023, YunQiang Su wrote:
>
> > For triples mips*-elf without vendor, such as mipsisa32r2el-elf,
> > mipstx39-elf, the NUBI is used. These targets use non-trad VECs.
>
>  I guess you mean the IRIX variant of the psABI.  NUBI has never been
> deployed.
>

Ohh, yes.

> > Currently, N32 VECs are missing from targ_selvecs in bfd/config.bfd.
> > Let's add them.
>
>  NAK, the submitters of these targets had their reasons not to include
> n32.
>

Ohh, it is reasonable. You are right.
anyway, nobody is using this triple as far as I know.
Just block these tests won't be a problem.

> > This patch also fixes gas testcases for these targets.
>
>  This is backwards.  Any irrelevant tests just need to be disabled for
> targets that do not have n32 support enabled.
>

I will update my patch.

>  Please follow the ${has_newabi} approach for now, or if you can be
> bothered port binutils/testsuite/binutils-all/mips/mips.exp approach,
> which I implemented a while ago that is cleaner (it has an advantage of
> also supporting targets that do not have o32 support enabled; yes, we do
> have such ones too).
>
> > diff --git a/gas/testsuite/gas/mips/comdat-reloc-r6.d b/gas/testsuite/gas/mips/comdat-reloc-r6.d
> > index 513589e73d3..f7d9a4e57c0 100644
> > --- a/gas/testsuite/gas/mips/comdat-reloc-r6.d
> > +++ b/gas/testsuite/gas/mips/comdat-reloc-r6.d
> > @@ -26,9 +26,9 @@ Relocation section '\.rel\.text\.bar' at offset .+ contains .+ entries:
> >   Offset     Info    Type            Sym\.Value  Sym\. Name
> >  00000000  ......05 R_MIPS_HI16       00000000   _gp_disp
> >  00000004  ......06 R_MIPS_LO16       00000000   _gp_disp
> > -0000000c  0000070a R_MIPS_PC16       00000020   \.L1\^B1
> > +0000000c  00000[7d]0a R_MIPS_PC16       00000020   \.L1\^B1
> >  00000014  ......09 R_MIPS_GOT16      00000000   foo
> >  00000024  ......09 R_MIPS_GOT16      00000000   foo
> >  0000001c  ......06 R_MIPS_LO16       00000000   foo
> > -00000020  0000080a R_MIPS_PC16       00000018   \.L0\^B1
> > +00000020  00000[8e]0a R_MIPS_PC16       00000018   \.L0\^B1
> >  #pass
>
>  Where do these differences come from?
>

It looks like that the order of symbols is different.
I will edit comdat-reloc-r6.d, use `.' for the SYM index section in r_info,
just like other symbols.

Symbol table '.symtab' contains 15 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 SECTION LOCAL  DEFAULT    2 .text
     2: 00000000     0 SECTION LOCAL  DEFAULT    3 .data
     3: 00000000     0 SECTION LOCAL  DEFAULT    4 .bss
     4: 00000000     0 SECTION LOCAL  DEFAULT    7 .text.foo
     5: 00000000     8 FUNC    LOCAL  DEFAULT    7 foo
     6: 00000000     0 SECTION LOCAL  DEFAULT    8 .text.bar
     7: 00000020     0 NOTYPE  LOCAL  DEFAULT    8 .L1^B1
     8: 00000018     0 NOTYPE  LOCAL  DEFAULT    8 .L^B1
     9: 00000000     0 SECTION LOCAL  DEFAULT    5 .reginfo
    10: 00000000     0 SECTION LOCAL  DEFAULT    6 .MIPS.abiflags
    11: 00000000     0 SECTION LOCAL  DEFAULT   10 .gnu.attributes
    12: 00000000     0 SECTION LOCAL  DEFAULT    1 .group
    13: 00000000    40 FUNC    GLOBAL DEFAULT    8 bar
    14: 00000000     0 OBJECT  GLOBAL DEFAULT  UND _gp_disp

vs

Symbol table '.symtab' contains 15 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 SECTION LOCAL  DEFAULT    2 .text
     2: 00000000     0 SECTION LOCAL  DEFAULT    3 .data
     3: 00000000     0 SECTION LOCAL  DEFAULT    4 .bss
     4: 00000000     0 SECTION LOCAL  DEFAULT    7 .text.foo
     5: 00000000     0 SECTION LOCAL  DEFAULT    8 .text.bar
     6: 00000000     0 SECTION LOCAL  DEFAULT    5 .reginfo
     7: 00000000     0 SECTION LOCAL  DEFAULT    6 .MIPS.abiflags
     8: 00000000     0 SECTION LOCAL  DEFAULT   10 .gnu.attributes
     9: 00000000     0 SECTION LOCAL  DEFAULT    1 .group
    10: 00000000     8 FUNC    LOCAL  DEFAULT    7 foo
    11: 00000000    40 FUNC    GLOBAL DEFAULT    8 bar
    12: 00000000     0 OBJECT  GLOBAL DEFAULT  UND _gp_disp
    13: 00000020     0 NOTYPE  LOCAL  DEFAULT    8 .L1^B1
    14: 00000018     0 NOTYPE  LOCAL  DEFAULT    8 .L0^B1

>   Maciej



-- 
YunQiang Su

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/3] MIPS: disable fix-rm7000-2 and llpscp-64 if not has_newabi
  2023-06-05 10:22 [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets YunQiang Su
  2023-06-05 10:22 ` [PATCH 2/2] MIPS: fix Irix gas testcases YunQiang Su
  2023-06-05 23:37 ` [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets Maciej W. Rozycki
@ 2023-06-06  4:03 ` YunQiang Su
  2023-06-06  4:03   ` [PATCH v2 2/3] MIPS: Ignore the symbol index for comdat-reloc-r6.d YunQiang Su
  2023-06-06  4:03   ` [PATCH v2 3/3] MIPS: Fix Irix gas testcases YunQiang Su
  2 siblings, 2 replies; 9+ messages in thread
From: YunQiang Su @ 2023-06-06  4:03 UTC (permalink / raw)
  To: binutils; +Cc: amodra, macro, YunQiang Su

Some triples may disable N32 support, such as mips*-elf without
vendor: mipsisa32r2el-elf and mipstx39-elf included.

Let's disable the testcases need N32 support if not has_newabi.
---
 gas/testsuite/gas/mips/mips.exp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 0ea673906a7..178349ecc03 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -743,10 +743,10 @@ if { [istarget mips*-*-vxworks*] } {
 	run_dump_test_arches "fix-rm7000-1" \
 					[mips_arch_list_matching mips3 !singlefloat \
 						!mips64r6]
-    }
-    run_dump_test_arches "fix-rm7000-2" \
+	run_dump_test_arches "fix-rm7000-2" \
 					[mips_arch_list_matching mips3 !singlefloat \
 						!mips64r6]
+    }
     run_dump_test_arches "24k-branch-delay-1" \
 					[mips_arch_list_matching mips1]
     run_dump_test_arches "24k-triple-stores-1" \
@@ -2154,7 +2154,9 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "ginv-err"	[mips_arch_list_matching mips32r6]
 
     run_dump_test_arches "llpscp-32" [mips_arch_list_matching mips32r6]
-    run_dump_test_arch "llpscp-64" "" mips64r6
+    if $has_newabi {
+	run_dump_test_arch "llpscp-64" "" mips64r6
+    }
 
     run_dump_test "pr14798${imips}"
     run_dump_test "insn-isa-mode"
-- 
2.30.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 2/3] MIPS: Ignore the symbol index for comdat-reloc-r6.d
  2023-06-06  4:03 ` [PATCH v2 1/3] MIPS: disable fix-rm7000-2 and llpscp-64 if not has_newabi YunQiang Su
@ 2023-06-06  4:03   ` YunQiang Su
  2023-06-06  4:03   ` [PATCH v2 3/3] MIPS: Fix Irix gas testcases YunQiang Su
  1 sibling, 0 replies; 9+ messages in thread
From: YunQiang Su @ 2023-06-06  4:03 UTC (permalink / raw)
  To: binutils; +Cc: amodra, macro, YunQiang Su

The order of symbols, is different between triples with or without
trad.

trad:
Symbol table '.symtab' contains 15 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 SECTION LOCAL  DEFAULT    2 .text
     2: 00000000     0 SECTION LOCAL  DEFAULT    3 .data
     3: 00000000     0 SECTION LOCAL  DEFAULT    4 .bss
     4: 00000000     0 SECTION LOCAL  DEFAULT    7 .text.foo
     5: 00000000     8 FUNC    LOCAL  DEFAULT    7 foo
     6: 00000000     0 SECTION LOCAL  DEFAULT    8 .text.bar
     7: 00000020     0 NOTYPE  LOCAL  DEFAULT    8 .L1^B1
     8: 00000018     0 NOTYPE  LOCAL  DEFAULT    8 .L^B1
     9: 00000000     0 SECTION LOCAL  DEFAULT    5 .reginfo
    10: 00000000     0 SECTION LOCAL  DEFAULT    6 .MIPS.abiflags
    11: 00000000     0 SECTION LOCAL  DEFAULT   10 .gnu.attributes
    12: 00000000     0 SECTION LOCAL  DEFAULT    1 .group
    13: 00000000    40 FUNC    GLOBAL DEFAULT    8 bar
    14: 00000000     0 OBJECT  GLOBAL DEFAULT  UND _gp_disp

non-trad, aka Irix psABI:
Symbol table '.symtab' contains 15 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 SECTION LOCAL  DEFAULT    2 .text
     2: 00000000     0 SECTION LOCAL  DEFAULT    3 .data
     3: 00000000     0 SECTION LOCAL  DEFAULT    4 .bss
     4: 00000000     0 SECTION LOCAL  DEFAULT    7 .text.foo
     5: 00000000     0 SECTION LOCAL  DEFAULT    8 .text.bar
     6: 00000000     0 SECTION LOCAL  DEFAULT    5 .reginfo
     7: 00000000     0 SECTION LOCAL  DEFAULT    6 .MIPS.abiflags
     8: 00000000     0 SECTION LOCAL  DEFAULT   10 .gnu.attributes
     9: 00000000     0 SECTION LOCAL  DEFAULT    1 .group
    10: 00000000     8 FUNC    LOCAL  DEFAULT    7 foo
    11: 00000000    40 FUNC    GLOBAL DEFAULT    8 bar
    12: 00000000     0 OBJECT  GLOBAL DEFAULT  UND _gp_disp
    13: 00000020     0 NOTYPE  LOCAL  DEFAULT    8 .L1^B1
    14: 00000018     0 NOTYPE  LOCAL  DEFAULT    8 .L0^B1
---
 gas/testsuite/gas/mips/comdat-reloc-r6.d | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gas/testsuite/gas/mips/comdat-reloc-r6.d b/gas/testsuite/gas/mips/comdat-reloc-r6.d
index 513589e73d3..5b3bc3aee63 100644
--- a/gas/testsuite/gas/mips/comdat-reloc-r6.d
+++ b/gas/testsuite/gas/mips/comdat-reloc-r6.d
@@ -26,9 +26,9 @@ Relocation section '\.rel\.text\.bar' at offset .+ contains .+ entries:
  Offset     Info    Type            Sym\.Value  Sym\. Name
 00000000  ......05 R_MIPS_HI16       00000000   _gp_disp
 00000004  ......06 R_MIPS_LO16       00000000   _gp_disp
-0000000c  0000070a R_MIPS_PC16       00000020   \.L1\^B1
+0000000c  ......0a R_MIPS_PC16       00000020   \.L1\^B1
 00000014  ......09 R_MIPS_GOT16      00000000   foo
 00000024  ......09 R_MIPS_GOT16      00000000   foo
 0000001c  ......06 R_MIPS_LO16       00000000   foo
-00000020  0000080a R_MIPS_PC16       00000018   \.L0\^B1
+00000020  ......0a R_MIPS_PC16       00000018   \.L0\^B1
 #pass
-- 
2.30.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 3/3] MIPS: Fix Irix gas testcases
  2023-06-06  4:03 ` [PATCH v2 1/3] MIPS: disable fix-rm7000-2 and llpscp-64 if not has_newabi YunQiang Su
  2023-06-06  4:03   ` [PATCH v2 2/3] MIPS: Ignore the symbol index for comdat-reloc-r6.d YunQiang Su
@ 2023-06-06  4:03   ` YunQiang Su
  1 sibling, 0 replies; 9+ messages in thread
From: YunQiang Su @ 2023-06-06  4:03 UTC (permalink / raw)
  To: binutils; +Cc: amodra, macro, YunQiang Su

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

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 178349ecc03..3ba0af7325f 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -1251,7 +1251,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"
@@ -1551,7 +1551,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] \
@@ -2169,4 +2170,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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets
  2023-06-06  3:24   ` YunQiang Su
@ 2023-06-06 16:57     ` Maciej W. Rozycki
  0 siblings, 0 replies; 9+ messages in thread
From: Maciej W. Rozycki @ 2023-06-06 16:57 UTC (permalink / raw)
  To: YunQiang Su; +Cc: YunQiang Su, binutils, Alan Modra

On Tue, 6 Jun 2023, YunQiang Su wrote:

> > > diff --git a/gas/testsuite/gas/mips/comdat-reloc-r6.d b/gas/testsuite/gas/mips/comdat-reloc-r6.d
> > > index 513589e73d3..f7d9a4e57c0 100644
> > > --- a/gas/testsuite/gas/mips/comdat-reloc-r6.d
> > > +++ b/gas/testsuite/gas/mips/comdat-reloc-r6.d
> > > @@ -26,9 +26,9 @@ Relocation section '\.rel\.text\.bar' at offset .+ contains .+ entries:
> > >   Offset     Info    Type            Sym\.Value  Sym\. Name
> > >  00000000  ......05 R_MIPS_HI16       00000000   _gp_disp
> > >  00000004  ......06 R_MIPS_LO16       00000000   _gp_disp
> > > -0000000c  0000070a R_MIPS_PC16       00000020   \.L1\^B1
> > > +0000000c  00000[7d]0a R_MIPS_PC16       00000020   \.L1\^B1
> > >  00000014  ......09 R_MIPS_GOT16      00000000   foo
> > >  00000024  ......09 R_MIPS_GOT16      00000000   foo
> > >  0000001c  ......06 R_MIPS_LO16       00000000   foo
> > > -00000020  0000080a R_MIPS_PC16       00000018   \.L0\^B1
> > > +00000020  00000[8e]0a R_MIPS_PC16       00000018   \.L0\^B1
> > >  #pass
> >
> >  Where do these differences come from?
> 
> It looks like that the order of symbols is different.

 Right, the IRIX psABI wants symbols to be sorted according to a different 
rule; this is probably the most prominent divergence between the two MIPS 
psABIs.  It did not occur to me it is the symbol indices that are involved 
here.

 The difference in symbol indices would have best been mentioned in the 
change description: these descriptions are meant to make it easier to the 
reviewer to understand the change and to convince them that the change is 
indeed correct.

 And the easier a review is the quicker you will get it.  If it takes a 
minute and just reading through the submission to decide that a change is 
correct, then you you will get your change reviewed quickly.  If one has 
to wade through sources to collect bits of information so as to understand 
what the change is really about, then the likelihood of a fast review goes 
down very quickly.

 Good coding style also helps as one doesn't get distracted by mechanical 
clean-ups.

> I will edit comdat-reloc-r6.d, use `.' for the SYM index section in r_info,
> just like other symbols.

 It is the correct approach given how the original test has been written. 
It is also a fix to a recent addition, which just shows why getting things 
properly reviewed is so important.

  Maciej

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-06-06 16:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05 10:22 [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets YunQiang Su
2023-06-05 10:22 ` [PATCH 2/2] MIPS: fix Irix gas testcases YunQiang Su
2023-06-05 23:38   ` Maciej W. Rozycki
2023-06-05 23:37 ` [PATCH 1/2] MIPS: Add n32 VECs to non-vendor elf targets Maciej W. Rozycki
2023-06-06  3:24   ` YunQiang Su
2023-06-06 16:57     ` Maciej W. Rozycki
2023-06-06  4:03 ` [PATCH v2 1/3] MIPS: disable fix-rm7000-2 and llpscp-64 if not has_newabi YunQiang Su
2023-06-06  4:03   ` [PATCH v2 2/3] MIPS: Ignore the symbol index for comdat-reloc-r6.d YunQiang Su
2023-06-06  4:03   ` [PATCH v2 3/3] MIPS: Fix Irix gas testcases YunQiang Su

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