diff --git a/src/threading.c b/src/threading.c index dcb57cce23a79..c45143f0d01ca 100644 --- a/src/threading.c +++ b/src/threading.c @@ -13,7 +13,7 @@ // Ref https://www.uclibc.org/docs/tls.pdf // For variant 1 JL_ELF_TLS_INIT_SIZE is the size of the thread control block (TCB) // For variant 2 JL_ELF_TLS_INIT_SIZE is 0 -#ifdef _OS_LINUX_ +#if defined(_OS_LINUX_) || defined(_OS_FREEBSD_) # if defined(_CPU_X86_64_) || defined(_CPU_X86_) # define JL_ELF_TLS_VARIANT 2 # define JL_ELF_TLS_INIT_SIZE 0 @@ -30,6 +30,11 @@ # include #endif +// `ElfW` was added to FreeBSD in 12.3 but we still support 12.2 +#if defined(_OS_FREEBSD_) && !defined(ElfW) +# define ElfW(x) __ElfN(x) +#endif + #ifdef __cplusplus extern "C" { #endif