diff --git a/lib/libc/gen/uexterr_gettext.c b/lib/libc/gen/uexterr_gettext.c --- a/lib/libc/gen/uexterr_gettext.c +++ b/lib/libc/gen/uexterr_gettext.c @@ -8,7 +8,8 @@ * under sponsorship from the FreeBSD Foundation. */ -#include +#define _WANT_P_OSREL +#include #include #include #include @@ -18,11 +19,14 @@ .ver = UEXTERROR_VER, }; +int __getosreldate(void); + static void uexterr_ctr(void) __attribute__((constructor)); static void uexterr_ctr(void) { - exterrctl(EXTERRCTL_ENABLE, 0, &uexterr); + if (__getosreldate() >= P_OSREL_EXTERRCTL) + exterrctl(EXTERRCTL_ENABLE, 0, &uexterr); } int diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c --- a/lib/libthr/thread/thr_create.c +++ b/lib/libthr/thread/thr_create.c @@ -27,6 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define _WANT_P_OSREL #include "namespace.h" #include #include @@ -44,6 +45,8 @@ #include "libc_private.h" #include "thr_private.h" +int __getosreldate(void); + static int create_stack(struct pthread_attr *pattr); static void thread_start(struct pthread *curthread); @@ -287,7 +290,8 @@ #endif curthread->uexterr.ver = UEXTERROR_VER; - exterrctl(EXTERRCTL_ENABLE, 0, &curthread->uexterr); + if (__getosreldate() >= P_OSREL_EXTERRCTL) + exterrctl(EXTERRCTL_ENABLE, 0, &curthread->uexterr); /* Run the current thread's start routine with argument: */ _pthread_exit(curthread->start_routine(curthread->arg)); diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -33,6 +33,7 @@ * SUCH DAMAGE. */ +#define _WANT_P_OSREL #include "namespace.h" #include #include @@ -59,6 +60,7 @@ #include "libc_private.h" #include "thr_private.h" +int __getosreldate(void); char *_usrstack; struct pthread *_thr_initial; int _libthr_debug; @@ -434,7 +436,8 @@ #endif thread->uexterr.ver = UEXTERROR_VER; - exterrctl(EXTERRCTL_ENABLE, EXTERRCTLF_FORCE, &thread->uexterr); + if (__getosreldate() >= P_OSREL_EXTERRCTL) + exterrctl(EXTERRCTL_ENABLE, EXTERRCTLF_FORCE, &thread->uexterr); /* Others cleared to zero by thr_alloc() */ } diff --git a/sys/sys/param.h b/sys/sys/param.h --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -107,6 +107,7 @@ #define P_OSREL_TIDPID 1400079 #define P_OSREL_ARM64_SPSR 1400084 #define P_OSREL_TLSBASE 1500044 +#define P_OSREL_EXTERRCTL 1500045 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif