LibCore+Meta: Workaround some symbols not being exported on FreeBSD

On FreeBSD some symbols like `environ` or `__progname` are not exported
anywhere and are filled in by the dynamic loader. `environ` is
a special case because we make use of it explicitly so we need to mark
it a weak symbol so the linker doesn't complain.
This commit is contained in:
Undefine 2025-06-30 09:39:46 +02:00 committed by Andrew Kaster
parent 3056e54cd0
commit 2aa8c950ca
Notes: github-actions[bot] 2025-07-15 19:46:35 +00:00
2 changed files with 7 additions and 1 deletions

View file

@ -13,6 +13,9 @@
#if defined(AK_OS_MACOS) || defined(AK_OS_IOS)
# include <crt_externs.h>
#elif defined(AK_OS_FREEBSD)
// FIXME: Remove this once FreeBSD exports environ from libc
extern "C" __attribute__((weak)) char** environ;
#elif !defined(AK_OS_WINDOWS)
extern "C" char** environ;
#endif