[binutils-gdb] "eqv involving dot" gas test and pdp11

Alan Modra via Binutils-cvs <[email protected]>
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f8c55f43244a6ffef09526b80a66d80067ac03d1

commit f8c55f43244a6ffef09526b80a66d80067ac03d1
Author: Alan Modra <[email protected]>
Date:   Sun May 24 14:25:10 2026 +0930

    "eqv involving dot" gas test and pdp11
    
    This changes the eqv-dot test to make 'x' non-zero, so targets
    (eg. i386-darwin) that silently ignore the value of fx_subsy in fixups
    will fail the test.
    
    When updating the test I noticed seriously odd expected output for
    pdp11.  Why should .long write in different byte order when needing
    fixups (".long z")?  That appears to be a bug in the pdp11
    md_apply_fix, which reads section contents using pdp-endian but writes
    them little-endian.  Fix that too.
    
    gas/
            * config/tc-pdp11.c (md_apply_fix): Use md_mumber_to_chars.
            * testsuite/gas/all/eqv-dot.s: Move x to second .long.
            * testsuite/gas/all/eqv-dot.d: Update expected result.
            * testsuite/gas/all/eqv-dot-pdp11.d: Likewise, and use
            source directive.
            * testsuite/gas/all/eqv-dot-pdp11.s: Delete.
            * testsuite/gas/all/gas.exp (do_930509a): Support pdp11.
            * testsuite/gas/all/simple-forward.d: Likewise.

Diff:
---
 gas/config/tc-pdp11.c                  | 2 +-
 gas/testsuite/gas/all/eqv-dot-pdp11.d  | 5 +++--
 gas/testsuite/gas/all/eqv-dot-pdp11.s  | 8 --------
 gas/testsuite/gas/all/eqv-dot.d        | 4 ++--
 gas/testsuite/gas/all/eqv-dot.s        | 3 ++-
 gas/testsuite/gas/all/gas.exp          | 3 ++-
 gas/testsuite/gas/all/simple-forward.d | 2 +-
 7 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index ed703bf227a..d017d341fd8 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -287,7 +287,7 @@ md_apply_fix (fixS *fixP,
 
   code &= ~mask;
   code |= (val >> shift) & mask;
-  number_to_chars_littleendian (buf, code, size);
+  md_number_to_chars (buf, code, size);
 
   if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
     fixP->fx_done = 1;
diff --git a/gas/testsuite/gas/all/eqv-dot-pdp11.d b/gas/testsuite/gas/all/eqv-dot-pdp11.d
index 0e2ddcdbcf9..97036432b3a 100644
--- a/gas/testsuite/gas/all/eqv-dot-pdp11.d
+++ b/gas/testsuite/gas/all/eqv-dot-pdp11.d
@@ -1,3 +1,4 @@
+#source: eqv-dot.s
 #objdump: -s -j .data
 #name: eqv involving dot (PDP11)
 # Special for PDP11 which is little-endian for octets in shorts
@@ -7,6 +8,6 @@
 .*: .*
 
 Contents of section \.data:
- 0000 0+0000 0+0100 0+0200 0+0c00  .*
- 0010 0+1000 140+ 0+1000 1c0+  .*
+ 0000 0+0000 0+0100 0+0200 0+0800  .*
+ 0010 0+0c00 0+1000 0+0c00 0+1800  .*
 #pass
diff --git a/gas/testsuite/gas/all/eqv-dot-pdp11.s b/gas/testsuite/gas/all/eqv-dot-pdp11.s
deleted file mode 100644
index cd8cb9198b0..00000000000
--- a/gas/testsuite/gas/all/eqv-dot-pdp11.s
+++ /dev/null
@@ -1,8 +0,0 @@
-	.data
-x:	.long 0, 1, 2, . - x
- y = . - x
- z == . - x
-	.long y
-	.long z
-	.long y
-	.long z
diff --git a/gas/testsuite/gas/all/eqv-dot.d b/gas/testsuite/gas/all/eqv-dot.d
index fc40b09f217..e99d503cb1b 100644
--- a/gas/testsuite/gas/all/eqv-dot.d
+++ b/gas/testsuite/gas/all/eqv-dot.d
@@ -10,6 +10,6 @@
 .*: .*
 
 Contents of section \.data:
- 0000 (0+00 0+01 0+02 0+0c|000+ 010+ 020+ 0c0+) .*
- 0010 (0+10 0+14 0+10 0+1c|100+ 140+ 100+ 1c0+) .*
+ 0000 (0+00 0+01 0+02 0+08|000+ 010+ 020+ 080+) .*
+ 0010 (0+0c 0+10 0+0c 0+18|0c0+ 100+ 0c0+ 180+) .*
 #pass
diff --git a/gas/testsuite/gas/all/eqv-dot.s b/gas/testsuite/gas/all/eqv-dot.s
index cd8cb9198b0..6a63670dec7 100644
--- a/gas/testsuite/gas/all/eqv-dot.s
+++ b/gas/testsuite/gas/all/eqv-dot.s
@@ -1,5 +1,6 @@
 	.data
-x:	.long 0, 1, 2, . - x
+	.long 0
+x:	.long 1, 2, . - x
  y = . - x
  z == . - x
 	.long y
diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp
index b99ecdba241..940df901167 100644
--- a/gas/testsuite/gas/all/gas.exp
+++ b/gas/testsuite/gas/all/gas.exp
@@ -262,13 +262,14 @@ proc do_930509a {} {
     set x 0
     gas_start "x930509.s" "-al"
     while 1 {
-# We need to accommodate both byte orders here.
+# We need to accommodate little, big and pdp endian here.
 # If ".long" means an 8-byte value on some target someday, this test will have
 # to be fixed.
 	expect {
 	    -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 }
 	    -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 }
 	    -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 }
+	    -re "^ +1 .... 00 ?00 ?04 ?00" { pass $testname; set x 1 }
 	    -re "\[^\n\]*\n" { }
 	    timeout { perror "timeout\n"; break }
 	    eof { break }
diff --git a/gas/testsuite/gas/all/simple-forward.d b/gas/testsuite/gas/all/simple-forward.d
index 63b4077c1cb..33388be015b 100644
--- a/gas/testsuite/gas/all/simple-forward.d
+++ b/gas/testsuite/gas/all/simple-forward.d
@@ -10,5 +10,5 @@
 .*: .*
 
 Contents of section \.data:
- 0000 0c000000 (0c000000 0c000000|000c0000 0000000c) .*
+ 0000 0c000000 (0c000000 0c000000|000c0000 0000000c|0c000000 00000c00) .*
 #pass
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.