blob: f861646e80fc36fb44db2e4bf62a53db37768537 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001Disable the valgrind helpers which use MIPS floating point operations
2when floating point support is deactivated in the toolchain.
3
4The fix from this commit is not sufficient any more:
5https://sourceware.org/git/?p=valgrind.git;a=commitdiff;h=869fcf2f6739f17b4eff36ec68f8dca826c8afeb
6
7This fixes the following error message when compiling with a GCC 10 MIPS BE 32:
8---------------------------------------------------------
9../VEX/priv/guest_mips_helpers.c: In function 'mips_dirtyhelper_calculate_FCSR_fp32':
10../VEX/priv/guest_mips_helpers.c:640:10: error: the register '$f21' cannot be clobbered in 'asm' for the current target
11 640 | ASM_VOLATILE_UNARY32_DOUBLE(round.w.d)
12 | ^
13---------------------------------------------------------
14
15--- a/VEX/priv/guest_mips_helpers.c
16+++ b/VEX/priv/guest_mips_helpers.c
17@@ -620,6 +620,7 @@ extern UInt mips_dirtyhelper_calculate_F
18 flt_op inst )
19 {
20 UInt ret = 0;
21+#ifndef __mips_soft_float
22 #if defined(__mips__)
23 VexGuestMIPS32State* guest_state = (VexGuestMIPS32State*)gs;
24 UInt loFsVal, hiFsVal, loFtVal, hiFtVal;
25@@ -702,6 +703,7 @@ extern UInt mips_dirtyhelper_calculate_F
26 break;
27 }
28 #endif
29+#endif
30 return ret;
31 }
32
33@@ -711,6 +713,7 @@ extern UInt mips_dirtyhelper_calculate_F
34 flt_op inst )
35 {
36 UInt ret = 0;
37+#ifndef __mips_soft_float
38 #if defined(__mips__) && ((__mips == 64) || \
39 (defined(__mips_isa_rev) && (__mips_isa_rev >= 2)))
40 #if defined(VGA_mips32)
41@@ -863,6 +866,7 @@ extern UInt mips_dirtyhelper_calculate_F
42 break;
43 }
44 #endif
45+#endif
46 return ret;
47 }
48
49--- a/coregrind/m_machine.c
50+++ b/coregrind/m_machine.c
51@@ -2119,6 +2119,7 @@ Bool VG_(machine_get_hwcaps)( void )
52 we are using alternative way to determine FP mode */
53 ULong result = 0;
54
55+#ifndef __mips_soft_float
56 if (!VG_MINIMAL_SETJMP(env_unsup_insn)) {
57 __asm__ volatile (
58 ".set push\n\t"
59@@ -2136,6 +2137,9 @@ Bool VG_(machine_get_hwcaps)( void )
60
61 fpmode = (result != 0x3FF0000000000000ull);
62 }
63+#else
64+ fpmode = 0;
65+#endif
66 }
67
68 if (fpmode != 0)