must use ld for clang build. lld optimizes at least for rp2040 too much away

This commit is contained in:
Hardy Griech 2026-02-11 12:17:02 +01:00
parent d9802304ac
commit b32df0796e
2 changed files with 7 additions and 5 deletions

View file

@ -1,5 +1,5 @@
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
set(PICO_COMMON_LANG_FLAGS "--target=arm-none-eabi -mcpu=cortex-m0plus -mfloat-abi=soft")
set(PICO_COMMON_LANG_FLAGS "--target=arm-none-eabi -mcpu=cortex-m0plus -mfloat-abi=softfp")
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_clang_common.cmake)

View file

@ -75,10 +75,6 @@ endif()
set(PICO_COMMON_LANG_FLAGS "${PICO_COMMON_LANG_FLAGS} --sysroot ${PICO_CLIB_ROOT}")
# moving this here as a reminder from pico_standard_link; it was commented out theee, but if ever needed,
# it belongs here as part of LINKER_FLAGS_INIT
#target_link_options(pico_standard_link INTERFACE "LINKER:-fuse-ld=lld")
if (PICO_CLIB STREQUAL "llvm_libc")
# TODO: Move -nostartfiles to the appropriate library.
foreach(TYPE IN ITEMS EXE SHARED MODULE)
@ -86,6 +82,12 @@ if (PICO_CLIB STREQUAL "llvm_libc")
endforeach()
endif()
# at least rp2040 does not work with lld. For rp2350 it seems to work with lld, but not really sure
set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} -fuse-ld=ld -Wl,-z,noexecstack")
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
message(FATAL_ERROR "IPO is not supported with the current configuration of the Pico SDK")
endif()
message(STATUS "Taking '${PICO_CLIB}' from '${PICO_CLIB_ROOT}'")
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)