Otherwise the different instances of _start_c from each compilation unit
will lead to linker errors:
/usr/bin/ld: /tmp/ccSNvRqs.o: in function `_start_c':
nolibc-test-foo.c:(.text.nolibc_memset+0x9): multiple definition of `_start_c'; /tmp/ccG25101.o:nolibc-test.c:(.text+0x1ea3): first defined here
Fixes: 17336755150b ("tools/nolibc: add new crt.h with _start_c")
Signed-off-by: Thomas Weißschuh <[email protected]>
---
tools/include/nolibc/crt.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/include/nolibc/crt.h b/tools/include/nolibc/crt.h
index b84f5fbb7b58..43b551468c2a 100644
--- a/tools/include/nolibc/crt.h
+++ b/tools/include/nolibc/crt.h
@@ -22,6 +22,7 @@ extern void (*const __init_array_end[])(void) __attribute__((weak));
extern void (*const __fini_array_start[])(void) __attribute__((weak));
extern void (*const __fini_array_end[])(void) __attribute__((weak));
+__attribute__((weak))
void _start_c(long *sp)
{
long argc;
---
base-commit: e76716696ba0c5c41667a11caa092cd619a79c5b
change-id: 20231012-nolibc-start_c-multiple-18f954d32e74
Best regards,
--
Thomas Weißschuh <[email protected]>