macOS: Fix linking statically

`__attribute__((constructor))` does not mark the symbol as used, so the linker ends up dead-stripping the symbol when linked statically.

Adding the `used` attribute fixes that.
This commit is contained in:
Mads Marquart 2024-05-15 21:12:54 +02:00 committed by GitHub
parent 81a771161e
commit fefdce3ee4
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: B5690EEEBB952194

View file

@ -422,6 +422,7 @@ __attribute__((constructor(0)))
#else
__attribute__((constructor)) // seems not supported by g++-11 on the M1
#endif
__attribute__((used))
static void _mi_macos_override_malloc(void) {
malloc_zone_t* purgeable_zone = NULL;