diff --git a/CMakeLists.txt b/CMakeLists.txt index 2262bd8828..cfffcc30c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -823,6 +823,7 @@ target_include_directories(${OFFSETS_LIB} PRIVATE # Make sure that LTO will never be enabled when compiling offsets.c set_source_files_properties(${OFFSETS_C_PATH} PROPERTIES COMPILE_OPTIONS "$;$") +set_source_files_properties(${ZEPHYR_BASE}/misc/empty_file.c PROPERTIES COMPILE_OPTIONS "$;$") target_link_libraries(${OFFSETS_LIB} zephyr_interface) add_dependencies(zephyr_interface diff --git a/cmake/linker/lld/target.cmake b/cmake/linker/lld/target.cmake index 5deab04710..03a0456f51 100644 --- a/cmake/linker/lld/target.cmake +++ b/cmake/linker/lld/target.cmake @@ -91,6 +91,7 @@ function(toolchain_ld_link_elf) ${TOPT} ${TOOLCHAIN_LD_LINK_ELF_LINKER_SCRIPT} ${TOOLCHAIN_LD_LINK_ELF_LIBRARIES_POST_SCRIPT} + -fuse-ld=lld ${LINKERFLAGPREFIX},-Map=${TOOLCHAIN_LD_LINK_ELF_OUTPUT_MAP} ${LINKERFLAGPREFIX},--whole-archive diff --git a/samples/basic/blinky/prj.conf b/samples/basic/blinky/prj.conf index 2d4c021908..5a9d1ac87a 100644 --- a/samples/basic/blinky/prj.conf +++ b/samples/basic/blinky/prj.conf @@ -1,7 +1,8 @@ CONFIG_GPIO=y #CONFIG_ASAN=y CONFIG_CFI=y -#CONFIG_LLVM_USE_LLD=y +CONFIG_LLVM_USE_LLD=y +CONFIG_COMPILER_RT_RTLIB=y #CONFIG_DEBUG=y #CONFIG_DEBUG_INFO=y diff --git a/scripts/native_simulator/Makefile b/scripts/native_simulator/Makefile index cd6c43be71..3b3ef01c1f 100644 --- a/scripts/native_simulator/Makefile +++ b/scripts/native_simulator/Makefile @@ -133,7 +133,8 @@ ${NSI_EXE}: ${NSI_BUILD_PATH}/${RUNNER_LIB} ${LOCALIZED_EMBSW} ${NSI_EXTRA_LIBS} -o $@ ${FINALLINK_FLAGS} -T ${NSI_BUILD_PATH}/linker_script.ld \ -B /nix/store/dbwp0scbb0rk78m636sb7cvycz8xzgyh-glibc-2.39-52/lib \ -B /nix/store/qfqjymymsd2x29yknsgllfiq1h64s3f4-gcc-12.3.0/lib/gcc/x86_64-unknown-linux-gnu/12.3.0/ \ - -L /nix/store/qfqjymymsd2x29yknsgllfiq1h64s3f4-gcc-12.3.0/lib/gcc/x86_64-unknown-linux-gnu/12.3.0/ + -L /nix/store/qfqjymymsd2x29yknsgllfiq1h64s3f4-gcc-12.3.0/lib/gcc/x86_64-unknown-linux-gnu/12.3.0/ \ + -lclang_rt.ubsan_standalone-x86_64 Makefile: ;