[clang] [llvm] [ARM] Emit an error when the hard-float ABI is enabled but can't be used. (PR #111334)
Peter Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 7 08:00:26 PDT 2024
smithp35 wrote:
Whatever we choose to do I think clang and llvm should be consistent. There's no point in clang giving a warning if llvm is going to give an error.
I can see two positions most clearly:
* clang gives an error message for an eabihf target (or -mfloat-abi=hard). This is what GCC does today. While we could also put an error in LLVM I'm not sure it is necessary.
* clang gives a warning message for both eabihf target (of -mfloat-abi=hard) and uses -mfloat-abi=soft, the warning should ideally say that is changing ABI rather than just unsupported. We'd need to change LLVM to get the build attributes right.
Personally I don't have a problem with clang giving an error in this case as that is what GCC does.
Appendix, some empirical data:
GCC 13
```
arm-none-eabi-gcc -c -mcpu=cortex-m3 -mfloat-abi=hard float.c
cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU
```
Clang -mfloat-abi
```
clang --target=arm-none-eabi -mcpu=cortex-m3 float.c -c -mfloat-abi=hard
clang: warning: '-mfloat-abi=hard': selected processor lacks floating point registers [-Wunsupported-abi]
```
Actual behaviour is soft-float but with incorrect build attributes.
Clang --target=arm-none-eabihf
```
clang --target=arm-none-eabi -mcpu=cortex-m3 float.c -c -mfloat-abi=hard
```
Actual behaviour is soft-float but with incorrect build attributes.
https://github.com/llvm/llvm-project/pull/111334
More information about the cfe-commits
mailing list