From nobody Mon Feb 05 20:38:44 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 4TTJBD6zkSz58xr8; Mon, 5 Feb 2024 20:38:44 +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 4TTJBD5nSfz4qQd; Mon, 5 Feb 2024 20:38:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707165524; 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=Vq0jq/cGsyOxaNlBDFEpGckoOCyP2G2fHvvojV4SbQ8=; b=RQWm2Fe1dptW5EUWFqTJ0KE2xWMceKkHq44wGxVC8oNXIHG1VRt5200f26nHJ+To44vlOm GLfwYE6ZkUCc/vYtBlMRKhk5vxkX9jZCujorBWS4+3z515FZUqe6ZKBNU1DYcUoZUyn8PR 0b/q7yl2VvAwopRIkVF4StE2SNr5FTWFrRroax7zLZLdRvESD/ZNqAxHknFXDSXeYRXhph uqk6ExYEpXntsaEw2KKPImzmVXsp8CYZWjMheFF3jwxWQ5/VOvG/j5y+Nk597I5eJke7mx EmcPLqZdW+ZiDMfHRWFcbqLsz1ZLA+fDkgv+v/lkg9uKPUdI2FFbqvNtau61gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707165524; 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=Vq0jq/cGsyOxaNlBDFEpGckoOCyP2G2fHvvojV4SbQ8=; b=sMBsMh3mGgjOwcAJjsmrsQjjV9K0bbHXJOjd5eXh8jq0VPhSrxL2OHeiLB2aAYWJvT1S3S 6lg0P4GWv6iafqmAYHxU00/GJ0nlXInweroyxv9HcFpr94YrnJxBHZdmt8dNvCgnJJvvjO nHh/QivW0ssfrwPgKapoNuBTPjBwbGxlT9m/bexoKqSEgO2WVG/IoefssiXMXjIKdC9x7q gTNhBmdyH7v4xLTFwBgBHXigYS+ot3NCac6NJDaKmOBCbIabSGjdKFNqXepTsUIIGNSaPX ZG1pUW5dycV1uKsOiX5ccpF+2T5R6ZrlHNKiJyc1m1nC0XAvS9CNi/hCsOR7EQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707165524; a=rsa-sha256; cv=none; b=wZh+T+aYbOKfiD2jgQm9AjFy2Y5oldgzfR2rl57fZI3G/hZ6qq+GJicwTMQaLDLu45I3hP tcLG9Tfhpz7JbchAgvJ09k9b46/+xvTeHAy8R9GinbPzQBhmeKCoZqKUxjvn5isLGkufkI BkFdA1AszSCKiWCeZQq4DuTAJkGJmJosKHaOONDFYcWAqNQZfRw+oGg5FGAs3aJNSwFNYM jGFURI/WLq3+sNrJVY4EwGj8e+yk+7Ls9448uxkN/27yf+5uNb+S1TLDaCREaOixqjoN5c CDc97LqUCNMuGHeG6XoeSJ/uVb87jvapk+p2bNUxQ1mN7o9m4bSdtuMqjRH25w== 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 4TTJBD38fBzvlj; Mon, 5 Feb 2024 20:38:44 +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 415KciHm069624; Mon, 5 Feb 2024 20:38:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 415Kciv9069621; Mon, 5 Feb 2024 20:38:44 GMT (envelope-from git) Date: Mon, 5 Feb 2024 20:38:44 GMT Message-Id: <202402052038.415Kciv9069621@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: e9d961055aa2 - main - libsys: plumb in to build 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: e9d961055aa2502f4915611e8fb2e9f9f9c86719 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=e9d961055aa2502f4915611e8fb2e9f9f9c86719 commit e9d961055aa2502f4915611e8fb2e9f9f9c86719 Author: Brooks Davis AuthorDate: 2023-11-15 23:31:57 +0000 Commit: Brooks Davis CommitDate: 2024-02-05 20:34:56 +0000 libsys: plumb in to build libsys provides the FreeBSD kernel interface (auxargs, system calls, vdso). It can be linked directly for programs using a non-standard libc and will later be linked as a filter library to libc providing the actual system call implementation. Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908 --- lib/Makefile | 3 ++ lib/libsys/Makefile | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/libsys/Makefile.sys | 2 ++ share/mk/src.libnames.mk | 11 ++++++++ 4 files changed, 89 insertions(+) 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 + +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 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" diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 33b8507a9eb9..5a6932614b29 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -202,6 +202,7 @@ _LIBRARIES= \ stats \ stdthreads \ supcplusplus \ + sys \ sysdecode \ tacplus \ termcapw \ @@ -401,6 +402,13 @@ _DP_c+= ssp_nonshared .endif _DP_stats= sbuf pthread _DP_stdthreads= pthread +_DP_sys= compiler_rt +# Use libssp_nonshared only on i386 and power*. Other archs emit direct calls +# to __stack_chk_fail, not __stack_chk_fail_local provided by libssp_nonshared. +.if ${MK_SSP} != "no" && \ + (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "") +_DP_sys+= ssp_nonshared +.endif _DP_tacplus= md pam _DP_ncursesw= tinfow _DP_formw= ncursesw @@ -554,6 +562,9 @@ LIBSMDB?= ${LIBSMDBDIR}/libsmdb${PIE_SUFFIX}.a LIBSMUTILDIR= ${_LIB_OBJTOP}/lib/libsmutil LIBSMUTIL?= ${LIBSMUTILDIR}/libsmutil${PIE_SUFFIX}.a +LIBSYSDIR= ${_LIB_OBJTOP}/lib/libsys +LIBSYS?= ${LIBSYSDIR}/libsys${PIE_SUFFIX}.a + LIBNETBSDDIR?= ${_LIB_OBJTOP}/lib/libnetbsd LIBNETBSD?= ${LIBNETBSDDIR}/libnetbsd${PIE_SUFFIX}.a