From 62172fa61a6ed9ddd84918436d9bcfd6d4e10d91 Mon Sep 17 00:00:00 2001 From: Jonathon Penix Date: Mon, 11 May 2026 15:49:44 -0700 Subject: [PATCH] [cpullvm] Add armv7m -mfpu=fpv5-d16 hard float variant The intention here is to offer a variant for Cortex M7 users with fpv5-d16 enabled. There's a few misc. things to note here: - The normalized triple clang uses when `-mcpu=cortex-m7` is used is actually along the lines of `thumbv7em*` rather than the `thumb7m` we use here. Our `multilib.yaml.in` has mappings for these which we inherited from ATfE. So, align with what their configs seem to do and stick with thumbv7m. - Picolibc is the only libc we want to support for this variant--a musl-embedded variant is intentionally omitted as we're moving away from musl-embedded. - This variant is built without PIC support. The relevant user isn't using PIC and we've had issues with PIC + eld + Zephyr in the past for 32bit Arm targets (see https://github.com/qualcomm/cpullvm-toolchain/pull/309) so let's default towards nopic. - We build our other armv7m configurations with `-mno-unaligned-access` (and we don't have both aligned and unaligned variants like ATfE). But, the relevant user build here is resolving to `-munaligned-access` so I'm not going to force `-mno-unaligned-access` in the library build unless we have a particular need. Signed-off-by: Jonathon Penix --- .../embedded-multilib/json/multilib.json | 6 +++++ .../variants/armv7m_hard_fpv5_d16_nopic.json | 25 +++++++++++++++++++ qualcomm-software/test/multilib/armv7m.test | 9 +++++++ 3 files changed, 40 insertions(+) create mode 100644 qualcomm-software/embedded-multilib/json/variants/armv7m_hard_fpv5_d16_nopic.json diff --git a/qualcomm-software/embedded-multilib/json/multilib.json b/qualcomm-software/embedded-multilib/json/multilib.json index b965b42a596f..b65555b61b9b 100644 --- a/qualcomm-software/embedded-multilib/json/multilib.json +++ b/qualcomm-software/embedded-multilib/json/multilib.json @@ -61,6 +61,12 @@ "flags": "--target=thumbv7m-unknown-none-eabi -mfpu=none -fno-pic", "libraries_supported": "picolibc" }, + { + "variant": "armv7m_hard_fpv5_d16_nopic", + "json": "armv7m_hard_fpv5_d16_nopic.json", + "flags": "--target=thumbv7m-unknown-none-eabihf -mfpu=fpv5-d16 -munaligned-access -fno-pic", + "libraries_supported": "picolibc" + }, { "variant": "riscv32imc_ilp32_nothreads_nopic", "json": "riscv32imc_ilp32_nothreads_nopic.json", diff --git a/qualcomm-software/embedded-multilib/json/variants/armv7m_hard_fpv5_d16_nopic.json b/qualcomm-software/embedded-multilib/json/variants/armv7m_hard_fpv5_d16_nopic.json new file mode 100644 index 000000000000..c752cdbc640c --- /dev/null +++ b/qualcomm-software/embedded-multilib/json/variants/armv7m_hard_fpv5_d16_nopic.json @@ -0,0 +1,25 @@ +{ + "args": { + "common": { + "TARGET_ARCH": "armv7m", + "VARIANT": "armv7m_hard_fpv5_d16_nopic", + "COMPILE_FLAGS": "-mfloat-abi=hard -march=armv7m -mfpu=fpv5-d16", + "ENABLE_EXCEPTIONS": "OFF", + "ENABLE_RTTI": "OFF", + "TEST_EXECUTOR": "qemu", + "QEMU_MACHINE": "mps2-an500", + "QEMU_CPU": "cortex-m7", + "FLASH_ADDRESS": "0x00000000", + "FLASH_SIZE": "0x00400000", + "RAM_ADDRESS": "0x20000000", + "RAM_SIZE": "0x00200000", + "LIBRARY_BUILD_TYPE": "minsizerelease" + }, + "picolibc": { + "ENABLE_CXX_LIBS": "ON", + "ENABLE_LIBC_TESTS": "ON", + "ENABLE_COMPILER_RT_TESTS": "OFF", + "ENABLE_LIBCXX_TESTS": "OFF" + } + } +} diff --git a/qualcomm-software/test/multilib/armv7m.test b/qualcomm-software/test/multilib/armv7m.test index bdd2ea8b44db..9b1b2b50a146 100644 --- a/qualcomm-software/test/multilib/armv7m.test +++ b/qualcomm-software/test/multilib/armv7m.test @@ -5,3 +5,12 @@ # RUN: %clang -print-multi-directory --target=armv7m-none-eabi -mfpu=none -fno-pic | FileCheck %s --check-prefix=CHECK-SOFT-NOFP-NOPIC # CHECK-SOFT-NOFP-NOPIC: arm-none-eabi/armv7m_soft_nofp_nopic{{$}} # CHECK-SOFT-NOFP-NOPIC-EMPTY: + +# RUN: %clang -print-multi-directory --target=armv7m-none-eabihf -mfloat-abi=hard -mfpu=fpv5-d16 -fno-pic | FileCheck %s --check-prefix=CHECK-HARD-FPV5-D16-NOPIC +# RUN: %clang -print-multi-directory --target=armv7em-none-eabihf -mfloat-abi=hard -mfpu=fpv5-d16 -fno-pic | FileCheck %s --check-prefix=CHECK-HARD-FPV5-D16-NOPIC +# CHECK-HARD-FPV5-D16-NOPIC: arm-none-eabi/armv7m_hard_fpv5_d16_nopic{{$}} +# CHECK-HARD-FPV5-D16-NOPIC-EMPTY: + +# RUN: %clang -print-multi-directory --target=armv7m-none-eabihf -mfloat-abi=hard -mfpu=fpv5-d16 -fPIC 2>&1 | FileCheck %s --check-prefix=NOT-FOUND +# RUN: %clang -print-multi-directory --target=armv7m-none-eabihf -mfloat-abi=hard -mfpu=fpv5-d16 -mno-unaligned-access 2>&1 | FileCheck %s --check-prefix=NOT-FOUND +# NOT-FOUND: warning: no multilib found matching flags