From: Daniel Gomez <da.gomez@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Nicolas Schier <nsc@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Alex Shi <alexs@kernel.org>, Yanteng Si <si.yanteng@linux.dev>,
Dongliang Mu <dzm91@hust.edu.cn>
Cc: llvm@lists.linux.dev, linux-kbuild@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Daniel Gomez <da.gomez@samsung.com>
Subject: [PATCH] Documentation/kbuild: fix empty string KBUILD_BUILD_TIMESTAMP
Date: Tue, 10 Mar 2026 12:48:43 +0100 [thread overview]
Message-ID: <20260310-fix-llvm-docs-v1-1-234878874762@samsung.com> (raw)
From: Daniel Gomez <da.gomez@samsung.com>
The ccache example in llvm.rst uses KBUILD_BUILD_TIMESTAMP='' but the
text says "should be set to a deterministic value". An empty string is
not deterministic because init/Makefile uses $(or) which treats empty
as false and falls through to $(shell LC_ALL=C date), embedding the
current time:
cat /tmp/test-or.mk
build-timestamp-auto = fallback
build-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP),$(build-timestamp-auto))
all:
@echo "[$(build-timestamp)]"
make --file=/tmp/test-or.mk
[fallback]
KBUILD_BUILD_TIMESTAMP='' make --file=/tmp/test-or.mk
[fallback]
KBUILD_BUILD_TIMESTAMP="Sun Aug 25 20:57:08 UTC 1991" \
make --file=/tmp/test-or.mk
[Sun Aug 25 20:57:08 UTC 1991]
The same applies to a real kernel build:
make O=../build LLVM=1 CC="ccache clang" tinyconfig
make O=../build LLVM=1 CC="ccache clang" \
KBUILD_BUILD_TIMESTAMP='' --jobs=$(nproc)
cat ../build/include/generated/utsversion.h
#define UTS_VERSION "#2 Wed Mar 4 12:13:43 CET 2026"
Replace the empty string with an actual date, matching the pattern
in kbuild.rst and reproducible-builds.rst. Use the first public Linux
announcement as example date.
make O=../build LLVM=1 CC="ccache clang" tinyconfig
make O=../build LLVM=1 CC="ccache clang" \
KBUILD_BUILD_TIMESTAMP="Sun Aug 25 20:57:08 UTC 1991" \
--jobs=$(nproc)
cat ../build/include/generated/utsversion.h
#define UTS_VERSION "#4 Sun Aug 25 20:57:08 UTC 1991"
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Do not use an empty KBUILD_BUILD_TIMESTAMP Makefile variable.
---
Documentation/kbuild/llvm.rst | 2 +-
Documentation/translations/zh_CN/kbuild/llvm.rst | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst
index bc8a283bc44b..ef46533d785f 100644
--- a/Documentation/kbuild/llvm.rst
+++ b/Documentation/kbuild/llvm.rst
@@ -128,7 +128,7 @@ Ccache
KBUILD_BUILD_TIMESTAMP_ should be set to a deterministic value between builds
in order to avoid 100% cache misses, see Reproducible_builds_ for more info)::
- KBUILD_BUILD_TIMESTAMP='' make LLVM=1 CC="ccache clang"
+ KBUILD_BUILD_TIMESTAMP="Sun Aug 25 20:57:08 UTC 1991" make LLVM=1 CC="ccache clang"
.. _KBUILD_BUILD_TIMESTAMP: kbuild.html#kbuild-build-timestamp
.. _Reproducible_builds: reproducible-builds.html#timestamps
diff --git a/Documentation/translations/zh_CN/kbuild/llvm.rst b/Documentation/translations/zh_CN/kbuild/llvm.rst
index f87e0181d8e7..c68fd395f64c 100644
--- a/Documentation/translations/zh_CN/kbuild/llvm.rst
+++ b/Documentation/translations/zh_CN/kbuild/llvm.rst
@@ -116,7 +116,7 @@ Ccache
KBUILD_BUILD_TIMESTAMP_ 应设置为同一确定值,以避免 100% 的缓存未命中,
详见 Reproducible_builds_ 获取更多信息)::
- KBUILD_BUILD_TIMESTAMP='' make LLVM=1 CC="ccache clang"
+ KBUILD_BUILD_TIMESTAMP="Sun Aug 25 20:57:08 UTC 1991" make LLVM=1 CC="ccache clang"
.. _KBUILD_BUILD_TIMESTAMP: kbuild.html#kbuild-build-timestamp
.. _Reproducible_builds: reproducible-builds.html#timestamps
---
base-commit: 11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260310-fix-llvm-docs-1f91c1ec7608
Best regards,
--
Daniel Gomez <da.gomez@samsung.com>
next reply other threads:[~2026-03-10 11:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 11:48 Daniel Gomez [this message]
2026-03-11 8:06 ` [PATCH] Documentation/kbuild: fix empty string KBUILD_BUILD_TIMESTAMP Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260310-fix-llvm-docs-v1-1-234878874762@samsung.com \
--to=da.gomez@kernel.org \
--cc=alexs@kernel.org \
--cc=corbet@lwn.net \
--cc=da.gomez@samsung.com \
--cc=dzm91@hust.edu.cn \
--cc=justinstitt@google.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=nsc@kernel.org \
--cc=si.yanteng@linux.dev \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox