Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Feb 2024 19:51:27 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 49d684369c66 - main - libthr: filter rather than link with libsys
Message-ID:  <202402071951.417JpRgf034979@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=49d684369c6682eebca325c55a6c96b7c03f5aeb

commit 49d684369c6682eebca325c55a6c96b7c03f5aeb
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-02-07 19:38:16 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-02-07 19:50:47 +0000

    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 1d34f5cb5f09..932650885dea 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 348fd48df398..aa9abb7e6114 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 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402071951.417JpRgf034979>