130-mips_fix_soft_float.patch 2.2 KB

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