From 49d684369c6682eebca325c55a6c96b7c03f5aeb Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Wed, 7 Feb 2024 19:38:16 +0000 Subject: [PATCH] libthr: filter rather than link with libsys The allows gcc + GNU ld to link programs with -m32 -pthread without erroring out due to _umtx_op_err being undefined (unless -lsys is added to the link command. We now always link _umtx_op_err into libthr (not just when it's static) and filter it with libsys so we call that implementation. The dynamic implementations (at least the assembly ones) should likely become stubs as a further refinement. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D43783 --- lib/libthr/Makefile | 5 ++--- lib/libthr/pthread.map | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile index 1d34f5cb5f0934..932650885deab3 100644 --- a/lib/libthr/Makefile +++ b/lib/libthr/Makefile @@ -13,8 +13,6 @@ MK_SSP= no LIB=thr SHLIB_MAJOR= 3 -LIBADD= sys - NO_WTHREAD_SAFETY=1 NO_WCAST_ALIGN.gcc=1 # for gcc 4.2 CFLAGS+=-DPTHREAD_KERNEL @@ -47,6 +45,7 @@ CFLAGS+=-D_PTHREAD_FORCED_UNWIND .endif LDFLAGS+=-Wl,-znodelete +LDFLAGS+=-Wl,--auxiliary,libsys.so.7 VERSION_DEF=${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS=${.CURDIR}/pthread.map @@ -76,7 +75,7 @@ LIBSYS_SRCTOP= ${.CURDIR:H}/libsys .else .PATH: ${LIBSYS_SRCTOP} .endif -STATICOBJS+= _umtx_op_err.o +OBJS+= _umtx_op_err.o .if ${MK_INSTALLLIB} != "no" SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a diff --git a/lib/libthr/pthread.map b/lib/libthr/pthread.map index 348fd48df39805..aa9abb7e6114d7 100644 --- a/lib/libthr/pthread.map +++ b/lib/libthr/pthread.map @@ -298,6 +298,9 @@ FBSDprivate_1.0 { /* ABI bug workaround, indicate that pli->rtli_version is valid */ _pli_rtli_version; + + /* Expose stub for libsys filter */ + _umtx_op_err; }; FBSD_1.1 {