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 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2025-09-19 11:00:22 +08:00 committed by Donny(董九柱)
parent 7801c46a0d
commit 2ec1bff4e3

View file

@ -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();
}