aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2023-11-15 23:31:57 +0000
committerBrooks Davis <brooks@FreeBSD.org>2024-02-05 20:34:56 +0000
commite9d961055aa2502f4915611e8fb2e9f9f9c86719 (patch)
treef333a1f7b58ba8eb5e61217f804a95d6a3bb39b2 /lib
parent86deddfacb6f66549303c1cea241a55de25fc0c2 (diff)
downloadsrc-e9d961055aa2502f4915611e8fb2e9f9f9c86719.tar.gz
src-e9d961055aa2502f4915611e8fb2e9f9f9c86719.zip
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile3
-rw-r--r--lib/libsys/Makefile73
-rw-r--r--lib/libsys/Makefile.sys2
3 files changed, 78 insertions, 0 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 4b1bda780b2d..db07883e2b10 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -19,6 +19,7 @@ SUBDIR_BOOTSTRAP= \
libelf \
libssp \
libssp_nonshared \
+ libsys \
msun
# The main list; please keep these sorted alphabetically.
@@ -137,6 +138,8 @@ SUBDIR_DEPEND_libpjdlog= libutil
SUBDIR_DEPEND_libprocstat= libkvm libutil
SUBDIR_DEPEND_libradius= libmd
SUBDIR_DEPEND_libsmb= libkiconv
+# See comment above about libssp_nonshared
+SUBDIR_DEPEND_libsys= libcompiler_rt libssp_nonshared
SUBDIR_DEPEND_libtacplus= libmd
SUBDIR_DEPEND_libulog= libmd
SUBDIR_DEPEND_libunbound= ${_libldns}
diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile
new file mode 100644
index 000000000000..45d3fec14300
--- /dev/null
+++ b/lib/libsys/Makefile
@@ -0,0 +1,73 @@
+PACKAGE= clibs
+SHLIBDIR?= /lib
+
+.include <src.opts.mk>
+
+LIBC_SRCTOP?= ${.CURDIR}/../libc
+LIBSYS_SRCTOP?= ${.CURDIR}
+
+# Pick the current architecture directory for libsys. In general, this is named
+# MACHINE_CPUARCH, but some ABIs are different enough to require their own
+# libsys, so allow a directory named MACHINE_ARCH to override this (though
+# treat powerpc64le and powerpc64 the same).
+# Note: This is copied from libc/Makefile
+M=${MACHINE_ARCH:S/powerpc64le/powerpc64/}
+.if exists(${LIBC_SRCTOP}/${M})
+LIBC_ARCH=${M}
+.else
+LIBC_ARCH=${MACHINE_CPUARCH}
+.endif
+
+LIB=sys
+SHLIB_MAJOR= 7
+WARNS?= 2
+
+CFLAGS+=-I${LIBSYS_SRCTOP}/include -I${LIBC_SRCTOP}/include
+CFLAGS+=-I${LIBSYS_SRCTOP}/${LIBC_ARCH}
+CFLAGS+=-I${LIBC_SRCTOP}/${LIBC_ARCH}
+
+CLEANFILES+=tags
+INSTALL_PIC_ARCHIVE=
+#XXX? BUILD_NOSSP_PIC_ARCHIVE=
+PRECIOUSLIB=
+
+# Use a more efficient TLS model for libc since we can reasonably assume that
+# it will be loaded during program startup.
+CFLAGS+= -ftls-model=initial-exec
+
+#
+# Link with static libcompiler_rt.a.
+#
+LDFLAGS+= -nodefaultlibs
+LIBADD+= compiler_rt
+
+.if ${MK_SSP} != "no" && \
+ (${LIBC_ARCH} == "i386" || ${LIBC_ARCH:Mpowerpc*} != "")
+LIBADD+= ssp_nonshared
+.endif
+
+#.if ${MK_SSP} != "no" && \
+# (${LIBC_ARCH} == "i386" || ${LIBC_ARCH:Mpowerpc*} != "")
+#LIBADD+= ssp_nonshared
+#.endif
+
+# Define (empty) variables so that make doesn't give substitution
+# errors if the included makefiles don't change these:
+MDASM=
+MIASM=
+NOASM=
+
+.include "${LIBSYS_SRCTOP}/Makefile.sys"
+
+VERSION_DEF=${LIBC_SRCTOP}/Versions.def
+SYMBOL_MAPS=${SYM_MAPS}
+
+# XXX: let libc install the manpages for now
+MAN=
+MLINKS=
+
+# XXX: move sys tests?
+#HAS_TESTS=
+#SUBDIR.${MK_TESTS}+= tests
+
+.include <bsd.lib.mk>
diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys
index c2373b972bb1..f88a107f9eb8 100644
--- a/lib/libsys/Makefile.sys
+++ b/lib/libsys/Makefile.sys
@@ -158,6 +158,7 @@ ${SPSEUDO}:
printf ${NOTE_GNU_STACK} >>${.TARGET}
printf ${FEATURE_NOTE} >> ${.TARGET}
+.if ${LIB} == "sys"
MAN+= abort2.2 \
accept.2 \
access.2 \
@@ -541,3 +542,4 @@ MLINKS+=wait.2 wait3.2 \
MLINKS+=write.2 pwrite.2 \
write.2 pwritev.2 \
write.2 writev.2
+.endif # ${LIB} == "sys"