public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: YunQiang Su <yunqiang.su@cipunited.com>
To: binutils@sourceware.org
Cc: syq@debian.org, macro@orcam.me.uk, jiaxun.yang@flygoat.com,
	yunqiang.su@cipunited.com
Subject: [PATCH v3 1/3] MIPS: Fix test failure with FPXX GCC
Date: Sun, 28 Mar 2021 10:35:18 -0400	[thread overview]
Message-ID: <20210328143520.2926076-2-yunqiang.su@cipunited.com> (raw)
In-Reply-To: <20210328143520.2926076-1-yunqiang.su@cipunited.com>

GCC can be configured as FPXX default, which requires MIPS II.
This make `as' (default to MIPS I) fails to run some test.

To fix this, we pass -mfp32 option to GCC.

ChangeLog:
2021-03-28  YunQiang Su  <yunqiang.su@cipunited.com>
        * ld/testsuite/ld-elf/elf.exp: Set "-mfp32" CFLAGS for mips32
        * ld/testsuite/ld-elf/shared.exp: Likewise
        * ld/testsuite/ld-elf/tls.exp: Likewise
        * ld/testsuite/ld-elfvers/vers.exp: Likewise
---
 ld/testsuite/ld-elf/elf.exp      |  8 ++++++++
 ld/testsuite/ld-elf/shared.exp   |  5 +++++
 ld/testsuite/ld-elf/tls.exp      | 12 ++++++++++++
 ld/testsuite/ld-elfvers/vers.exp |  7 +++++++
 4 files changed, 32 insertions(+)

diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index e98bffc0c5f..37d49faa3c0 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -421,6 +421,13 @@ run_cc_link_tests [list \
     ] \
 ]
 
+set old_cflags $CFLAGS
+if { [istarget "mips-*-*"]
+     || [istarget "mipsel-*-*"] } {
+    # the default target of as is MIPS I, which has no ldc1/sdc1
+    # the gcc may be set as fpxx/fp64 default, which require mips2+
+    append CFLAGS " -mfp32"
+}
 run_ld_link_tests [list \
     [list \
 	"Build pr26391-5.o" \
@@ -446,6 +453,7 @@ run_ld_link_tests [list \
 	"-ffunction-sections" \
     ] \
 ]
+set CFLAGS $old_cflags
 
 run_ld_link_exec_tests [list \
     [list \
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 6bf49785a55..ef67e3b8e29 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -941,6 +941,10 @@ run_cc_link_tests [list \
     ] \
 ]
 
+set old_CFLAGS $CFLAGS
+if { [istarget "mips-*-*"] || [istarget "mipsel-*-*"] } {
+    append CFLAGS " -mfp32"
+}
 run_ld_link_tests [list \
     [list \
 	"pr22269-1 (static pie undefined weak)" \
@@ -953,6 +957,7 @@ run_ld_link_tests [list \
 	"-fPIE -O2 $NOSANITIZE_CFLAGS" \
     ] \
 ]
+set CFLAGS $old_CFLAGS
 
 set run_tests [list \
     [list "Run normal with libfoo.so" \
diff --git a/ld/testsuite/ld-elf/tls.exp b/ld/testsuite/ld-elf/tls.exp
index 1351a274cc4..dfa3f50ecb6 100644
--- a/ld/testsuite/ld-elf/tls.exp
+++ b/ld/testsuite/ld-elf/tls.exp
@@ -39,6 +39,15 @@ if [istarget "sparc*-*-*"] {
     append AFLAGS_PIC " -K PIC -Av9"
 }
 
+set old_CFLAGS $CFLAGS
+set old_ASFLAGS $ASFLAGS
+if [istarget "mips*-*"] {
+    # FIXME: gcc's bug, it always generate `rdhwr'
+    # even for target that has no such instrcution
+    append CFLAGS " -mfp32 -mips32r2 -mabi=32"
+    append ASFLAGS " -mips32r2"
+}
+
 run_ld_link_tests [list \
     [list \
 	"Build pr22263-1" \
@@ -51,3 +60,6 @@ run_ld_link_tests [list \
 	"-fPIE -O2 $NOSANITIZE_CFLAGS" \
     ] \
 ]
+
+set CFLAGS $old_CFLAGS
+set ASFLAGS $old_ASFLAGS
diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp
index 8a1383fe840..63127a46d25 100644
--- a/ld/testsuite/ld-elfvers/vers.exp
+++ b/ld/testsuite/ld-elfvers/vers.exp
@@ -777,6 +777,11 @@ if { [istarget x86_64-*-linux*] \
     set pic "no"
 }
 
+set old_CFLAGS $CFLAGS
+if { [istarget "mips-*-*"] || [istarget "mipsel-*-*"] } {
+    append CFLAGS " -mfp32"
+}
+
 #
 # Basic test - build a library with versioned symbols.
 #
@@ -1006,3 +1011,5 @@ build_vers_lib_pic "vers31" vers31.c vers31 "" vers31.map vers31.ver vers31.dsym
 # Test #32 -- linker --defsym
 build_vers_lib_pic "vers32a" vers32a.c vers32a "" vers32.map vers32a.ver vers32a.dsym ""
 build_vers_lib_pic_flags "vers32b" vers32b.c vers32b "vers32a.so" vers32.map vers32b.ver vers32b.dsym "" "--defsym foo=0"
+
+set CFLAGS $old_CFLAGS
-- 
2.30.2


  reply	other threads:[~2021-03-28 14:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-28 14:35 [PATCH v3 0/3] MIPS: default output isa rev base on configuration YunQiang Su
2021-03-28 14:35 ` YunQiang Su [this message]
2021-03-28 14:35 ` [PATCH v3 2/3] MIPS: default output r6 object if configured to r6 YunQiang Su
2021-03-28 14:35 ` [PATCH v3 3/3] MIPS: Fix testcase for MIPSr6 YunQiang Su
2021-03-30  6:41 ` [PATCH v3 0/3] MIPS: default output isa rev base on configuration YunQiang Su

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=20210328143520.2926076-2-yunqiang.su@cipunited.com \
    --to=yunqiang.su@cipunited.com \
    --cc=binutils@sourceware.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=macro@orcam.me.uk \
    --cc=syq@debian.org \
    /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).