From e3b0b3484cac61f9eae373751ac6eaf816a2c9c3 Mon Sep 17 00:00:00 2001 From: Noah Goldstein Date: Mon, 29 Jul 2024 15:34:33 +0800 Subject: [PATCH] stdlib: Mark `abort` as `cold` This helps HotColdSplitting in GCC/LLVM. Thought about doing `exit` as well since its only called once per process, but since its easy to imagine a hot path leading into `exit(0)`, its less clear if its profitable. Reviewed-by: Carlos O'Donell --- stdlib/stdlib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 901926e893..17487c6640 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -727,7 +727,7 @@ extern void *aligned_alloc (size_t __alignment, size_t __size) #endif /* Abort execution and generate a core-dump. */ -extern void abort (void) __THROW __attribute__ ((__noreturn__)); +extern void abort (void) __THROW __attribute__ ((__noreturn__)) __COLD; /* Register a function to be called when `exit' is called. */