[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
Wed Nov 20 11:38:53 PST 2024


================
@@ -16,7 +16,7 @@
 
 // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -flto=thin -c -o %t.call_thin.bc -DCALL_LIB
 // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s -flto=thin -c -o %t.define_thin.bc -DDEFINE_LIB
-// RUN: llvm-lto2 run -o %t.lto_thin -save-temps %t.call_thin.bc %t.define_thin.bc \
+// RUN: llvm-lto2 run --mcpu=cortex-m33 --float-abi=hard -o %t.lto_thin -save-temps %t.call_thin.bc %t.define_thin.bc \
----------------
smithp35 wrote:

It was this particular test update that makes me most nervous about the change.

IIUC https://reviews.llvm.org/D89573 after a fix for https://bugs.llvm.org/show_bug.cgi?id=45524

>From disassembling the bitcode the module has triple thumbv8m.main-unknown-none-eabihf and have target features that include the necessary hardware floating point registers.

The llvm-dis output from lto also looks like it preserves these. I would not expect any additional flags to be necessary here.

The following example is very common and we would need to avoid requiring additional mcpu and float-abi flags in the LTO step.
```
clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -c -flto file1.c
clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -c -flto file2.c
clang file1.o file2.o -o file.exe
```

https://github.com/llvm/llvm-project/pull/111334


More information about the cfe-commits mailing list