From nobody Tue Sep 30 21:14:41 2025 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 4cbrRQ1XSFz69LR2; Tue, 30 Sep 2025 21:14:42 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cbrRP6gnZz3t5L; Tue, 30 Sep 2025 21:14:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759266881; 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=eO8cG1V4aOiCE4hokgzFmI6oXtmW+OpV1TBcLdOt9c8=; b=MWtnWugm9Z4m1sSfjXSwWNDbS/vlJIip/WeLNEAGRCPIu3kwB+52BbEfuuQX5Es4HqXZkZ jolOWm9W0aMMcFb9Utx3/KZiV0WU9FRo7rB9ASOboHqZG4cIadi1VAuerSCLB3PUVYk32O rKHoYUQghTop0KWwo3YijK6pXrxZds3NOKrGGPMxg5v/12yO97NU/X/uN17XQz88UIHucB tVOjIFV6nFzBtqHbp1Jm8yR0uTS32TmwF34njnK/QA2hFX1YuhQ87lXlTITTJOMJrdLWnp XJ9cEVa02qHaYTRCLC6S9CGsKx8dqXfkOtXAvjUrrdpmn2AciH9M4fFS6PPyIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759266881; 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=eO8cG1V4aOiCE4hokgzFmI6oXtmW+OpV1TBcLdOt9c8=; b=VsheEBnkirIzxn6WldQVcfHjphkzt9PvCJxaUBF4GX4IWyfxVHJdKLVgMAiIXrW9Xxh6JZ 2BkDhUuvVSTdjlrmni1R06wRIe3RKB7pUh9zU7dlKGClQ5OPzV93ioWWk1FIXJK3wBRNvF TRohXYVIrFyWLs6d7h08dbk9/Wv7my/Bc6fRZE9IZzzWvF8ndqytbtgqxRIhw2gzo1c53M uCy0wcq7JF36jZWPBzSXzQjIEYNxVQBk6KIoUKtfdWQ23pkEW1U/gbR0+Nn+F14tQTfvEH rXc4TQytVoD7vGi+xFvKKxcdhLjdAhNHTL7u8AJGQ6cp7G+4W8NtN2Z+gHmEpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759266881; a=rsa-sha256; cv=none; b=EUMa6V7G7iZPccv2nI+KE6NTwzh/zMkf2l2ZDeGnDSXA9pHMKOe5VM8tZ3PcGnDODsFTbP J+zV9lB+ylz7ZoEp53h+zWx08pJw3bFKRtG/UuNUB0aze55J7/3qB/ASQDct+92HsvN17O n5b+Hx7a8SbAYiWr6XvF+C8miUuoiSQgK5TU6S1NEr94lzDrnAhFBGqPcuK6rTmwQilqLp COsa/8usnPmOac5nCeR+YxZ6Q52K5nj19I/CFDCpOUT61XGD1DZ3biOZ3GLNpWIO80mjSV V882E8YiMlKgeAhEg1DRX8MY15w84k7uW6tlSaD2u7cq0jD/czfWwNG2HybvRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cbrRP6Fvbzsqb; Tue, 30 Sep 2025 21:14:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58ULEfe6010395; Tue, 30 Sep 2025 21:14:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58ULEfX0010392; Tue, 30 Sep 2025 21:14:41 GMT (envelope-from git) Date: Tue, 30 Sep 2025 21:14:41 GMT Message-Id: <202509302114.58ULEfX0010392@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 18a65998107a - stable/14 - sys/conf: Remap paths for reproducibility 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 18a65998107a01972ee74576897b36c51a1e6564 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=18a65998107a01972ee74576897b36c51a1e6564 commit 18a65998107a01972ee74576897b36c51a1e6564 Author: Mark Johnston AuthorDate: 2025-08-21 14:04:14 +0000 Commit: Mark Johnston CommitDate: 2025-09-30 21:14:29 +0000 sys/conf: Remap paths for reproducibility As in bsd.lib.mk and bsd.prog.mk, we need to remap paths in the kernel and in kernel modules when reproducible builds are configured. Add directives to kern.post.mk and kmod.mk to remap the src, obj and sysroot dirs. For the sysroot, we need to pass the value of the SYSROOT variable to the kernel makefiles, which involves changing Makefile.inc1. In so doing I reverted a portion of commit 35fb812adfc21; I can't see any harm in passing the SYSROOT variable down. MFC after: 1 month Sponsored by: The FreeBSD Foundation Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50953 (cherry picked from commit eebadc7d8590ff8d38fdbcfd90651c931e713648) --- Makefile.inc1 | 2 +- sys/conf/kern.post.mk | 17 +++++++++++++++-- sys/conf/kmod.mk | 23 +++++++++++++++++++++-- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 84fe2a2eceaf..e3a451b72b10 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1022,7 +1022,7 @@ DESTDIR_MTREE= ${DISTR_MTREECMD} ${DESTDIR_MTREEFLAGS} METALOG_SORT_CMD= env -i LC_COLLATE=C sort # kernel stage -KMAKEENV= ${WMAKEENV:NSYSROOT=*} +KMAKEENV= ${WMAKEENV} KMAKE= ${TIME_ENV} ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} # diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index 320410a337c9..c4e1c9edb65d 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -365,6 +365,19 @@ _ILINKS+= x86 _ILINKS+= i386 .endif +.if ${MK_REPRODUCIBLE_BUILD} != "no" +PREFIX_SYSDIR=/usr/src/sys +PREFIX_OBJDIR=/usr/obj/usr/src/${MACHINE}.${MACHINE_CPUARCH}/sys/${KERN_IDENT} +CFLAGS+= -ffile-prefix-map=${SYSDIR}=${PREFIX_SYSDIR} +CFLAGS+= -ffile-prefix-map=${.OBJDIR}=${PREFIX_OBJDIR} +.if defined(SYSROOT) +CFLAGS+= -ffile-prefix-map=${SYSROOT}=/sysroot +.endif +.else +PREFIX_SYSDIR=${SYSDIR} +PREFIX_OBJDIR=${.OBJDIR} +.endif + # Ensure that the link exists without depending on it when it exists. # Ensure that debug info references the path in the source tree. .for _link in ${_ILINKS} @@ -372,9 +385,9 @@ _ILINKS+= i386 ${SRCS} ${DEPENDOBJS}: ${_link} .endif .if ${_link} == "machine" -CFLAGS+= -fdebug-prefix-map=./machine=${SYSDIR}/${MACHINE}/include +CFLAGS+= -fdebug-prefix-map=./machine=${PREFIX_SYSDIR}/${MACHINE}/include .else -CFLAGS+= -fdebug-prefix-map=./${_link}=${SYSDIR}/${_link}/include +CFLAGS+= -fdebug-prefix-map=./${_link}=${PREFIX_SYSDIR}/${_link}/include .endif .endfor diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 9310f1572b41..806007763de2 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -303,6 +303,25 @@ all: ${PROG} beforedepend: ${_ILINKS} beforebuild: ${_ILINKS} +.if ${MK_REPRODUCIBLE_BUILD} != "no" +PREFIX_SYSDIR=/usr/src/sys +CFLAGS+= -ffile-prefix-map=${SYSDIR}=${PREFIX_SYSDIR} +.if defined(KERNBUILDDIR) +PREFIX_KERNBUILDDIR=/usr/obj/usr/src/${MACHINE}.${MACHINE_CPUARCH}/sys/${KERNBUILDDIR:T} +PREFIX_OBJDIR=${PREFIX_KERNBUILDDIR}/modules/usr/src/sys/modules/${.OBJDIR:T} +CFLAGS+= -ffile-prefix-map=${KERNBUILDDIR}=${PREFIX_KERNBUILDDIR} +.else +PREFIX_OBJDIR=/usr/obj/usr/src/${MACHINE}.${MACHINE_CPUARCH}/sys/modules/${.OBJDIR:T} +.endif +CFLAGS+= -ffile-prefix-map=${.OBJDIR}=${PREFIX_OBJDIR} +.if defined(SYSROOT) +CFLAGS+= -ffile-prefix-map=${SYSROOT}=/sysroot +.endif +.else +PREFIX_SYSDIR=${SYSDIR} +PREFIX_OBJDIR=${.OBJDIR} +.endif + # Ensure that the links exist without depending on it when it exists which # causes all the modules to be rebuilt when the directory pointed to changes. # Ensure that debug info references the path in the source tree. @@ -311,9 +330,9 @@ beforebuild: ${_ILINKS} OBJS_DEPEND_GUESS+= ${_link} .endif .if ${_link} == "machine" -CFLAGS+= -fdebug-prefix-map=./machine=${SYSDIR}/${MACHINE}/include +CFLAGS+= -fdebug-prefix-map=./machine=${PREFIX_SYSDIR}/${MACHINE}/include .else -CFLAGS+= -fdebug-prefix-map=./${_link}=${SYSDIR}/${_link}/include +CFLAGS+= -fdebug-prefix-map=./${_link}=${PREFIX_SYSDIR}/${_link}/include .endif .endfor