LibTest: Prevent -dead_strip from removing assertion handler

The ak_assertion_handler symbol is referenced only through a weak
symbol in AK/Assertions.cpp. With -dead_strip on macOS, the linker
strips the strong definition, breaking EXPECT_DEATH tests which rely
on the handler to longjmp back instead of crashing.

Add retain and used attributes to prevent the linker from removing it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Johan Dahlin
2026-03-16 21:01:40 +01:00
committed by Jelle Raaijmakers
parent 972bcdeebe
commit 29355a0e33
Notes: github-actions[bot] 2026-03-19 17:37:45 +00:00

View File

@@ -38,7 +38,7 @@ static void assertion_handler_impl(char const*)
#if defined(AK_OS_WINDOWS)
# define EXPORT __declspec(dllexport)
#else
# define EXPORT __attribute__((visibility("default")))
# define EXPORT __attribute__((visibility("default"), retain, used))
#endif
extern "C" EXPORT void ak_assertion_handler(char const* message);