From nobody Thu Aug 21 15:58:18 2025 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 4c77Jq14yrz65KjL; Thu, 21 Aug 2025 15:58:19 +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 4c77Jp1w2qz3Ll9; Thu, 21 Aug 2025 15:58:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755791898; 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=7EbqxRaGqNtPxYEVSyAK/QjtuPS2R+T7snaB9cwaCJ4=; b=h09D4CVSYN2Ws5YtPT4PH2HF9uLINSe0638hB/ppqnRGjzpCuJhGpNXIOMJj4f8w4ptVU0 nie2g+Bdr48MSAxqn1xluy5HX6dcPCqnx3UZgwjnrMetCcYVdBfK6L8j6dFQNeAF1o5UGq X/hFvEbAAqJlWDWBPF+K51TlXG+nIAJ3Z8+oleOt/b6zgjEOpjcDsZ9zkdtdvDf9wIPiqT PsJeg31ycLntoMukVitVptMnmjLxS8AJ4QbjMBVwBrK8IE5IyzShrAd5sVTUf2W7vi8+wA 51BsFWGSVoSLgEa5l5c5ORa/whUYnenyEHJwg9Pbb7h8s5KYVX2YPc+RZVBFIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755791898; 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=7EbqxRaGqNtPxYEVSyAK/QjtuPS2R+T7snaB9cwaCJ4=; b=l080CmOpigPMr6dF4ZQs6uAAPwVxORA06R8P+XiPdbfQyG1jtf/7Eu9wKilZdHJclSsRZi PfCWhGbJMG3LqQmgtONu1lcEOJVXJ2mxsd3Tv1h4cqCgX5tRWGcubr7QR6aidYJBVOvhtj u+jc3oIinhGFmxXAGzpnOvtVB2zBU42VUfXEkVmjyODFUBiR2PI7nP0S8rnbHB7ur0wwcq fiWyBbvN2vVvUjdfq5R3lAxWJXZcIjiAEFs3yc0DbnlldKx+DHKEWJRZuqsAtrZiavxI3q AbQMS21kBU8/8YP6BDn1NlD8uQiWF8vV7cfYqepEs927fmVKT2Mk+uB9lLZnLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755791898; a=rsa-sha256; cv=none; b=lJeTUHAIy+bUuh8x0hCumJubGZFmPmtMsqTXLxyfSOoLTXfKzQNW9B7m2rhux3kkgA0kPS zqe3kg1Ge2mswifuCJXpi7N1bOpIhjVF3XFZ02woqL0RVRPfZwFeVqwKi/ohtD75qYiITS NjJIMJTTavml5HgA8idl/6Y34A8I761Z3lwpC7Ipww+1GbPrStzjBVSUIPOIVriGLXFBiZ 9ASfJzeaAys4veTW2iynJ8BuVT5Php1t5Jrd8TMWhUsRSATvMLeAYRYIJnJsFa7udlKTZN wJ0wHFMOXEt7Vp3aVKqkruLc9lT1TZtroizgLHA66f4ZNtRUxDFHwtD1EN+CZQ== 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 4c77Jp0rFpz15mr; Thu, 21 Aug 2025 15:58:18 +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 57LFwIcv062661; Thu, 21 Aug 2025 15:58:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57LFwIQg062658; Thu, 21 Aug 2025 15:58:18 GMT (envelope-from git) Date: Thu, 21 Aug 2025 15:58:18 GMT Message-Id: <202508211558.57LFwIQg062658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4f81c42fbd76 - main - share/mk: Substitute reproducible prefixes in dwarf info 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 4f81c42fbd76e25c9fe696fa08296b79c55fbf09 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4f81c42fbd76e25c9fe696fa08296b79c55fbf09 commit 4f81c42fbd76e25c9fe696fa08296b79c55fbf09 Author: Mark Johnston AuthorDate: 2025-08-21 14:06:34 +0000 Commit: Mark Johnston CommitDate: 2025-08-21 15:56:23 +0000 share/mk: Substitute reproducible prefixes in dwarf info Ensure that worlds/releases built from different source paths are reproducible. Currently they are not since src and obj paths are embedded in DWARF info. There are some uses of __FILE__ in the src tree as well, and they are similarly handled by this change. Use /usr/src and /usr/obj as the canonical src and obj paths when WITH_REPRODUCIBLE_BUILD is defined. Define a DEBUG_PREFIX variable which is used to ask the compiler to substitute paths in output files using -ffile-prefix-map. Compat builds (i.e., lib32) complicate things since they override OBJROOT to point to obj-${compat} but still refer to headers from the native objroot (e.g., llvm headers). MFC after: 1 month Sponsored by: The FreeBSD Foundation Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50951 --- share/mk/bsd.debug.mk | 22 ++++++++++++++++++++++ share/mk/bsd.opts.mk | 1 + 2 files changed, 23 insertions(+) diff --git a/share/mk/bsd.debug.mk b/share/mk/bsd.debug.mk index fc80bc103061..cf2fb4356aef 100644 --- a/share/mk/bsd.debug.mk +++ b/share/mk/bsd.debug.mk @@ -13,6 +13,28 @@ CFLAGS+= -DNDEBUG MK_WERROR= no .endif +# If reproducible build mode is enabled, map the root of the source +# directory to /usr/src and the root of the object directory to +# /usr/obj. +.if ${MK_REPRODUCIBLE_BUILD} != "no" && !defined(DEBUG_PREFIX) +.if defined(SRCTOP) +DEBUG_PREFIX+= ${SRCTOP:S,/$,,}=/usr/src +.endif +.if defined(OBJROOT) +# Strip off compat subdirectories, e.g., /usr/obj/usr/src/amd64.amd64/obj-lib32 +# becomes /usr/obj/usr/src/amd64.amd64, since object files compiled there might +# refer to something outside the root. +DEBUG_PREFIX+= ${OBJROOT:S,/$,,:C,/obj-[^/]*$,,}=/usr/obj +.endif +.endif + +.if defined(DEBUG_PREFIX) +.for map in ${DEBUG_PREFIX} +CFLAGS+= -ffile-prefix-map=${map} +CXXFLAGS+= -ffile-prefix-map=${map} +.endfor +.endif + .if defined(DEBUG_FLAGS) CFLAGS+=${DEBUG_FLAGS} CXXFLAGS+=${DEBUG_FLAGS} diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index 85247d733a14..439924d0d596 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -78,6 +78,7 @@ __DEFAULT_NO_OPTIONS = \ CCACHE_BUILD \ CTF \ INSTALL_AS_USER \ + REPRODUCIBLE_BUILD \ RETPOLINE \ RUN_TESTS \ STALE_STAGED \