All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: VDSO: Use same -m%-float cflag as the kernel proper
@ 2019-01-28 22:21 Paul Burton
  2019-01-28 23:16 ` [PATCH] MIPS: VDSO: Include $(ccflags-vdso) in o32,n32 .lds builds Paul Burton
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paul Burton @ 2019-01-28 22:21 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Burton, Kevin Hilman, Guenter Roeck, Maciej W . Rozycki

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(+)

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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] MIPS: VDSO: Include $(ccflags-vdso) in o32,n32 .lds builds
  2019-01-28 22:21 [PATCH] MIPS: VDSO: Use same -m%-float cflag as the kernel proper Paul Burton
@ 2019-01-28 23:16 ` Paul Burton
  2019-01-29 19:51   ` Paul Burton
  2019-01-29  8:48 ` [PATCH] MIPS: VDSO: Use same -m%-float cflag as the kernel proper Kevin Hilman
  2019-01-29 19:51 ` Paul Burton
  2 siblings, 1 reply; 5+ messages in thread
From: Paul Burton @ 2019-01-28 23:16 UTC (permalink / raw)
  To: linux-mips; +Cc: Kevin Hilman, Guenter Roeck, Maciej W . Rozycki, Paul Burton

When generating vdso-o32.lds & vdso-n32.lds for use with programs
running as compat ABIs under 64b kernels, we previously haven't included
the compiler flags that are supposedly common to all ABIs - ie. those in
the ccflags-vdso variable.

This is problematic in cases where we need to provide the -m%-float flag
in order to ensure that we don't attempt to use a floating point ABI
that's incompatible with the target CPU & ABI. For example a toolchain
using current gcc trunk configured --with-fp-32=xx fails to build a
64r6el_defconfig kernel with the following error:

  cc1: error: '-march=mips1' requires '-mfp32'
  make[2]: *** [arch/mips/vdso/Makefile:135: arch/mips/vdso/vdso-o32.lds] Error 1

Include $(ccflags-vdso) for the compat VDSO .lds builds, just as it is
included for the native VDSO .lds & when compiling objects for the
compat VDSOs. This ensures we consistently provide the -msoft-float flag
amongst others, avoiding the problem by ensuring we're agnostic to the
toolchain defaults.

Signed-off-by: Paul Burton <paul.burton@mips.com>
---
 arch/mips/vdso/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index 314949b2261d..0ede4deb8181 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -130,7 +130,7 @@ $(obj)/%-o32.o: $(src)/%.c FORCE
 	$(call cmd,force_checksrc)
 	$(call if_changed_rule,cc_o_c)
 
-$(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := -mabi=32
+$(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=32
 $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE
 	$(call if_changed_dep,cpp_lds_S)
 
@@ -170,7 +170,7 @@ $(obj)/%-n32.o: $(src)/%.c FORCE
 	$(call cmd,force_checksrc)
 	$(call if_changed_rule,cc_o_c)
 
-$(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := -mabi=n32
+$(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=n32
 $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE
 	$(call if_changed_dep,cpp_lds_S)
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: VDSO: Use same -m%-float cflag as the kernel proper
  2019-01-28 22:21 [PATCH] MIPS: VDSO: Use same -m%-float cflag as the kernel proper Paul Burton
  2019-01-28 23:16 ` [PATCH] MIPS: VDSO: Include $(ccflags-vdso) in o32,n32 .lds builds Paul Burton
@ 2019-01-29  8:48 ` Kevin Hilman
  2019-01-29 19:51 ` Paul Burton
  2 siblings, 0 replies; 5+ messages in thread
From: Kevin Hilman @ 2019-01-29  8:48 UTC (permalink / raw)
  To: Paul Burton, linux-mips; +Cc: Paul Burton, Guenter Roeck, Maciej W . Rozycki

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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: VDSO: Use same -m%-float cflag as the kernel proper
  2019-01-28 22:21 [PATCH] MIPS: VDSO: Use same -m%-float cflag as the kernel proper Paul Burton
  2019-01-28 23:16 ` [PATCH] MIPS: VDSO: Include $(ccflags-vdso) in o32,n32 .lds builds Paul Burton
  2019-01-29  8:48 ` [PATCH] MIPS: VDSO: Use same -m%-float cflag as the kernel proper Kevin Hilman
@ 2019-01-29 19:51 ` Paul Burton
  2 siblings, 0 replies; 5+ messages in thread
From: Paul Burton @ 2019-01-29 19:51 UTC (permalink / raw)
  To: Paul Burton
  Cc: linux-mips, Paul Burton, Kevin Hilman, Guenter Roeck,
	Maciej W . Rozycki, linux-mips

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. ]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: VDSO: Include $(ccflags-vdso) in o32,n32 .lds builds
  2019-01-28 23:16 ` [PATCH] MIPS: VDSO: Include $(ccflags-vdso) in o32,n32 .lds builds Paul Burton
@ 2019-01-29 19:51   ` Paul Burton
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Burton @ 2019-01-29 19:51 UTC (permalink / raw)
  To: Paul Burton
  Cc: linux-mips, Kevin Hilman, Guenter Roeck, Maciej W . Rozycki,
	Paul Burton, linux-mips

Hello,

Paul Burton wrote:
> When generating vdso-o32.lds & vdso-n32.lds for use with programs
> running as compat ABIs under 64b kernels, we previously haven't included
> the compiler flags that are supposedly common to all ABIs - ie. those in
> the ccflags-vdso variable.
> 
> This is problematic in cases where we need to provide the -m%-float flag
> in order to ensure that we don't attempt to use a floating point ABI
> that's incompatible with the target CPU & ABI. For example a toolchain
> using current gcc trunk configured --with-fp-32=xx fails to build a
> 64r6el_defconfig kernel with the following error:
> 
> cc1: error: '-march=mips1' requires '-mfp32'
> make[2]: *** [arch/mips/vdso/Makefile:135: arch/mips/vdso/vdso-o32.lds] Error 1
> 
> Include $(ccflags-vdso) for the compat VDSO .lds builds, just as it is
> included for the native VDSO .lds & when compiling objects for the
> compat VDSOs. This ensures we consistently provide the -msoft-float flag
> amongst others, avoiding the problem by ensuring we're agnostic to the
> toolchain defaults.
> 
> Signed-off-by: Paul Burton <paul.burton@mips.com>

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. ]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-29 19:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-28 22:21 [PATCH] MIPS: VDSO: Use same -m%-float cflag as the kernel proper Paul Burton
2019-01-28 23:16 ` [PATCH] MIPS: VDSO: Include $(ccflags-vdso) in o32,n32 .lds builds Paul Burton
2019-01-29 19:51   ` Paul Burton
2019-01-29  8:48 ` [PATCH] MIPS: VDSO: Use same -m%-float cflag as the kernel proper Kevin Hilman
2019-01-29 19:51 ` Paul Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.