summaryrefslogtreecommitdiff
path: root/examples/build_system
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-10-23 16:59:04 +0700
committerhathach <[email protected]>2025-10-23 18:00:15 +0700
commit7c95d9bed5b39730c449e321cc72c4e690b17a6c (patch)
treec1a3d0c815418b618ee1c6634d425e1c339d1702 /examples/build_system
parentbde449997e65ee866fa9e20c15bac0bd45efccf4 (diff)
force clang asm with -x assembler-with-cpp
Diffstat (limited to 'examples/build_system')
-rw-r--r--examples/build_system/cmake/toolchain/arm_clang.cmake2
-rw-r--r--examples/build_system/cmake/toolchain/common.cmake6
2 files changed, 7 insertions, 1 deletions
diff --git a/examples/build_system/cmake/toolchain/arm_clang.cmake b/examples/build_system/cmake/toolchain/arm_clang.cmake
index fe3c2b453..dba637367 100644
--- a/examples/build_system/cmake/toolchain/arm_clang.cmake
+++ b/examples/build_system/cmake/toolchain/arm_clang.cmake
@@ -7,6 +7,8 @@ if (NOT DEFINED CMAKE_CXX_COMPILER)
endif ()
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
+set(TOOLCHAIN_ASM_FLAGS "-x assembler-with-cpp")
+
find_program(CMAKE_SIZE llvm-size)
find_program(CMAKE_OBJCOPY llvm-objcopy)
find_program(CMAKE_OBJDUMP llvm-objdump)
diff --git a/examples/build_system/cmake/toolchain/common.cmake b/examples/build_system/cmake/toolchain/common.cmake
index fa3034e6f..14449b01d 100644
--- a/examples/build_system/cmake/toolchain/common.cmake
+++ b/examples/build_system/cmake/toolchain/common.cmake
@@ -32,7 +32,6 @@ if (TOOLCHAIN STREQUAL "gcc" OR TOOLCHAIN STREQUAL "clang")
-Wl,--gc-sections
-Wl,--cref
)
-
elseif (TOOLCHAIN STREQUAL "iar")
list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
--diag_suppress=Li065
@@ -48,5 +47,10 @@ foreach (LANG IN ITEMS C CXX ASM)
#set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
endforeach ()
+# Assembler
+if (DEFINED TOOLCHAIN_ASM_FLAGS)
+ set(CMAKE_ASM_FLAGS_INIT "${CMAKE_ASM_FLAGS_INIT} ${TOOLCHAIN_ASM_FLAGS}")
+endif ()
+
# Linker
list(JOIN TOOLCHAIN_EXE_LINKER_FLAGS " " CMAKE_EXE_LINKER_FLAGS_INIT)