From 0de47d7c83e002e2e8adaffbf0964b0884b1ed3e Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Fri, 2 Jun 2023 23:06:59 +0200 Subject: [PATCH] Ensure panic functions are never stripped. --- src/compiler/semantic_analyser.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/semantic_analyser.c b/src/compiler/semantic_analyser.c index cddbdcd5b..0abf1e60c 100644 --- a/src/compiler/semantic_analyser.c +++ b/src/compiler/semantic_analyser.c @@ -261,6 +261,8 @@ static void assign_panicfn(void) error_exit("Expected panic function to have the signature fn void(String, String, String, uint)."); } global_context.panic_var = decl; + decl->no_strip = true; + if (active_target.no_stdlib) return; const char *panicf = "std::core::builtin::panicf"; @@ -275,6 +277,8 @@ static void assign_panicfn(void) return; } + panicf_decl->no_strip = true; + Type *panicf_fn_type = panicf_decl->type->canonical; if (panicf_decl->decl_kind != DECL_FUNC) {