From 2ec1bff4e3cfacb0d3c6d2018e2c09d32090728a Mon Sep 17 00:00:00 2001 From: hujun5 Date: Fri, 19 Sep 2025 11:00:22 +0800 Subject: [PATCH] lib_stackchk.c: a duplicate implementation error reported during compilation Mark __stack_chk_guard and __stack_chk_fail as weak symbols to prevent linker conflicts when multiple definitions of these stack protection symbols exist across different compilation units. Signed-off-by: hujun5 --- libs/libc/assert/lib_stackchk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/libc/assert/lib_stackchk.c b/libs/libc/assert/lib_stackchk.c index e9e5ebedcc9..b07a242ac64 100644 --- a/libs/libc/assert/lib_stackchk.c +++ b/libs/libc/assert/lib_stackchk.c @@ -30,7 +30,7 @@ * Public Data ****************************************************************************/ -FAR const void *const __stack_chk_guard = &__stack_chk_guard; +weak_data FAR const void *const __stack_chk_guard = &__stack_chk_guard; /**************************************************************************** * Public Functions @@ -52,7 +52,7 @@ FAR const void *const __stack_chk_guard = &__stack_chk_guard; * ****************************************************************************/ -void __stack_chk_fail(void) +void weak_function __stack_chk_fail(void) { PANIC(); }