From nobody Tue Feb 6 17:24:35 2024 X-Original-To: dev-commits-src-main@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 4TTqr152Tpz59dPT; Tue, 6 Feb 2024 17:24:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4TTqr11FFTz42sf; Tue, 6 Feb 2024 17:24:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.17.1/8.17.1) with ESMTP id 416HOZZT019545; Tue, 6 Feb 2024 19:24:38 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 416HOZZT019545 Received: (from kostik@localhost) by tom.home (8.17.1/8.17.1/Submit) id 416HOZ90019544; Tue, 6 Feb 2024 19:24:35 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 6 Feb 2024 19:24:35 +0200 From: Konstantin Belousov To: Jessica Clarke Cc: Brooks Davis , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 0d4f7723bc43 - main - libc: link libsys as a auxiliary filter library Message-ID: References: <202402052038.415KckEC069716@gitrepo.freebsd.org> <68B8B759-E01F-498A-850B-23EAE4A3DABC@freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <68B8B759-E01F-498A-850B-23EAE4A3DABC@freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Rspamd-Queue-Id: 4TTqr11FFTz42sf X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Mon, Feb 05, 2024 at 08:52:36PM +0000, Jessica Clarke wrote: > On 5 Feb 2024, at 20:38, Brooks Davis wrote: > > > > The branch main has been updated by brooks: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0d4f7723bc43e06ca22025740cb826a7f282ea11 > > > > commit 0d4f7723bc43e06ca22025740cb826a7f282ea11 > > Author: Brooks Davis > > AuthorDate: 2023-11-15 23:35:16 +0000 > > Commit: Brooks Davis > > CommitDate: 2024-02-05 20:34:56 +0000 > > > > libc: link libsys as a auxiliary filter library > > > > At runtime, when rtld loads libc it will also load libsys. For each > > symbol that is present in both, the libsys one will override the libc > > one. It continues to be the case that program need only link against > > libc (usually implicitly). The linkage to libsys is automatic. > > > > Reviewed by: kib, emaste, imp > > Pull Request: https://github.com/freebsd/freebsd-src/pull/908 > > --- > > Makefile.inc1 | 2 ++ > > UPDATING | 6 ++++++ > > lib/Makefile | 2 +- > > lib/libc/Makefile | 3 +++ > > share/mk/src.libnames.mk | 2 +- > > 5 files changed, 13 insertions(+), 2 deletions(-) > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > index 7a9917fd8a74..f97e53cc7f9a 100644 > > --- a/Makefile.inc1 > > +++ b/Makefile.inc1 > > @@ -3125,10 +3125,12 @@ _startup_libs= lib/csu > > _startup_libs+= lib/libc > > _startup_libs+= lib/libc_nonshared > > _startup_libs+= lib/libcxxrt > > +_startup_libs+= lib/libsys > > > > _prereq_libs+= lib/libgcc_eh lib/libgcc_s > > _startup_libs+= lib/libgcc_eh lib/libgcc_s > > > > +lib/libc__L: lib/libsys__L > > lib/libgcc_s__L: lib/libc__L > > lib/libgcc_s__L: lib/libc_nonshared__L > > lib/libcxxrt__L: lib/libgcc_s__L > > diff --git a/UPDATING b/UPDATING > > index 33bae2a42b9d..aae30936a8b5 100644 > > --- a/UPDATING > > +++ b/UPDATING > > @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW: > > world, or to merely disable the most expensive debugging functionality > > at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > > > +20240205: > > + For dynamically linked programs, system calls are now made from > > + libsys rather than libc. No change in linkage is required as > > + libsys is an auxiliary filter for libc. People building custom > > + images must ensure that libsys.so.7 is included. > > + > > 20240202: > > Loader now also read configuration files listed in local_loader_conf_files. > > Files listed here are the last ones read. And /boot/loader.conf.local was > > diff --git a/lib/Makefile b/lib/Makefile > > index db07883e2b10..9d2531820c8b 100644 > > --- a/lib/Makefile > > +++ b/lib/Makefile > > @@ -123,7 +123,7 @@ SUBDIR_DEPEND_libbsnmp= ${_libnetgraph} > > SUBDIR_DEPEND_libc++:= libcxxrt > > # libssp_nonshared doesn't need to be linked into libc on every arch, but it is > > # small enough to build that this bit of serialization is likely insignificant. > > -SUBDIR_DEPEND_libc= libcompiler_rt libssp_nonshared > > +SUBDIR_DEPEND_libc= libsys libcompiler_rt libssp_nonshared > > SUBDIR_DEPEND_libcam= libsbuf > > SUBDIR_DEPEND_libcasper= libnv > > SUBDIR_DEPEND_libdevstat= libkvm > > diff --git a/lib/libc/Makefile b/lib/libc/Makefile > > index 72300e88d3d7..6a54f7641087 100644 > > --- a/lib/libc/Makefile > > +++ b/lib/libc/Makefile > > @@ -62,6 +62,9 @@ CFLAGS+= -ftls-model=initial-exec > > # > > LDFLAGS+= -nodefaultlibs > > LIBADD+= compiler_rt > > +LIBADD+= sys > > + > > +LDFLAGS+=-Wl,--auxiliary,libsys.so > > >From reading documentation and implementation code (LLD + rtld), should > this not be the soname, i.e. libsys.so.7? Yes it should be soname, since otherwise several things are wrong: - libsys.so open requires /usr mounted - different filter soname/name results in unneeded DT_NEEDED entry for libc 0x000000007ffffffd (AUXILIARY) Auxiliary library: [libsys.so] 0x0000000000000001 (NEEDED) Shared library: [libsys.so.7]