https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61796
Bug ID: 61796 Summary: gcc arm hardfloat Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: luka.perkov at sartura dot hr When building crosscompile toolchain for arm with hardware floating point support toolchain is built with software floating point or at least that seems to be the case. The flags passed include: -pipe -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard I've noticed this behaviour while building eglibc. The relevant code for this seems to be located in the following files: gcc/config/arm/arm.h gcc/config/arm/arm-opts.h gcc/gcc/config/arm/arm.opt Regardles of the -mfloat-abi=hard flag being passed the gcc ends up setting __SOFTFP__ which is only set if -mfloat-abi=soft is passed. Command below shows how I tested this: $ arm-openwrt-linux-gnueabi-gcc -x c - -E -dM </dev/null 2>/dev/null | fgrep SOFT #define __SOFTFP__ 1 The following hack seems to fix the problem: --- a/gcc/config/arm/arm.opt +++ b/gcc/config/arm/arm.opt @@ -106,7 +106,7 @@ Target RejectNegative Joined Enum(proces Specify the name of the target CPU mfloat-abi= -Target RejectNegative Joined Enum(float_abi_type) Var(arm_float_abi) Init(TARGET_DEFAULT_FLOAT_ABI) +Target RejectNegative Joined Enum(float_abi_type) Var(arm_float_abi) Init(ARM_FLOAT_ABI_HARD) Specify if floating point hardware should be used Enum Because of the check in eglibc (paste below) compilation fails because __ARM_PCS_VFP is not set. The __ARM_PCS_VFP is only set if the hardware float is used - and that should be the case, here is the relevant chunk from gcc/config/arm/arm.c: else if (arm_float_abi == ARM_FLOAT_ABI_HARD && TARGET_HARD_FLOAT && TARGET_VFP) arm_pcs_default = ARM_PCS_AAPCS_VFP; And the eglibc code refered to in the last section (libc/scripts/config.guess): if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi Even though I've managed to compile eglibc successfully and entire system without issue I didn't manage to boot it. That might be a different problem but I'd like to hear your opinion about this bug first. Luka