aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2024-01-17 20:26:52 +0000
committerBrooks Davis <brooks@FreeBSD.org>2024-02-05 20:34:56 +0000
commitef9871c6205c158b16ee23702d2b8c043debc51a (patch)
tree475baf3f7056c4fbc9f848123a0429ebdb95ce17
parente9d961055aa2502f4915611e8fb2e9f9f9c86719 (diff)
-rw-r--r--lib/libsys/Makefile7
-rw-r--r--lib/libsys/Symbol.thr.map3
-rw-r--r--lib/libsys/_umtx_op_err.c39
-rw-r--r--lib/libsys/amd64/Makefile.thr1
-rw-r--r--lib/libsys/amd64/_umtx_op_err.S (renamed from lib/libthr/arch/amd64/amd64/_umtx_op_err.S)0
-rw-r--r--lib/libsys/i386/Makefile.thr1
-rw-r--r--lib/libsys/i386/_umtx_op_err.S (renamed from lib/libthr/arch/i386/i386/_umtx_op_err.S)0
-rw-r--r--lib/libsys/powerpc/Makefile.thr1
-rw-r--r--lib/libsys/powerpc/_umtx_op_err.S (renamed from lib/libthr/arch/powerpc/powerpc/_umtx_op_err.S)0
-rw-r--r--lib/libthr/Makefile11
-rw-r--r--lib/libthr/arch/amd64/Makefile.inc3
-rw-r--r--lib/libthr/arch/amd64/include/pthread_md.h2
-rw-r--r--lib/libthr/arch/i386/Makefile.inc3
-rw-r--r--lib/libthr/arch/i386/include/pthread_md.h2
-rw-r--r--lib/libthr/arch/powerpc/Makefile.inc2
-rw-r--r--lib/libthr/arch/powerpc/include/pthread_md.h2
-rw-r--r--lib/libthr/thread/thr_umtx.c10
-rw-r--r--lib/libthr/thread/thr_umtx.h1
-rw-r--r--rescue/rescue/Makefile4
-rw-r--r--sys/sys/umtx.h1
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 <davidxu@freebsd.org>
+ * 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 <sys/types.h>
+#include <sys/errno.h>
+#include <sys/umtx.h>
+
+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
index c5fb2f26d6f6..c5fb2f26d6f6 100644
--- a/lib/libthr/arch/amd64/amd64/_umtx_op_err.S
+++ b/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
index 460bd72604aa..460bd72604aa 100644
--- a/lib/libthr/arch/i386/i386/_umtx_op_err.S
+++ b/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
index a954962515f6..a954962515f6 100644
--- a/lib/libthr/arch/powerpc/powerpc/_umtx_op_err.S
+++ b/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