From 6301af9a4405702e51714946dd705fadd08ef3cd Mon Sep 17 00:00:00 2001 From: wangmingrong1 Date: Mon, 15 Sep 2025 12:33:04 +0800 Subject: [PATCH] libbuitin/compiler-rt: Solve some compilation errors 1. remove_item It needs to use the full path to exclude the file, otherwise the exclusion will fail 2. No include path was added, resulting in the header file not being found Signed-off-by: wangmingrong1 --- libs/libbuiltin/compiler-rt/CMakeLists.txt | 48 +++++++++++----------- libs/libbuiltin/compiler-rt/Make.defs | 1 + 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/libs/libbuiltin/compiler-rt/CMakeLists.txt b/libs/libbuiltin/compiler-rt/CMakeLists.txt index 3a2e8f8a0ab..a235425c0c2 100644 --- a/libs/libbuiltin/compiler-rt/CMakeLists.txt +++ b/libs/libbuiltin/compiler-rt/CMakeLists.txt @@ -78,39 +78,37 @@ if(CONFIG_BUILTIN_COMPILER_RT) set(SRCSTMP) set(RT_BUILTINS_SRCS) - file(GLOB RT_BUILTINS_SRCS - ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/*.c) + set(BUILTINS_DIR ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins) - file(GLOB SRCSTMP - ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/${ARCH}/*.S) + file(GLOB RT_BUILTINS_SRCS ${BUILTINS_DIR}/*.c) + + file(GLOB SRCSTMP ${BUILTINS_DIR}/${ARCH}/*.S) list(APPEND RT_BUILTINS_SRCS ${SRCSTMP}) - file(GLOB SRCSTMP - ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/${ARCH}/*.c) + file(GLOB SRCSTMP ${BUILTINS_DIR}/${ARCH}/*.c) list(APPEND RT_BUILTINS_SRCS ${SRCSTMP}) if(NOT CONFIG_LIB_COMPILER_RT_HAS_BFLOAT16) - set(RT_BUILTINS_BFLOAT16_SRCS - ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/truncdfbf2.c - ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/truncsfbf2.c) + set(RT_BUILTINS_BFLOAT16_SRCS ${BUILTINS_DIR}/truncdfbf2.c + ${BUILTINS_DIR}/truncsfbf2.c) list(REMOVE_ITEM RT_BUILTINS_SRCS ${RT_BUILTINS_BFLOAT16_SRCS}) endif() set(x86_80_BIT_SOURCES - divxc3.c - extendxftf2.c - fixxfdi.c - fixxfti.c - fixunsxfdi.c - fixunsxfsi.c - fixunsxfti.c - floatdixf.c - floattixf.c - floatundixf.c - floatuntixf.c - mulxc3.c - powixf2.c - trunctfxf2.c) + ${BUILTINS_DIR}/divxc3.c + ${BUILTINS_DIR}/extendxftf2.c + ${BUILTINS_DIR}/fixxfdi.c + ${BUILTINS_DIR}/fixxfti.c + ${BUILTINS_DIR}/fixunsxfdi.c + ${BUILTINS_DIR}/fixunsxfsi.c + ${BUILTINS_DIR}/fixunsxfti.c + ${BUILTINS_DIR}/floatdixf.c + ${BUILTINS_DIR}/floattixf.c + ${BUILTINS_DIR}/floatundixf.c + ${BUILTINS_DIR}/floatuntixf.c + ${BUILTINS_DIR}/mulxc3.c + ${BUILTINS_DIR}/powixf2.c + ${BUILTINS_DIR}/trunctfxf2.c) if(NOT CONFIG_ARCH_X86_64) list(REMOVE_ITEM RT_BUILTINS_SRCS ${x86_80_BIT_SOURCES}) @@ -153,6 +151,10 @@ if(CONFIG_COVERAGE_COMPILER_RT) elseif(CONFIG_COVERAGE_MINI AND CONFIG_ARCH_TOOLCHAIN_CLANG) nuttx_add_system_library(rt.miniprofile) + target_include_directories( + rt.miniprofile PRIVATE ${INCDIR} + ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile) + target_compile_options(rt.miniprofile PRIVATE -fno-profile-instr-generate -fno-coverage-mapping) diff --git a/libs/libbuiltin/compiler-rt/Make.defs b/libs/libbuiltin/compiler-rt/Make.defs index 9576ea536b6..d269024533a 100644 --- a/libs/libbuiltin/compiler-rt/Make.defs +++ b/libs/libbuiltin/compiler-rt/Make.defs @@ -120,6 +120,7 @@ CSRCS += InstrProfilingPlatform.c else ifeq ($(CONFIG_COVERAGE_MINI)$(CONFIG_ARCH_TOOLCHAIN_CLANG),yy) +FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/profile FLAGS += -fno-profile-instr-generate -fno-coverage-mapping CSRCS += coverage.c