New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mips32: object is FP32 while it claim as FPXX #39435
Comments
For exe that is not linked with libc etc, It will contains no .gnu.attributes and .MIPS.abiflags section, kernel will treat them as FP32. It make it just work. |
The proposed change looks good to me. Want to send a CL? Thanks. I think you may also want to do a similar change in cmd/cgo/gcc.go. For a side note, I wonder if we want to pass softfloat flags to C compiler if softfloat is set. Also cc @ianlancetaylor |
I agree about passing Do we currently assume 32-bit floating point registers in the Go compiler? If so I agree about passing |
Yes. |
Yes. #39289 is about it. |
Change https://golang.org/cl/237058 mentions this issue: |
Or, should we split it to 2 patch? |
what's more should I do? |
As far as I can tell, nothing. Thanks for sending the CL. |
For mips32 currently, we are using FP32, while the gcc may be FPXX, which may generate .MIPS.abiflags and .gnu.attributes section with value as FPXX. So the kernel will treat the exe as FPXX, and may choose to use FR=1 FPU mode for it. Currently, in Go, we use 2 lwc1 to load both half of a double value to a pair of even-odd FPR. This behavior can only work with FR=0 mode. In FR=1 mode, all of 32 FPR are 64bit. If we lwc1 the high-half of a double value to an odd FPR, and try to use the previous even FPR to compute, the real high-half of even FPR will be unpredicatable. We set -mfp32 to force the gcc generate FP32 code and section value. More details about FP32/FPXX/FP64 are explained in: https://web.archive.org/web/20180828210612/https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking When GOMIPS/GOMIPS64 is set as softfloat, we should also pass -msoft-float to gcc. Fixes golang#39435 Change-Id: I54026ad416a815fe43a9261ebf6d02e5519c3930
MIPS32: switch to fpxx from fp32 or even fp64
In Long term, we should switch to FPXX or FP64, so I keep #39289 open
To add .gnu.attributes and .MIPS.abiflags section, currently we can just use -mfp32 option to gcc:
The text was updated successfully, but these errors were encountered: