Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libbuiltin: Fix the problem under linbuitin #14679

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arch/arm/src/cmake/clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ set(PREPROCESS ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} -E -P -x c)

set(NUTTX_FIND_TOOLCHAIN_LIB_DEFINED true)

if(CONFIG_BUILTIN_TOOLCHAIN)
if(NOT CONFIG_COMPILER_RT_BUILTIN)
if(ARGN)
function(nuttx_find_toolchain_lib)
execute_process(
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ endif

# Add the builtin library

ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),y)
ifeq ($(CONFIG_COMPILER_RT_BUILTIN),)
COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)
ifeq ($(wildcard $(COMPILER_RT_LIB)),)
Expand Down
1 change: 1 addition & 0 deletions boards/arm/mps/mps3-an547/configs/clang/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ CONFIG_CMSDK_UART0_RX_IRQ=50
CONFIG_CMSDK_UART0_SERIAL_CONSOLE=y
CONFIG_CMSDK_UART0_TX_IRQ=49
CONFIG_CMSDK_UART=y
CONFIG_COMPILER_RT_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_BUSFAULT=y
CONFIG_DEBUG_FEATURES=y
Expand Down
82 changes: 82 additions & 0 deletions boards/arm/mps/mps3-an547/configs/profile/defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DEBUG_WARN is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="mps3-an547"
CONFIG_ARCH_BOARD_MPS3_AN547=y
CONFIG_ARCH_CHIP="mps"
CONFIG_ARCH_CHIP_MPS3_AN547=y
CONFIG_ARCH_CHIP_MPS=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV8M_SYSTICK=y
CONFIG_ARMV8M_USEBASEPRI=y
CONFIG_ARM_TOOLCHAIN_CLANG=y
CONFIG_BUILTIN=y
CONFIG_BUILTIN_COMPILER_RT=y
CONFIG_CMSDK_UART0=y
CONFIG_CMSDK_UART0_BASE=0x49303000
CONFIG_CMSDK_UART0_CLOCK=25000000
CONFIG_CMSDK_UART0_OV_IRQ=59
CONFIG_CMSDK_UART0_RX_IRQ=50
CONFIG_CMSDK_UART0_SERIAL_CONSOLE=y
CONFIG_CMSDK_UART0_TX_IRQ=49
CONFIG_CMSDK_UART=y
CONFIG_COMPILER_RT_PROFILE=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_BUSFAULT=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_HARDFAULT_ALERT=y
CONFIG_DEBUG_SCHED=y
CONFIG_DEBUG_SCHED_ERROR=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_USAGEFAULT=y
CONFIG_DEFAULT_TASK_STACKSIZE=4096
CONFIG_DEV_ZERO=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXPERIMENTAL=y
CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_FS_TMPFS=y
CONFIG_HAVE_CXX=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_MEMFD_ERROR=y
CONFIG_LIBM=y
CONFIG_MM_REGIONS=2
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAMLOG=y
CONFIG_RAM_SIZE=2097152
CONFIG_RAM_START=0x01000000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_GCOV=y
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SCHED_IRQMONITOR=y
CONFIG_SPINLOCK=y
CONFIG_STACK_COLORATION=y
CONFIG_STANDARD_SERIAL=y
CONFIG_START_DAY=25
CONFIG_START_MONTH=4
CONFIG_START_YEAR=2023
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_GCOV=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_SYSTEM=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_TIMER=y
CONFIG_TIMER_ARCH=y
CONFIG_USEC_PER_TICK=1000
24 changes: 24 additions & 0 deletions boards/arm/mps/mps3-an547/scripts/flash.ld
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

__llvm_prf_names : {
__start__llvm_prf_names = .;
KEEP (*(__llvm_prf_names))
__end__llvm_prf_names = .;
} > flash

.ARM.extab : ALIGN(4) {
*(.ARM.extab*)
} > flash
Expand Down Expand Up @@ -93,6 +99,24 @@ SECTIONS
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
} > sram1 AT > flash

__llvm_prf_data : {
__start__llvm_prf_data = .;
KEEP (*(__llvm_prf_data))
__end__llvm_prf_data = .;
} > sram1 AT > flash

__llvm_prf_vnds : {
__start__llvm_prf_vnds = .;
KEEP (*(__llvm_prf_vnds))
__end__llvm_prf_vnds = .;
} > sram1 AT > flash

__llvm_prf_cnts : {
__start__llvm_prf_cnts = .;
KEEP (*(__llvm_prf_cnts))
__end__llvm_prf_cnts = .;
_edata = ABSOLUTE(.);
} > sram1 AT > flash

Expand Down
10 changes: 9 additions & 1 deletion libs/libbuiltin/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ config COMPILER_RT_VERSION
string "Select LLVM Compiler-rt version"
default "17.0.1"

config COMPILER_RT_BUILTIN
bool "Enable the rt.builtin builtin"
default n

if COMPILER_RT_BUILTIN

config COMPILER_RT_HAS_BFLOAT16
bool "Enable support for bfloat16 in Compiler-rt"
default n

endif # COMPILER_RT_BUILTIN

config COMPILER_RT_PROFILE
bool "Enable profiling support in Compiler-rt"
bool "Enable the rt.profile builtin"
default n

endif # BUILTIN_COMPILER_RT
19 changes: 8 additions & 11 deletions libs/libbuiltin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ CPPOBJS = $(addprefix $(BINDIR)$(DELIM), $(CPPSRCS:.cpp=$(OBJEXT)))
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) $(CPPSRCS)
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) $(CPPOBJS)

BUILTIN_CLEANDIR = $(foreach dir,$(LIBBUILTIN),$(dir)/$(dir))

all: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))

Expand All @@ -59,10 +57,12 @@ $(CPPOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.cpp

context::

.depend: $(LIBBUILTIN)
.depend:
$(Q) mkdir bin
$(Q) mkdir kbin
$(Q) touch $@

depend: .depend
depend: .depend $(LIBBUILTIN)

$(BIN): depend
$(Q) $(MAKE) all EXTRAFLAGS="$(EXTRAFLAGS)"
Expand All @@ -75,12 +75,9 @@ $(KBIN): $(OBJS)
endif

clean:
$(call DELFILE, $(BIN))
$(Q) $(MAKE) -C bin clean
$(Q) $(MAKE) -C kbin clean
$(call CLEAN)

distclean:: clean
$(Q) $(MAKE) -C bin distclean
$(Q) $(MAKE) -C kbin distclean
$(call DELFILE, .depend)
$(call DELDIR, $(BUILTIN_CLEANDIR))
$(call DELDIR, .depend)
$(call DELDIR, bin)
$(call DELDIR, kbin)
35 changes: 0 additions & 35 deletions libs/libbuiltin/bin/Makefile

This file was deleted.

31 changes: 19 additions & 12 deletions libs/libbuiltin/compiler-rt/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -54,38 +54,45 @@ compiler-rt: compiler-rt/compiler-rt
endif

distclean::
$(call DELDIR, $(BINDIR)/compiler-rt)
$(call DELDIR, compiler-rt/compiler-rt)

FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/include
FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/builtins
FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/builtins/${ARCH}
FLAGS += -Wno-shift-count-negative -Wno-constant-conversion -Wshift-count-overflow
FLAGS += -Wno-undef -Wno-incompatible-pointer-types -Wno-visibility -Wno-macro-redefined

################# Builtin Library #################

ifeq ($(CONFIG_COMPILER_RT_BUILTIN),y)

FLAGS += -Wno-undef -Wno-macro-redefined

FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/builtins
FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/builtins/${ARCH}

CSRCS += $(wildcard compiler-rt/compiler-rt/lib/builtins/*.c)
ASRCS += $(wildcard compiler-rt/compiler-rt/lib/builtins/$(ARCH)/*.S)
CSRCS += $(wildcard compiler-rt/compiler-rt/lib/builtins/$(ARCH)/*.c)

ifeq ($(CONFIG_COMPILER_RT_HAS_BFLOAT16),)
BFLOAT16_SRCS := compiler-rt/compiler-rt/lib/builtins/truncdfbf2.c
BFLOAT16_SRCS += compiler-rt/compiler-rt/lib/builtins/truncsfbf2.c
CSRCS := $(filter-out $(BFLOAT16_SRCS), $(CSRCS))
BFLOAT16_SRCS := compiler-rt/compiler-rt/lib/builtins/truncdfbf2.c
BFLOAT16_SRCS += compiler-rt/compiler-rt/lib/builtins/truncsfbf2.c
CSRCS := $(filter-out $(BFLOAT16_SRCS), $(CSRCS))
endif

endif

################# Profile Library #################

ifeq ($(CONFIG_COMPILER_RT_PROFILE),y)
FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/profile
FLAGS += -Wno-cleardeprecated-pragma -Wno-deprecated-pragma -Wno-incompatible-pointer-types
FLAGS += -Wno-shadow -Wno-strict-prototypes -Wno-undef -Wno-unknown-warning-option

FLAGS += -Wno-incompatible-pointer-types -Wno-undef
FLAGS += -Wno-shadow -Wno-strict-prototypes
FLAGS += -DCOMPILER_RT_HAS_UNAME
FLAGS += -fno-profile-generate

FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/profile

CSRCS += $(wildcard compiler-rt/compiler-rt/lib/profile/*.c)
CPPSRCS += $(wildcard compiler-rt/compiler-rt/lib/profile/*.cpp)
CSRCS += compiler-rt/InstrProfilingPlatform.c

endif

AFLAGS += $(FLAGS)
Expand Down
35 changes: 0 additions & 35 deletions libs/libbuiltin/kbin/Makefile

This file was deleted.

1 change: 1 addition & 0 deletions tools/ci/testlist/arm-05.dat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/arm/mps/mps3-an547/configs/ap,CONFIG_ARM_TOOLCHAIN_GNU_EABI
/arm/mps/mps3-an547/configs/bl,CONFIG_ARM_TOOLCHAIN_GNU_EABI
/arm/mps/mps3-an547/configs/clang,CONFIG_ARM_TOOLCHAIN_CLANG
/arm/mps/mps3-an547/configs/profile,CONFIG_ARM_TOOLCHAIN_CLANG
/arm/mps/mps3-an547/configs/nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI
/arm/mps/mps3-an547/configs/picostest,CONFIG_ARM_TOOLCHAIN_GNU_EABI

Expand Down
Loading