[PATCH v1] stdlib: Mark `abort` as `cold`
Noah Goldstein
goldstein.w.n@gmail.com
Mon Jul 29 07:36:17 GMT 2024
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.
---
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. */
--
2.34.1
More information about the Libc-alpha
mailing list