[Driver] Incorporate -mfloat-abi in the computed triple on ARM
authorJohn Brawn <john.brawn@arm.com>
Wed, 21 Oct 2020 10:18:04 +0000 (11:18 +0100)
committerJohn Brawn <john.brawn@arm.com>
Wed, 21 Oct 2020 10:19:38 +0000 (11:19 +0100)
commit0c66606230df39e0bf4190f1fc2c2e2fb37a81ea
treec6d8c45e79b0d86fca4e0a76555361075ab3c385
parenta6336eab0c507b665dda63fa9db1292a2cdee409
[Driver] Incorporate -mfloat-abi in the computed triple on ARM

LLVM assumes that when it creates a call to a C library function it
can use the C calling convention. On ARM the effective calling
convention is determined from the target triple, however using
-mfloat-abi=hard on ARM means that calls to (and definitions of) C
library functions use the arm_aapcs_vfpcc calling convention which can
result in a mismatch.

Fix this by incorporating -mfloat-abi into the target triple, similar
to how -mbig-endian and -march/-mcpu are. This only works for EABI
targets and not Android or iOS, but there the float abi is fixed so
instead give an error.

Fixes PR45524

Differential Revision: https://reviews.llvm.org/D89573
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/Arch/ARM.cpp
clang/lib/Driver/ToolChains/Arch/ARM.h
clang/test/Driver/arm-float-abi-lto.c [new file with mode: 0644]
clang/test/Driver/arm-float-abi.c
clang/test/Driver/arm-triple.c [new file with mode: 0644]
clang/test/Driver/windows-thumbv7em.cpp