diff mbox series

MIPS: VDSO: Use same -m%-float cflag as the kernel proper

Message ID 20190128222106.19100-1-paul.burton@mips.com (mailing list archive)
State Mainlined
Commit 0648e50e548d881d025b9419a1a168753c8e2bf7
Headers show
Series MIPS: VDSO: Use same -m%-float cflag as the kernel proper | expand

Commit Message

Paul Burton Jan. 28, 2019, 10:21 p.m. UTC
The MIPS VDSO build currently doesn't provide the -msoft-float flag to
the compiler as the kernel proper does. This results in an attempt to
use the compiler's default floating point configuration, which can be
problematic in cases where this is incompatible with the target CPU's
-march= flag. For example decstation_defconfig fails to build using
toolchains in which gcc was configured --with-fp-32=xx with the
following error:

    LDS     arch/mips/vdso/vdso.lds
  cc1: error: '-march=r3000' requires '-mfp32'
  make[2]: *** [scripts/Makefile.build:379: arch/mips/vdso/vdso.lds] Error 1

The kernel proper avoids this error because we build with the
-msoft-float compiler flag, rather than using the compiler's default.
Pass this flag through to the VDSO build so that it too becomes agnostic
to the toolchain's floating point configuration.

Note that this is filtered out from KBUILD_CFLAGS rather than simply
always using -msoft-float such that if we switch the kernel to use
-mno-float in the future the VDSO will automatically inherit the change.

The VDSO doesn't actually include any floating point code, and its
.MIPS.abiflags section is already manually generated to specify that
it's compatible with any floating point ABI. As such this change should
have no effect on the resulting VDSO, apart from fixing the build
failure for affected toolchains.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Reported-by: Kevin Hilman <khilman@baylibre.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
References: https://lore.kernel.org/linux-mips/1477843551-21813-1-git-send-email-linux@roeck-us.net/
References: https://kernelci.org/build/id/5c4e4ae059b5142a249ad004/logs/
---
 arch/mips/vdso/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Kevin Hilman Jan. 29, 2019, 8:48 a.m. UTC | #1
Paul Burton <paul.burton@mips.com> writes:

> The MIPS VDSO build currently doesn't provide the -msoft-float flag to
> the compiler as the kernel proper does. This results in an attempt to
> use the compiler's default floating point configuration, which can be
> problematic in cases where this is incompatible with the target CPU's
> -march= flag. For example decstation_defconfig fails to build using
> toolchains in which gcc was configured --with-fp-32=xx with the
> following error:
>
>     LDS     arch/mips/vdso/vdso.lds
>   cc1: error: '-march=r3000' requires '-mfp32'
>   make[2]: *** [scripts/Makefile.build:379: arch/mips/vdso/vdso.lds] Error 1
>
> The kernel proper avoids this error because we build with the
> -msoft-float compiler flag, rather than using the compiler's default.
> Pass this flag through to the VDSO build so that it too becomes agnostic
> to the toolchain's floating point configuration.
>
> Note that this is filtered out from KBUILD_CFLAGS rather than simply
> always using -msoft-float such that if we switch the kernel to use
> -mno-float in the future the VDSO will automatically inherit the change.
>
> The VDSO doesn't actually include any floating point code, and its
> .MIPS.abiflags section is already manually generated to specify that
> it's compatible with any floating point ABI. As such this change should
> have no effect on the resulting VDSO, apart from fixing the build
> failure for affected toolchains.
>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Reported-by: Kevin Hilman <khilman@baylibre.com>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Cc: Maciej W. Rozycki <macro@linux-mips.org>
> References: https://lore.kernel.org/linux-mips/1477843551-21813-1-git-send-email-linux@roeck-us.nets/
> References: https://kernelci.org/build/id/5c4e4ae059b5142a249ad004/logs/

Tested-by: Kevin Hilman <khilman@baylibre.com>
Paul Burton Jan. 29, 2019, 7:51 p.m. UTC | #2
Hello,

Paul Burton wrote:
> The MIPS VDSO build currently doesn't provide the -msoft-float flag to
> the compiler as the kernel proper does. This results in an attempt to
> use the compiler's default floating point configuration, which can be
> problematic in cases where this is incompatible with the target CPU's
> -march= flag. For example decstation_defconfig fails to build using
> toolchains in which gcc was configured --with-fp-32=xx with the
> following error:
> 
> LDS     arch/mips/vdso/vdso.lds
> cc1: error: '-march=r3000' requires '-mfp32'
> make[2]: *** [scripts/Makefile.build:379: arch/mips/vdso/vdso.lds] Error 1
> 
> The kernel proper avoids this error because we build with the
> -msoft-float compiler flag, rather than using the compiler's default.
> Pass this flag through to the VDSO build so that it too becomes agnostic
> to the toolchain's floating point configuration.
> 
> Note that this is filtered out from KBUILD_CFLAGS rather than simply
> always using -msoft-float such that if we switch the kernel to use
> -mno-float in the future the VDSO will automatically inherit the change.
> 
> The VDSO doesn't actually include any floating point code, and its
> .MIPS.abiflags section is already manually generated to specify that
> it's compatible with any floating point ABI. As such this change should
> have no effect on the resulting VDSO, apart from fixing the build
> failure for affected toolchains.
> 
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Reported-by: Kevin Hilman <khilman@baylibre.com>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Cc: Maciej W. Rozycki <macro@linux-mips.org>
> References: https://lore.kernel.org/linux-mips/1477843551-21813-1-git-send-email-linux@roeck-us.net/
> References: https://kernelci.org/build/id/5c4e4ae059b5142a249ad004/logs/

Applied to mips-fixes.

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paul.burton@mips.com to report it. ]
diff mbox series

Patch

diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index f6fd340e39c2..314949b2261d 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -8,6 +8,7 @@  ccflags-vdso := \
 	$(filter -E%,$(KBUILD_CFLAGS)) \
 	$(filter -mmicromips,$(KBUILD_CFLAGS)) \
 	$(filter -march=%,$(KBUILD_CFLAGS)) \
+	$(filter -m%-float,$(KBUILD_CFLAGS)) \
 	-D__VDSO__
 
 ifdef CONFIG_CC_IS_CLANG