5e58509bfe
Since gcc 4.6, GCC deprecated -mfused-madd, -ffp-contract=off should be used for the Xburst workaround. Tested with the MIPS Sourcery 2011.03 toolchain (based on gcc 4.5), the toolchain wrapper uses -mno-fused-madd, as expected: $ BR2_DEBUG_WRAPPER=2 ./output/host/bin/mips-linux-gnu-gcc -o toto toto.c Toolchain wrapper executing: '/home/thomas/toolchains/mips-2011.03/bin/mips-linux-gnu-gcc' '--sysroot' '/home/thomas/projets/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot' '-mabi=32' '-msoft-float' '-mno-fused-madd' '-EL' '-march=mips32r2' '-o' 'toto' 'toto.c' And with the MIPS Sourcery 2012.09 toolchain (based on gcc 4.7), the toolchain wrapper uses -ffp-contract=off, as expected: $ BR2_DEBUG_WRAPPER=2 ./output/host/bin/mips-linux-gnu-gcc -o toto toto.c Toolchain wrapper executing: '/home/thomas/toolchains/mips-2012.09/bin/mips-linux-gnu-gcc' '--sysroot' '/home/thomas/projets/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot' '-mabi=32' '-msoft-float' '-ffp-contract=off' '-EL' '-march=mips32r2' '-o' 'toto' 'toto.c' Fixes the ci20_defconfig build: https://gitlab.com/buildroot.org/buildroot/-/jobs/60303132 Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> [Thomas: rework to continue supporting pre-gcc-4.6 toolchains, extend the commit log after doing more testing.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
59 lines
1.8 KiB
Makefile
59 lines
1.8 KiB
Makefile
################################################################################
|
|
#
|
|
# definition of the toolchain wrapper build commands
|
|
#
|
|
################################################################################
|
|
|
|
# We use --hash-style=both to increase the compatibility of the generated
|
|
# binary with older platforms, except for MIPS, where the only acceptable
|
|
# hash style is 'sysv'
|
|
ifeq ($(findstring mips,$(HOSTARCH)),mips)
|
|
TOOLCHAIN_WRAPPER_HASH_STYLE = sysv
|
|
else
|
|
TOOLCHAIN_WRAPPER_HASH_STYLE = both
|
|
endif
|
|
|
|
TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
|
|
|
|
# We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
|
|
# separate argument when used in execv() by the toolchain wrapper.
|
|
TOOLCHAIN_WRAPPER_OPTS = \
|
|
$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma))
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)'
|
|
|
|
ifeq ($(BR2_CCACHE),y)
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
|
|
endif
|
|
|
|
ifeq ($(BR2_x86_x1000),y)
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX
|
|
endif
|
|
|
|
# Avoid FPU bug on XBurst CPUs
|
|
ifeq ($(BR2_mips_xburst),y)
|
|
# Before gcc 4.6, -mno-fused-madd was needed, after -ffp-contract is
|
|
# needed
|
|
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_6),y)
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_FP_CONTRACT_OFF
|
|
else
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
|
|
TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
|
|
endif
|
|
|
|
define TOOLCHAIN_WRAPPER_BUILD
|
|
$(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
|
|
-s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
|
|
toolchain/toolchain-wrapper.c \
|
|
-o $(@D)/toolchain-wrapper
|
|
endef
|
|
|
|
define TOOLCHAIN_WRAPPER_INSTALL
|
|
$(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \
|
|
$(HOST_DIR)/bin/toolchain-wrapper
|
|
endef
|