[PATCH] cmd/link: check CGO_CFLAGS for non -g/-I/-O options before internal linking
On Debian and Ubuntu we are investigating enabling link-time
optimization by default, which means the default CFLAGS will contain
arguments that cause gcc to generate object files
cmd/link/internal/loadelf cannot process. Rather than failing in this
situation, scan CGO_CFLAGS in mustLinkExternal and do not link
internally if there is a flag that does not start with -g, -I, or -O.
CFLAGS can also be injected via #cgo CFLAGS: directives but as use of
any non-standard library cgo modules disables internal linking anyway,
we don't have to worry about that here.
Fixes #43505
Change-Id: Ib083f6daf22617e2e5df67e95d3bc178942328cd
Gbp-Pq: Name 0007-cmd-link-check-CGO_CFLAGS-for-non-g-I-O-options-befo.patch
cmd/go, cmd/cgo: pass -mfp32 and -mhard/soft-float to MIPS GCC
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.
Here we also add -mno-odd-spreg option, since Loongson's CPU cannot use
odd-number FR in FR=0 mode.
Fixes #39435
Change-Id: I54026ad416a815fe43a9261ebf6d02e5519c3930
Gbp-Pq: Name 0003-cmd-go-cmd-cgo-pass-mfp32-and-mhard-soft-float-to-MI.patch
Disable test for UserHomeDir.
On Debian buildds, the user home dir does not exist, so this test fails.
Gbp-Pq: Name 0001-Disable-test-for-UserHomeDir.patch