Skip to content

Commit

Permalink
llvm clang: llvm comes with unwind library, add unwind compilation
Browse files Browse the repository at this point in the history
1. In the llvm clang15 version, the gcov implementation calls the unwind symbol __aeabi_unwind_cpp_pr0
2. Add default link, similar to COMPILER_RT_LIB
3. libUnwind needs to call the __assert_func API

Signed-off-by: wangmingrong1 <[email protected]>
  • Loading branch information
W-M-R committed Oct 15, 2024
1 parent 366ede9 commit f4ef2bc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/arm/src/common/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,12 @@ endif

EXTRA_LIBS += $(COMPILER_RT_LIB)

ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)
COMPILER_UNWIND_LIB := $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name libunwind.a))
endif

EXTRA_LIBS += $(COMPILER_UNWIND_LIB)

ifeq ($(CONFIG_LIBM_TOOLCHAIN),y)
ifeq ($(CONFIG_ARM_TOOLCHAIN_GHS),y)
ifeq ($(CONFIG_ARCH_FPU),y)
Expand Down
7 changes: 7 additions & 0 deletions include/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ void _assert(FAR const char *filename, int linenum,
void __assert(FAR const char *filename, int linenum,
FAR const char *msg) noreturn_function;

/****************************************************************************
* Name: __assert_func
****************************************************************************/

void __assert_func(const char *file, int linenum,
const char *func, const char *msg);

#undef EXTERN
#ifdef __cplusplus
}
Expand Down
6 changes: 6 additions & 0 deletions libs/libc/assert/lib_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ void __assert(FAR const char *filename, int linenum, FAR const char *msg)
_assert(filename, linenum, msg, NULL);
abort();
}

void __assert_func(const char *file, int linenum,
const char *func, const char *msg)
{
__assert(file, linenum, msg);
}

0 comments on commit f4ef2bc

Please sign in to comment.