This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 2d323de0b82ebe8643a5720c167799199275671f Author: liang.huang <[email protected]> AuthorDate: Sat Jul 25 10:54:17 2026 +0800 libs/libc/symtab: fix g_allsyms link failure in BUILD_PROTECTED/KERNEL g_allsyms/g_nallsyms only exist in the kernel image, but symtab_allsyms.c is unconditionally built into libc.a, so user-mode code under CONFIG_BUILD_PROTECTED/CONFIG_BUILD_KERNEL fails to link. Guard the affected code so user-mode libc.a no longer references these kernel-only symbols. Signed-off-by: liang.huang <[email protected]> Assisted-by: Claude Code:claude-sonnet-5 --- libs/libc/symtab/symtab_allsyms.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libs/libc/symtab/symtab_allsyms.c b/libs/libc/symtab/symtab_allsyms.c index b2dd9ae5458..852b98d8df2 100644 --- a/libs/libc/symtab/symtab_allsyms.c +++ b/libs/libc/symtab/symtab_allsyms.c @@ -31,6 +31,8 @@ * Public Data ****************************************************************************/ +#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) + extern const struct symtab_s g_allsyms[]; extern const int g_nallsyms; @@ -115,3 +117,21 @@ FAR const struct symtab_s *allsyms_findbyvalue(FAR void *value, { return allsyms_lookup(NULL, value, size); } + +#else + +FAR const struct symtab_s *allsyms_findbyname(FAR const char *name, + FAR size_t *size) +{ + *size = 0; + return NULL; +} + +FAR const struct symtab_s *allsyms_findbyvalue(FAR void *value, + FAR size_t *size) +{ + *size = 0; + return NULL; +} + +#endif /* CONFIG_BUILD_FLAT || __KERNEL__ */
