[clang] [cmake][Fuchsia] armv8m -> armv8m.main (PR #98695)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 13:51:19 PDT 2024


https://github.com/PiJoules created https://github.com/llvm/llvm-project/pull/98695

armv8m builtins aren't being built because `armv8m` doesn't match any of the arm cpu strings in compiler-rt cmake files. Instead there's `armv8m.main` and `armv8m.base`. We want to use the `armv8m.main` version.

>From 662d6851f57ead3c1e9c8564e702acb59050d81e Mon Sep 17 00:00:00 2001
From: Leonard Chan <leonardchan at google.com>
Date: Fri, 12 Jul 2024 13:48:14 -0700
Subject: [PATCH] [cmake][Fuchsia] armv8m -> armv8m.main

armv8m builtins aren't being built because `armv8m` doesn't match any of
the arm cpu strings in compiler-rt cmake files. Instead there's
`armv8m.main` and `armv8m.base`. We want to use the `armv8m.main`
version.
---
 clang/cmake/caches/Fuchsia-stage2.cmake | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake
index 9892b5d58e719..b8c9db49863c6 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -300,14 +300,18 @@ if(FUCHSIA_SDK)
   set(LLVM_RUNTIME_MULTILIB_hwasan+noexcept_TARGETS "aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
 endif()
 
-foreach(target armv6m-unknown-eabi;armv7m-unknown-eabi;armv8m-unknown-eabi)
+foreach(target armv6m-unknown-eabi;armv7m-unknown-eabi;armv8m.main-unknown-eabi)
   list(APPEND BUILTIN_TARGETS "${target}")
   set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
   set(BUILTINS_${target}_CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
   set(BUILTINS_${target}_CMAKE_SYSROOT "" CACHE STRING "")
   set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
   foreach(lang C;CXX;ASM)
-    set(BUILTINS_${target}_CMAKE_${lang}_FLAGS "--target=${target} -mthumb" CACHE STRING "")
+    set(BUILTINS_${target}_CMAKE_${lang}_local_flags "--target=${target} -mthumb")
+    if(${target} STREQUAL "armv8m.main-unknown-eabi")
+      set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
+    endif()
+    set(BUILTINS_${target}_CMAKE_${lang}_FLAGS "${BUILTINS_${target}_CMAKE_${lang}_local_flags}" CACHE STRING "")
   endforeach()
   foreach(type SHARED;MODULE;EXE)
     set(BUILTINS_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")



More information about the cfe-commits mailing list