From 84bcb075d73263c2e04236d06fed31b2e4ecfc69 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Mon, 23 May 2022 15:25:46 +0900 Subject: [PATCH] arch: risc-v: Fix crt0.c if CONFIG_HAVE_CXX is not set Summary: - I noticed that rv-virt:knsh64 crashes when it executes the init. - This commit fixes this issue. Impact: - None Testing: - Tested with rv-virt:knsh64 Signed-off-by: Masayuki Ishikawa --- arch/risc-v/src/common/crt0.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/risc-v/src/common/crt0.c b/arch/risc-v/src/common/crt0.c index 9edfb5c3c1..7b6fb5101d 100644 --- a/arch/risc-v/src/common/crt0.c +++ b/arch/risc-v/src/common/crt0.c @@ -169,6 +169,7 @@ void _start(int argc, char *argv[]) ARCH_DATA_RESERVE->ar_sigtramp = (addrenv_sigtramp_t)sig_trampoline; +#ifdef CONFIG_HAVE_CXX /* Call C++ constructors */ exec_ctors(); @@ -176,6 +177,7 @@ void _start(int argc, char *argv[]) /* Setup so that C++ destructors called on task exit */ atexit(exec_dtors); +#endif /* Call the main() entry point passing argc and argv. */