From nobody Mon Feb 5 20:38:45 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TTJBG0kxXz58y6b; Mon, 5 Feb 2024 20:38:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TTJBF5C9Wz4q9B; Mon, 5 Feb 2024 20:38:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707165525; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HLAJbBSNQTAQihRsiA6NN+Ns2egsdvXCEoynDn32c1c=; b=wEYDI6pwCcCmJySwKSjei7ml03VdBN7m2CZlDsoTvBmMp4I+X8IZOK1b1NT9ghbnTfGOc2 PSo0cKi++Jxf2FW7/7MIX0YmuFX7vxqzgGTSN3lBaeCYmXPo/9vemAyrr33wPeFgENjv4u oDTaUCrcYb43Uq0oQf2iMIFMwudD3DMM5EqcLW+09C3mHLLIC6OQKodCaaHcshv08kozoh CB1OIEuj+d6jjUmL/Q4S4LRAxqk2dL+LvzyBWck0XzvbiHK1JqwKmwPUpnF6R6bym12TUy +aElX3daMuYjW/7R4doenbl/T1RcF8L3bHJOw8c3q9xmrcqK2XI0ZxNteur0zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707165525; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HLAJbBSNQTAQihRsiA6NN+Ns2egsdvXCEoynDn32c1c=; b=iCd3+sJC4iBgGL4XUM+fEkTvbLJvr2C+BPydHPFakL1y/U4lqPs1V8fLQIQM2QQ6b1opoN 8ESbsM+BblLLKSN56zDnFYsl994Zk59TvaIp8/Gf1NiB2I0PDO1NviShl0AFck27lnKrVY 9901V/9dp7s3kufPTEvMi2ybfWzVkjo3UJOyJ57bD5CYMFuNDmkZHoI2dfgCe5fXhGx9i7 /ebt9gvCToy11942O6sdgrRqaFuoNU3vFi2MDs6z8BKS2BKRkGuqSP3drXzJ0zELlgXQb/ lNwCfMQ4lNkhIIyHnwbkNhXGerb2wfAS5rA6xbG2aEDUMVBfx/RsNS/JAG4RzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707165525; a=rsa-sha256; cv=none; b=xoPU6BdNK6GLM3mjPuRsr02+UFK+FmaKmSDAw//IC9WCkWQR8Eb/uOGZG5QegXQgbYdEMJ GGicDPNQLIlMMxV2LK2aLv5VzDoux971TndDO7bBQoJa/ksCc+wkydFqrbQnqPh+sggGvY 6/5XAmzyyG/6EA5kBPzJxEUTexwG2/SpOijFr3qVA2xwtViqwAMSVhkPIsl3WvonnTs6US 8kaeCiWlmd1Go+c1ziPNzRUmLNqpZV+AUHZCR7eWQ+kIPZkK1ATB4ToL6PoZo/jI62RTwc 7LXLt3997V51eg8xyU2Sj5lwjApD199wnS2eJqsY13MyhQiUz87I/45jNYhvDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TTJBF49jGzvMH; Mon, 5 Feb 2024 20:38:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 415KcjHO069667; Mon, 5 Feb 2024 20:38:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 415KcjPr069664; Mon, 5 Feb 2024 20:38:45 GMT (envelope-from git) Date: Mon, 5 Feb 2024 20:38:45 GMT Message-Id: <202402052038.415KcjPr069664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: ef9871c6205c - main - libthr: move _umtx_op_err() to libsys List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef9871c6205c158b16ee23702d2b8c043debc51a Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=ef9871c6205c158b16ee23702d2b8c043debc51a commit ef9871c6205c158b16ee23702d2b8c043debc51a Author: Brooks Davis AuthorDate: 2024-01-17 20:26:52 +0000 Commit: Brooks Davis CommitDate: 2024-02-05 20:34:56 +0000 libthr: move _umtx_op_err() to libsys Declare in sys/umtx.h and implement in libsys. Explicitly link libthr with libsys. When building libthr static include _umtx_op_err so we don't break static linkage with -lpthread. Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908 --- lib/libsys/Makefile | 7 ++++ lib/libsys/Symbol.thr.map | 3 ++ lib/libsys/_umtx_op_err.c | 39 ++++++++++++++++++++++ lib/libsys/amd64/Makefile.thr | 1 + .../arch/amd64 => libsys}/amd64/_umtx_op_err.S | 0 lib/libsys/i386/Makefile.thr | 1 + .../arch/i386 => libsys}/i386/_umtx_op_err.S | 0 lib/libsys/powerpc/Makefile.thr | 1 + .../arch/powerpc => libsys}/powerpc/_umtx_op_err.S | 0 lib/libthr/Makefile | 11 ++++++ lib/libthr/arch/amd64/Makefile.inc | 3 -- lib/libthr/arch/amd64/include/pthread_md.h | 2 -- lib/libthr/arch/i386/Makefile.inc | 3 -- lib/libthr/arch/i386/include/pthread_md.h | 2 -- lib/libthr/arch/powerpc/Makefile.inc | 2 -- lib/libthr/arch/powerpc/include/pthread_md.h | 2 -- lib/libthr/thread/thr_umtx.c | 10 ------ lib/libthr/thread/thr_umtx.h | 1 - rescue/rescue/Makefile | 4 +-- sys/sys/umtx.h | 1 + 20 files changed, 66 insertions(+), 27 deletions(-) diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index 45d3fec14300..b51f44025748 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -59,6 +59,13 @@ NOASM= .include "${LIBSYS_SRCTOP}/Makefile.sys" +SYM_MAPS+= ${LIBSYS_SRCTOP}/Symbol.thr.map +.PATH: ${LIBSYS_SRCTOP}/${MACHINE_CPUARCH} +.sinclude "${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}/Makefile.thr" +.if !${SRCS:M_umtx_op_err.S} +SRCS+=_umtx_op_err.c +.endif + VERSION_DEF=${LIBC_SRCTOP}/Versions.def SYMBOL_MAPS=${SYM_MAPS} diff --git a/lib/libsys/Symbol.thr.map b/lib/libsys/Symbol.thr.map new file mode 100644 index 000000000000..a245de2e547a --- /dev/null +++ b/lib/libsys/Symbol.thr.map @@ -0,0 +1,3 @@ +FBSDprivate_1.0 { + _umtx_op_err; +}; diff --git a/lib/libsys/_umtx_op_err.c b/lib/libsys/_umtx_op_err.c new file mode 100644 index 000000000000..8281b8af7110 --- /dev/null +++ b/lib/libsys/_umtx_op_err.c @@ -0,0 +1,39 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2005 David Xu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +int +_umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2) +{ + if (_umtx_op(obj, op, val, uaddr, uaddr2) == -1) + return (errno); + return (0); +} diff --git a/lib/libsys/amd64/Makefile.thr b/lib/libsys/amd64/Makefile.thr new file mode 100644 index 000000000000..52e861709faf --- /dev/null +++ b/lib/libsys/amd64/Makefile.thr @@ -0,0 +1 @@ +SRCS+= _umtx_op_err.S diff --git a/lib/libthr/arch/amd64/amd64/_umtx_op_err.S b/lib/libsys/amd64/_umtx_op_err.S similarity index 100% rename from lib/libthr/arch/amd64/amd64/_umtx_op_err.S rename to lib/libsys/amd64/_umtx_op_err.S diff --git a/lib/libsys/i386/Makefile.thr b/lib/libsys/i386/Makefile.thr new file mode 100644 index 000000000000..52e861709faf --- /dev/null +++ b/lib/libsys/i386/Makefile.thr @@ -0,0 +1 @@ +SRCS+= _umtx_op_err.S diff --git a/lib/libthr/arch/i386/i386/_umtx_op_err.S b/lib/libsys/i386/_umtx_op_err.S similarity index 100% rename from lib/libthr/arch/i386/i386/_umtx_op_err.S rename to lib/libsys/i386/_umtx_op_err.S diff --git a/lib/libsys/powerpc/Makefile.thr b/lib/libsys/powerpc/Makefile.thr new file mode 100644 index 000000000000..52e861709faf --- /dev/null +++ b/lib/libsys/powerpc/Makefile.thr @@ -0,0 +1 @@ +SRCS+= _umtx_op_err.S diff --git a/lib/libthr/arch/powerpc/powerpc/_umtx_op_err.S b/lib/libsys/powerpc/_umtx_op_err.S similarity index 100% rename from lib/libthr/arch/powerpc/powerpc/_umtx_op_err.S rename to lib/libsys/powerpc/_umtx_op_err.S diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile index dde2a9dce94e..1d34f5cb5f09 100644 --- a/lib/libthr/Makefile +++ b/lib/libthr/Makefile @@ -12,6 +12,9 @@ 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 @@ -67,6 +70,14 @@ PRECIOUSLIB= .include "${.CURDIR}/thread/Makefile.inc" SRCS+= rtld_malloc.c +LIBSYS_SRCTOP= ${.CURDIR:H}/libsys +.if exists(${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}/_umtx_op_err.S) +.PATH: ${LIBSYS_SRCTOP}/${MACHINE_CPUARCH} +.else +.PATH: ${LIBSYS_SRCTOP} +.endif +STATICOBJS+= _umtx_op_err.o + .if ${MK_INSTALLLIB} != "no" SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a .endif diff --git a/lib/libthr/arch/amd64/Makefile.inc b/lib/libthr/arch/amd64/Makefile.inc index 24e5dd7c9b03..f8013ea914ed 100644 --- a/lib/libthr/arch/amd64/Makefile.inc +++ b/lib/libthr/arch/amd64/Makefile.inc @@ -1,6 +1,3 @@ - -SRCS+= _umtx_op_err.S - # With the current compiler and libthr code, using SSE in libthr # does not provide enough performance improvement to outweigh # the extra context switch cost. This can measurably impact diff --git a/lib/libthr/arch/amd64/include/pthread_md.h b/lib/libthr/arch/amd64/include/pthread_md.h index fa0802e64ebb..f43578a8241a 100644 --- a/lib/libthr/arch/amd64/include/pthread_md.h +++ b/lib/libthr/arch/amd64/include/pthread_md.h @@ -52,6 +52,4 @@ _get_curthread(void) return (thr); } -#define HAS__UMTX_OP_ERR 1 - #endif diff --git a/lib/libthr/arch/i386/Makefile.inc b/lib/libthr/arch/i386/Makefile.inc index 24e5dd7c9b03..f8013ea914ed 100644 --- a/lib/libthr/arch/i386/Makefile.inc +++ b/lib/libthr/arch/i386/Makefile.inc @@ -1,6 +1,3 @@ - -SRCS+= _umtx_op_err.S - # With the current compiler and libthr code, using SSE in libthr # does not provide enough performance improvement to outweigh # the extra context switch cost. This can measurably impact diff --git a/lib/libthr/arch/i386/include/pthread_md.h b/lib/libthr/arch/i386/include/pthread_md.h index 2a396abe3824..021ce8126909 100644 --- a/lib/libthr/arch/i386/include/pthread_md.h +++ b/lib/libthr/arch/i386/include/pthread_md.h @@ -52,6 +52,4 @@ _get_curthread(void) return (thr); } -#define HAS__UMTX_OP_ERR 1 - #endif diff --git a/lib/libthr/arch/powerpc/Makefile.inc b/lib/libthr/arch/powerpc/Makefile.inc deleted file mode 100644 index 663706b1b364..000000000000 --- a/lib/libthr/arch/powerpc/Makefile.inc +++ /dev/null @@ -1,2 +0,0 @@ - -SRCS+= _umtx_op_err.S diff --git a/lib/libthr/arch/powerpc/include/pthread_md.h b/lib/libthr/arch/powerpc/include/pthread_md.h index 14f1703b5460..89fae48328cb 100644 --- a/lib/libthr/arch/powerpc/include/pthread_md.h +++ b/lib/libthr/arch/powerpc/include/pthread_md.h @@ -49,6 +49,4 @@ _get_curthread(void) return (NULL); } -#define HAS__UMTX_OP_ERR 1 - #endif /* _PTHREAD_MD_H_ */ diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c index 37b378e74405..c6a032c773db 100644 --- a/lib/libthr/thread/thr_umtx.c +++ b/lib/libthr/thread/thr_umtx.c @@ -30,16 +30,6 @@ #include "thr_private.h" #include "thr_umtx.h" -#ifndef HAS__UMTX_OP_ERR -int _umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2) -{ - - if (_umtx_op(obj, op, val, uaddr, uaddr2) == -1) - return (errno); - return (0); -} -#endif - void _thr_umutex_init(struct umutex *mtx) { diff --git a/lib/libthr/thread/thr_umtx.h b/lib/libthr/thread/thr_umtx.h index a56997871ed1..89f70e4ab14f 100644 --- a/lib/libthr/thread/thr_umtx.h +++ b/lib/libthr/thread/thr_umtx.h @@ -39,7 +39,6 @@ #endif #define DEFAULT_URWLOCK {0,0,0,0,{0,0,0,0}} -int _umtx_op_err(void *, int op, u_long, void *, void *) __hidden; int __thr_umutex_lock(struct umutex *mtx, uint32_t id) __hidden; int __thr_umutex_lock_spin(struct umutex *mtx, uint32_t id) __hidden; int __thr_umutex_timedlock(struct umutex *mtx, uint32_t id, diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile index 7bf3299f4d48..76810a903856 100644 --- a/rescue/rescue/Makefile +++ b/rescue/rescue/Makefile @@ -142,7 +142,7 @@ CRUNCH_PROGS_usr.sbin+= zdb CRUNCH_LIBS+= -l80211 -lalias -lcam -lncursesw -ldevstat -lipsec -llzma .if ${MK_ZFS} != "no" -CRUNCH_LIBS+= -lavl -lpthread -luutil -lumem -ltpool -lspl -lrt +CRUNCH_LIBS+= -lavl -lpthread -lsys -luutil -lumem -ltpool -lspl -lrt CRUNCH_LIBS_zfs+= ${LIBBE} \ ${LIBZPOOL} \ ${LIBZFS} \ @@ -156,7 +156,7 @@ CRUNCH_LIBS_zpool+= ${CRUNCH_LIBS_zfs} CRUNCH_LIBS_zdb+= ${CRUNCH_LIBS_zfs} .else # liblzma needs pthread -CRUNCH_LIBS+= -lpthread +CRUNCH_LIBS+= -lpthread -lsys .endif CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv .if ${MK_OPENSSL} == "no" diff --git a/sys/sys/umtx.h b/sys/sys/umtx.h index 0bc2e3efe594..f7a69ae772c3 100644 --- a/sys/sys/umtx.h +++ b/sys/sys/umtx.h @@ -135,6 +135,7 @@ struct umtx_robust_lists_params { __BEGIN_DECLS int _umtx_op(void *obj, int op, u_long val, void *uaddr, void *uaddr2); +int _umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2); __END_DECLS