From 043507dbd6c50c79ac1366cfb1250e1e3239b74e Mon Sep 17 00:00:00 2001 From: David Palchak Date: Mon, 12 Jul 2021 10:17:09 -0700 Subject: [PATCH] kernel: native_posix: Don't run global C++ constructors On the native_posix board global object constructors are run by the underlying OS runtime init prior to Zephyr kernel init. Thus Zephyr should not run global object constructors a second time. Doing so breaks application behavior that relies on global constructors doing work that must be done only once. See bug #36858 for more information. Signed-off-by: David Palchak --- kernel/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/init.c b/kernel/init.c index 0d829e7f68f..4b587cdc72f 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -197,7 +197,7 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3) #endif boot_banner(); -#ifdef CONFIG_CPLUSPLUS +#if defined(CONFIG_CPLUSPLUS) && !defined(CONFIG_ARCH_POSIX) /* Process the .ctors and .init_array sections */ extern void __do_global_ctors_aux(void); extern void __do_init_array_aux(void);