public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: YunQiang Su <yunqiang.su@cipunited.com>
To: nickc@redhat.com
Cc: binutils@sourceware.org, YunQiang Su <yunqiang.su@cipunited.com>
Subject: [PATCH v3] MIPS: Fix Irix gas testcases about pdr section
Date: Tue, 14 Nov 2023 19:10:29 +0800	[thread overview]
Message-ID: <20231114111029.1867580-1-yunqiang.su@cipunited.com> (raw)

1. Add -mpdr option to cases, which expect .pdr section existing.
   Gas doesn't generate .pdr section for Irix objects by default.
   See `int mips_flag_pdr` in tc-mips.c.
   Add -mpdr into #as section:
	mips/mips16-e.d, mips/mips16-f.d
	mips/elf-rel26.d, mips16-hilo-match;
   Add -mpdr if target is mips*-*-irix*:
	elf/elf.exp.

2. Add irix-no-pdr.d testcase to make sure no .pdr section is
   generated for Irix by default.
---
 gas/testsuite/gas/elf/elf.exp              | 4 ++++
 gas/testsuite/gas/mips/elf-rel26.d         | 2 +-
 gas/testsuite/gas/mips/irix-no-pdr.d       | 8 ++++++++
 gas/testsuite/gas/mips/mips.exp            | 6 ++++++
 gas/testsuite/gas/mips/mips16-e-irix.d     | 3 +--
 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 +-
 8 files changed, 23 insertions(+), 6 deletions(-)
 create mode 100644 gas/testsuite/gas/mips/irix-no-pdr.d

diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index c42cef8160e..d85fdddc841 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -208,6 +208,10 @@ if { [is_elf_format] } then {
 	    riscv*-*-* {
 		set as_flags "$as_flags -march-attr"
 	    }
+	    mips*-*-irix* {
+		# 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/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 0611273cac6..dca0160597a 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -2174,4 +2174,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
index 52459cb97f7..2491685364b 100644
--- a/gas/testsuite/gas/mips/mips16-e-irix.d
+++ b/gas/testsuite/gas/mips/mips16-e-irix.d
@@ -18,10 +18,9 @@ SYMBOL TABLE:
 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 \.L11
+0+0000004 l       \.text	0+0000000 0xf0 \.L1.*1
 0+0000000       O \*UND\*	0+0000000 g1
 
 
diff --git a/gas/testsuite/gas/mips/mips16-e.d b/gas/testsuite/gas/mips/mips16-e.d
index d64b882c81c..0f954e8e25c 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
+#as: -32 -mips16 -mips1 -mpdr
 
 # Check MIPS16 reloc processing
 
diff --git a/gas/testsuite/gas/mips/mips16-f.d b/gas/testsuite/gas/mips/mips16-f.d
index 9605b6f183e..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
+#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.39.2


                 reply	other threads:[~2023-11-14 11:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231114111029.1867580-1-yunqiang.su@cipunited.com \
    --to=yunqiang.su@cipunited.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).