[clang] [llvm] [ARM] Emit an error when the hard-float ABI is enabled but can't be used. (PR #111334)

Chris Copeland via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 1 02:31:11 PST 2025


================
@@ -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 \
----------------
chrisnc wrote:

I attempted this approach, but there's an issue due to how the `getSubtargetImpl` function works. It essentially maintains a map of subtargets it's seen before, keyed by a string of cpu + feature list, and only does the error checking when it sees a new combination, otherwise returns the subtarget that's already been created for the given cpu + feature list key. What this means is that if a non-fp-using function is encountered first in a translation unit, then the check passes because its use of inconsistent ABI+feature is harmless, but subsequent functions that should be flagged will be ignored because the map already has a subtarget for them.

Any suggestions on how to deal with this would be appreciated, or if there is a maintainer for this specific subsystem who could provide guidance here that would also be helpful.

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


More information about the llvm-commits mailing list