[PATCH v3 1/3] MIPS: Fix test failure with FPXX GCC
YunQiang Su
yunqiang.su@cipunited.com
Sun Mar 28 14:35:18 GMT 2021
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
More information about the Binutils
mailing list