sync scripts/Makefile.extrawarn with 6.1, enable WERROR for host tools
cover sync scripts/Makefile.extrawarn with 6.1, enable WERROR for host tools
I ended up being surprised host tools aren't compiled with -Werror even when CONFIG_WERROR is set.
While this is an issue for local builds, buildman (used in CI) adds -Werror to KCFLAGS and HOSTCFLAGS when passed -E (or --warnings-as-errors), which we do, see
'build all platforms in a single job' job and &buildman_and_testpy_dfn template.
It turns out that even though we claim to have synchronized our kbuild with Linux kernel v6.1, some of it was stuck to v5.1 +- some partial backports. This doesn't attempt to update everything that isn't in sync with 6.1 though!
The first two patches are for fixing pytest calling make directly on a "dirty" build directory as generated by buildman using the clang-20 toolchain, but pytest does not set HOSTCC and CC to clang-20, resulting in clang flags being used with gcc).
One can simply reproduce it (after backporting up to patch "scripts/Makefile.extrawarn: sync with 6.1") by doing so in the container:
make HOSTCC=clang-20 CC=clang-20 O=build/sandbox sandbox_defconfig make HOSTCC=clang-20 CC=clang-20 O=build/sandbox -j`nproc make O=build/sandbox u-boot-initial-env
It'll print:
gcc: error: unrecognized command-line option '-mno-global-merge'
gcc: error: unrecognized command-line option '-Wformat-invalid-specifier'
gcc: error: unrecognized command-line option '-Qunused-arguments'
This is essentially what's run within test_env_initial_env_file in test/py/tests/test_env.py.
While I'm not unhappy with the patches to pytest, it feels to me we may be missing something else for the u-boot-initial-env make target to update the kconfig symbol based on the toolchain being used when called.
While looking at the kernel git history for Makefile and scripts/Makefile.extrawarn I also saw a few flags being removed or reworked so I took the liberty of backporting some.
Then, scripts/Makefile.extrawarn is directly imported verbatim from v6.1 which is the version we've claimed to be synced with so far.
Also, patches to apply CONFIG_WERROR to the host tools as well as linker and assembler are backported.
kernel-doc is made to ignore KBUILD_EXTRA_WARN since we have too many warnings for now and it prevents us from being able to use W=e Make variable which is extremely convenient to essentially do the same as setting CONFIG_WERROR in Kconfig, just without needing to actually set it in the defconfig or in a .config. I don't like it but it is what it is. Our kernel-doc has a couple of patches on top of Linux kernel v5.11's. The kernel has moved to a Python script this year, so it's probably wise to migrate to that before trying to tackle kernel-doc warnings.
Finally, buildman is made to use W=e such that the same logic as CONFIG_WERROR is applied (instead of manually configuring KCFLAGS and HOSTCFLAGS which only modifies host and target cflags and not linker or assembler flags like CONFIG_WERROR now does).
RFC because I don't like the commenting of kernel-doc but I think it's worth it. RFC also because I think something must be broken in the handling of u-boot-initial-env make target which doesn't check the compiler vs what's in .config (or maybe some other issue, don't know but we shouldn't end up using clang flags with gcc or vice-versa).
CI pipeline here: https://source.denx.de/u-boot/contributors/qschulz/u-boot/-/pipelines/29975
Only change is:
# diff --git a/test/py/conftest.py b/test/py/conftest.py
# index 8852df2235e..a26aaee7b2f 100644
# --- a/test/py/conftest.py
# +++ b/test/py/conftest.py
# @@ -121,10 +121,9 @@ def run_build(config, source_dir, build_dir, board_type, log):
# o_opt = 'O=%s' % build_dir
# else:
# o_opt = ''
# - base_cmd = ['make', *config.getoption('make_args'), o_opt, '-s']
# cmds = (
# - base_cmd + [board_type + '_defconfig'],
# - base_cmd + ['-j{}'.format(os.cpu_count())],
# + ['make', *config.getoption('make_args'), o_opt, '-s', board_type + '_defconfig'],
# + ['make', *config.getoption('make_args'), o_opt, '-s', '-j{}'.format(os.cpu_count())],
# )
# name = 'make'because I changed my mind factoring out the start of the make cmds in run_build.
---
Quentin Schulz (18):
test/py: add pytest --make-args argument for additional Make arguments
CI: pass clang HOSTCC and CC to pytest scripts/Makefile.extrawarn: migrate -Wvla to a U-Boot-specific file
kbuild: re-enable int-in-bool-context warning
kbuild: Don't try to add '-fcatch-undefined-behavior' flag
Makefile: move deprecated-non-prototype to scripts/Makefile.extrawarn.u-boot scripts/Makefile.extrawarn: handle CONFIG_WERROR in U-Boot-specific file scripts/Makefile.extrawarn: sync with 6.1
kbuild: support W=c and W=e shorthands for Kconfig
kbuild: align W=e with CONFIG_WERROR
kbuild: unify W=e and CONFIG_WERROR scripts/Makefile.extrawarn.u-boot: remove redundant Werror handling
kbuild: rust: move -Dwarnings handling to Makefile.extrawarn
kbuild: respect CONFIG_WERROR for linker and assembler
kbuild: enable -Werror for hostprogs scripts/Makefile.extrawarn: Respect CONFIG_WERROR / W=e for hostprogs scripts/Makefile.build: do not run kernel-docs with warnings
buildman: set W flag to e to be consistent with CONFIG_WERROR
.gitlab-ci.yml | 2 + Makefile | 17 +++- scripts/Makefile.build | 5 +- scripts/Makefile.extrawarn | 175 +++++++++++++++++++++--------------- scripts/Makefile.extrawarn.u-boot | 27 ++++++ scripts/kconfig/Makefile | 8 ++ test/py/conftest.py | 6 +- test/py/tests/test_cleanup_build.py | 4 +- test/py/tests/test_env.py | 4 +- tools/buildman/builderthread.py | 1 + 10 files changed, 165 insertions(+), 84 deletions(-)
---
base-commit: bb0f3eebb3c196d9b6efbbd1e5aa9b16abbb9ad6
change-id: 20260429-extrawarn-sync-504f65d2ff21
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
RFC PATCH 1/18 test/py: add pytest --make-args argument for additional Make arguments
From: Quentin Schulz <[email protected]>
We manually execute make commands within some tests, sometimes from "dirty" build directories.
One example is the test_env_initial_env_file test which calls make u-boot-initial-env
in a build directory that has already been populated possibly before pytest is run (which is the case in our GitLab CI/CD).
In "sandbox with clang test.py" and "sandbox64 with clang test.py" we build before pytest with clang-20 but pytest will call make without setting HOSTCC or CC to clang-20, which results in clang flags being used with gcc. Right now, it isn't triggering a build issue because we use cc-disable-warning to disable the warning only if it's available, so the clang flags aren't added. However, in a few commits we'll bump scripts/Makefile.extrawarn to a newer version from the Linux kernel (6.1) and it won't be used anymore, thus triggering fails.
Add an option to specify make arguments such that a user can provide HOSTCC and CC for when the build directory to reuse has been built with clang.
--- test/py/conftest.py | 6 ++++-- test/py/tests/test_cleanup_build.py | 4 ++-- test/py/tests/test_env.py | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-)
test/py/conftest.py +4 -2
@@ -95,6 +95,8 @@ def pytest_addoption(parser): help="Assume that U-Boot is ready and don't wait for a prompt") parser.addoption('--timing', default=False, action='store_true', help='Show info on test timing') + parser.addoption('--make-args', action='append', default=[], + help='Provide arguments to pass to the "make" command, e.g. HOSTCC=clang-20') def run_build(config, source_dir, build_dir, board_type, log):
@@ -120,8 +122,8 @@ def run_build(config, source_dir, build_dir, board_type, log): else: o_opt = '' cmds = ( - ['make', o_opt, '-s', board_type + '_defconfig'], - ['make', o_opt, '-s', '-j{}'.format(os.cpu_count())], + ['make', *config.getoption('make_args'), o_opt, '-s', board_type + '_defconfig'], + ['make', *config.getoption('make_args'), o_opt, '-s', '-j{}'.format(os.cpu_count())], ) name = 'make'
test/py/tests/test_cleanup_build.py +2 -2
@@ -32,12 +32,12 @@ def tmp_copy_of_builddir(u_boot_config, tmp_path): @pytest.fixture(scope="module") -def run_make(u_boot_log): +def run_make(pytestconfig, u_boot_log): """Provide function to run and log make without connecting to u-boot console.""" runner = u_boot_log.get_runner("make", sys.stdout) def _run_make(build_dir, target): - cmd = ["make", f"O={build_dir}", target] + cmd = ["make", *pytestconfig.getoption("make_args"), f"O={build_dir}", target] runner.run(cmd) yield _run_make
test/py/tests/test_env.py +2 -2
@@ -175,7 +175,7 @@ def validate_set(state_test_env, var, value): assert response == ('%s=%s' % (var, value)) @pytest.mark.boardspec('sandbox') -def test_env_initial_env_file(ubman): +def test_env_initial_env_file(pytestconfig, ubman): """Test that the u-boot-initial-env make target works""" builddir = 'O=' + ubman.config.build_dir envfile = ubman.config.build_dir + '/u-boot-initial-env'
@@ -186,7 +186,7 @@ def test_env_initial_env_file(ubman): except: pass - utils.run_and_log(ubman, ['make', builddir, 'u-boot-initial-env']) + utils.run_and_log(ubman, ['make', *pytestconfig.getoption('make_args'), builddir, 'u-boot-initial-env']) assert os.path.exists(envfile)
Signature · 1 line
2.54.0
Re: [PATCH RFC next 01/18] test/py: add pytest --make-args argument for additional Make arguments
Quoted 23 lines · Quentin Schulz
test/py: add pytest --make-args argument for additional Make arguments
We manually execute make commands within some tests, sometimes from 'dirty' build directories.
One example is the
test_env_initial_env_filetest which calls make u-boot-initial-env
in a build directory that has already been populated possibly before pytest is run (which is the case in our GitLab CI/CD).In "sandbox with clang
test.py" and "sandbox64 with clangtest.py" we build before pytest with clang-20 but pytest will call make without setting HOSTCC or CC to clang-20, which results in clang flags being used with gcc. Right now, it isn't triggering a build issue because we use cc-disable-warning to disable the warning only if it's available, so the clang flags aren't added. However, in a few commits we'll bumpscripts/Makefile.extrawarnto a newer version from the Linux kernel (6.1) and it won't be used anymore, thus triggering fails.Add an option to specify make arguments such that a user can provide HOSTCC and CC for when the build directory to reuse has been built with clang.
Quoted 6 lines
Signed-off-by Quentin Schulz <[email protected]>
test/py/conftest.py| 6 ++++--test/py/tests/test_cleanup_build.py | 4 ++-- test/py/tests/test_env.py | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-)
RFC PATCH 2/18 CI: pass clang HOSTCC and CC to pytest
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
test_env_initial_env_file test calls make on the build directory passed with --build-dir parameter which points at UBOOT_TRAVIS_BUILD_DIR which is populated with buildman before pytest is run. For "sandbox with clang test.py" and "sandbox64 with clang test.py" jobs, buildman uses clang-20 toolchain, but pytest isn't configured to use that as well, resulting in gcc being used with a configuration made with clang-20 toolchain.
Specify the HOSTCC and CC clang make arguments so pytest uses the proper toolchain, this will be required in a few commits when we'll upgrade to a newer version of scripts/Makefile.extrawarn which gets rid of checking whether a clang flag exists (because it's supported by the min clang version the kernel advertises as being supported) which will be an issue since GCC for sure doesn't support all clang flags.
--- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+)
.gitlab-ci.yml +2 -0
@@ -288,6 +288,7 @@ sandbox with clang test.py: - ${HOST} variables: TEST_PY_BD: "sandbox" + TEST_PY_EXTRA: "--make-args HOSTCC=clang-20 --make-args CC=clang-20" OVERRIDE: "-O clang-20" # addr2line in Ubuntu 'Noble' and later are broken. TEST_PY_TEST_SPEC: "not event_dump"
@@ -313,6 +314,7 @@ sandbox64 with clang test.py: - ${HOST} variables: TEST_PY_BD: "sandbox64" + TEST_PY_EXTRA: "--make-args HOSTCC=clang-20 --make-args CC=clang-20" OVERRIDE: "-O clang-20" <<: *buildman_and_testpy_dfn
Signature · 1 line
2.54.0
Re: [PATCH RFC next 02/18] CI: pass clang HOSTCC and CC to pytest
Quoted 26 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
test_env_initial_env_filetest calls make on the build directory passed with --build-dir parameter which points atUBOOT_TRAVIS_BUILD_DIRwhich is populated with buildman before pytest is run. For "sandbox with clangtest.py" and "sandbox64 with clangtest.py" jobs, buildman uses clang-20 toolchain, but pytest isn't configured to use that as well, resulting in gcc being used with a configuration made with clang-20 toolchain.Specify the HOSTCC and CC clang make arguments so pytest uses the proper toolchain, this will be required in a few commits when we'll upgrade to a newer version of
scripts/Makefile.extrawarnwhich gets rid of checking whether a clang flag exists (because it's supported by the min clang version the kernel advertises as being supported) which will be an issue since GCC for sure doesn't support all clang flags.Signed-off-by Quentin Schulz <[email protected]>--- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+).gitlab-ci.yml +0
-0
.gitlab-ci.yml sandbox with clang test.py: · line 291
Quoted 4 lines
.gitlab-ci.yml +1
-0@@ -288,6 +288,7 @@ sandbox with clang test.py: - ${HOST} variables: TEST_PY_BD: "sandbox" + TEST_PY_EXTRA: "--make-args HOSTCC=clang-20 --make-args CC=clang-20"
Is ""--make-args 'HOSTCC=clang-20 CC=clang-20'" not parsed correctly ?
Signature · 1 line
Tom
Re: [PATCH RFC next 02/18] CI: pass clang HOSTCC and CC to pytest
Hi Tom,
Quoted 22 lines · Tom Rini
Quoted 21 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
test_env_initial_env_filetest calls make on the build directory passed with --build-dir parameter which points atUBOOT_TRAVIS_BUILD_DIRwhich is populated with buildman before pytest is run. For "sandbox with clangtest.py" and "sandbox64 with clangtest.py" jobs, buildman uses clang-20 toolchain, but pytest isn't configured to use that as well, resulting in gcc being used with a configuration made with clang-20 toolchain.Specify the HOSTCC and CC clang make arguments so pytest uses the proper toolchain, this will be required in a few commits when we'll upgrade to a newer version of
scripts/Makefile.extrawarnwhich gets rid of checking whether a clang flag exists (because it's supported by the min clang version the kernel advertises as being supported) which will be an issue since GCC for sure doesn't support all clang flags.Signed-off-by Quentin Schulz <[email protected]>--- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+)
Quoted 12 lines
.gitlab-ci.yml sandbox with clang test.py: · line 291
Quoted 9 lines
.gitlab-ci.yml +1
-0@@ -288,6 +288,7 @@ sandbox with clang test.py: - ${HOST} variables: TEST_PY_BD: "sandbox" + TEST_PY_EXTRA: "--make-args HOSTCC=clang-20 --make-args CC=clang-20"Is ""--make-args 'HOSTCC=clang-20 CC=clang-20'" not parsed correctly ?
Well, this will make 'HOSTCC=clang-20 CC=clang-20' a single argument no?
Try:
make 'HOSTCC=clang CC=clang'
Makefile doesn't like it.
If you're complaining about the need for duplicating --make-args, it's a choice I made when selecting the "append" action for that parameter, c.f. https://docs.python.org/3/library/argparse.html#action.
We could use the "extend" action with nargs=* or +, but I personally hate those. It'd look like something like that:
--make-args HOSTCC=clang-20 CC=clang-20
It requires you to be aware of the special "--" argument to stop parsing of command options and start parsing positional arguments. Cheers,
Quentin
Re: [PATCH RFC next 02/18] CI: pass clang HOSTCC and CC to pytest
Quoted 49 lines · Quentin Schulz
Hi Tom,
Quoted 22 lines · Tom Rini
Quoted 21 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
test_env_initial_env_filetest calls make on the build directory passed with --build-dir parameter which points atUBOOT_TRAVIS_BUILD_DIRwhich is populated with buildman before pytest is run. For "sandbox with clangtest.py" and "sandbox64 with clangtest.py" jobs, buildman uses clang-20 toolchain, but pytest isn't configured to use that as well, resulting in gcc being used with a configuration made with clang-20 toolchain.Specify the HOSTCC and CC clang make arguments so pytest uses the proper toolchain, this will be required in a few commits when we'll upgrade to a newer version of
scripts/Makefile.extrawarnwhich gets rid of checking whether a clang flag exists (because it's supported by the min clang version the kernel advertises as being supported) which will be an issue since GCC for sure doesn't support all clang flags.Signed-off-by Quentin Schulz <[email protected]>--- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+)Quoted 12 lines
.gitlab-ci.yml sandbox with clang test.py: · line 291
Quoted 9 lines
.gitlab-ci.yml +1
-0@@ -288,6 +288,7 @@ sandbox with clang test.py: - ${HOST} variables: TEST_PY_BD: "sandbox" + TEST_PY_EXTRA: "--make-args HOSTCC=clang-20 --make-args CC=clang-20"Is ""--make-args 'HOSTCC=clang-20 CC=clang-20'" not parsed correctly ?
Well, this will make 'HOSTCC=clang-20 CC=clang-20' a single argument no?
Try:
make 'HOSTCC=clang CC=clang'
Makefiledoesn't like it.If you're complaining about the need for duplicating --make-args, it's a choice I made when selecting the "append" action for that parameter, c.f.
https://docs.python.org/3/library/argparse.html#action.
Quoted 6 lines
We could use the "extend" action with nargs=* or +, but I personally hate those. It'd look like something like that:
--make-args HOSTCC=clang-20 CC=clang-20It requires you to be aware of the special "--" argument to stop parsing of command options and start parsing positional arguments.
I was wondering if there was a way to avoid multiple --make-args, yes. And I agree that switching to requiring -- to stop processing isn't an improvement, so this is fine. Thanks for explaining.
Signature · 1 line
Tom
Re: [PATCH RFC next 02/18] CI: pass clang HOSTCC and CC to pytest
In reply to Quentin SchulzHi Quentin,
Quoted 31 lines · Quentin Schulz
CI: pass clang HOSTCC and CC to pytest
test_env_initial_env_filetest calls make on the build directory passed with --build-dir parameter which points atUBOOT_TRAVIS_BUILD_DIRwhich is populated with buildman before pytest is run. For "sandbox with clangtest.py" and "sandbox64 with clangtest.py" jobs, buildman uses clang-20 toolchain, but pytest isn't configured to use that as well, resulting in gcc being used with a configuration made with clang-20 toolchain.Specify the HOSTCC and CC clang make arguments so pytest uses the proper toolchain, this will be required in a few commits when we'll upgrade to a newer version of
scripts/Makefile.extrawarnwhich gets rid of checking whether a clang flag exists (because it's supported by the min clang version the kernel advertises as being supported) which will be an issue since GCC for sure doesn't support all clang flags.Signed-off-by Quentin Schulz <[email protected]>.gitlab-ci.yml | 2 ++
1 file changed, 2 insertions(+).gitlab-ci.yml +1
-0@@ -288,6 +288,7 @@ sandbox with clang test.py: - ${HOST} variables: TEST_PY_BD: 'sandbox' + TEST_PY_EXTRA: "--make-args HOSTCC=clang-20 --make-args CC=clang-20" OVERRIDE: "-O clang-20" # addr2line in Ubuntu 'Noble' and later are broken. TEST_PY_TEST_SPEC: "not event_dump"
.gitlab-ci.yml sandbox64 with clang test.py: · line 318
Quoted 5 lines
.gitlab-ci.yml +1
-0@@ -313,6 +314,7 @@ sandbox64 with clang test.py: - ${HOST} variables: TEST_PY_BD: 'sandbox64' + TEST_PY_EXTRA: "--make-args HOSTCC=clang-20 --make-args CC=clang-20" OVERRIDE: "-O clang-20"
RFC PATCH 3/18 scripts/Makefile.extrawarn: migrate -Wvla to a U-Boot-specific file
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
In the next commits, we'll be synchronizing scripts/Makefile.extrawarn with the Linux kernel's at version 6.1 which is what we've been claiming we've synced to for a while but that isn't true.
In kernel commit 0bb95f80a38f ("Makefile: Globally enable VLA warning"), available in v4.20, -Wvla is now enabled tree-wide and not present in scripts/Makefile.extrawarn anymore. When we'll be syncing to v6.1, we'll therefore be losing this flag (since it's not in our root Makefile). We could backport the changes to the root Makefile to our root Makefile but U-Boot is not VLA-free unlike the kernel.
We have two options:
- backport the changes to the root Makefile and disable it in scripts/Makefile.extrawarn.u-boot,
- only enable it in scripts/Makefile.extrawarn.u-boot, with the same warn level as currently: 3,
For now, do the second option. We should probably go for the first option in the long term and try to synchronize our flags with the kernel's. Much bigger undertaking than desired right now.
--- Makefile | 1 + scripts/Makefile.extrawarn | 1 - scripts/Makefile.extrawarn.u-boot | 9 +++++++++ 3 files changed, 10 insertions(+), 1 deletion(-)
Makefile +1 -0
@@ -1025,6 +1025,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) include $(srctree)/scripts/Makefile.extrawarn +include $(srctree)/scripts/Makefile.extrawarn.u-boot # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments KBUILD_CPPFLAGS += $(KCPPFLAGS)
scripts/Makefile.extrawarn +0 -1
@@ -65,7 +65,6 @@ warning-3 += -Wpointer-arith warning-3 += -Wredundant-decls warning-3 += -Wswitch-default warning-3 += $(call cc-option, -Wpacked-bitfield-compat) -warning-3 += $(call cc-option, -Wvla) warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
scripts/Makefile.extrawarn.u-boot new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0 +# ========================================================================== +# +# Collection of warnings that are specific to U-Boot +# +# ========================================================================== +ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) +KBUILD_CFLAGS += $(call cc-option, -Wvla) +endif
Signature · 1 line
2.54.0
Re: [PATCH RFC next 03/18] scripts/Makefile.extrawarn: migrate -Wvla to a U-Boot-specific file
Hi Quentin,
Quoted 19 lines · Quentin Schulz
scripts/Makefile.extrawarn: migrate -Wvla to a U-Boot-specific fileIn the next commits, we'll be synchronizing
scripts/Makefile.extrawarnwith the Linux kernel's at version 6.1 which is what we've been claiming we've synced to for a while but that isn't true.In kernel commit
0bb95f80a38f("Makefile: Globally enable VLA warning"), available in v4.20, -Wvla is now enabled tree-wide and not present inscripts/Makefile.extrawarnanymore. When we'll be syncing to v6.1, we'll therefore be losing this flag (since it's not in our rootMakefile). We could backport the changes to the rootMakefileto our rootMakefilebut U-Boot is not VLA-free unlike the kernel.We have two options:
- backport the changes to the rootMakefileand disable it inscripts/Makefile.extrawarn.u-boot,
- only enable it inscripts/Makefile.extrawarn.u-boot, with the same warn level as currently: 3,
Quoted 7 lines
For now, do the second option. We should probably go for the first [...]
Makefile| 1 +scripts/Makefile.extrawarn | 1 - scripts/Makefile.extrawarn.u-boot | 9 +++++++++ 3 files changed, 10 insertions(+), 1 deletion(-)
Re: [PATCH RFC next 03/18] scripts/Makefile.extrawarn: migrate -Wvla to a U-Boot-specific file
In reply to Quentin SchulzQuoted 20 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
In the next commits, we'll be synchronizing
scripts/Makefile.extrawarnwith the Linux kernel's at version 6.1 which is what we've been claiming we've synced to for a while but that isn't true.In kernel commit
0bb95f80a38f("Makefile: Globally enable VLA warning"), available in v4.20, -Wvla is now enabled tree-wide and not present inscripts/Makefile.extrawarnanymore. When we'll be syncing to v6.1, we'll therefore be losing this flag (since it's not in our rootMakefile). We could backport the changes to the rootMakefileto our rootMakefilebut U-Boot is not VLA-free unlike the kernel.We have two options:
- backport the changes to the rootMakefileand disable it inscripts/Makefile.extrawarn.u-boot,
- only enable it inscripts/Makefile.extrawarn.u-boot, with the same warn level as currently: 3,
Quoted 6 lines
For now, do the second option. We should probably go for the first option in the long term and try to synchronize our flags with the kernel's. Much bigger undertaking than desired right now.
Signed-off-by Quentin Schulz <[email protected]>---
Quoted 48 lines
Makefile | 1 + scripts/Makefile.extrawarn | 1 - scripts/Makefile.extrawarn.u-boot | 9 +++++++++ 3 files changed, 10 insertions(+), 1 deletion(-)Makefile +1
-0@@ -1025,6 +1025,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) KBUILD_CFLAGS += $(call cc-option,-Werror=date-time) include $(srctree)/scripts/Makefile.extrawarn +include $(srctree)/scripts/Makefile.extrawarn.u-boot # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments KBUILD_CPPFLAGS += $(KCPPFLAGS)scripts/Makefile.extrawarn +0
-1@@ -65,7 +65,6 @@ warning-3 += -Wpointer-arith warning-3 += -Wredundant-decls warning-3 += -Wswitch-default warning-3 += $(call cc-option, -Wpacked-bitfield-compat) -warning-3 += $(call cc-option, -Wvla) warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))scripts/Makefile.extrawarn.u-boot new file +9
-1@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0 +# ========================================================================== +# +# Collection of warnings that are specific to U-Boot +# +# ========================================================================== +ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) +KBUILD_CFLAGS += $(call cc-option, -Wvla) +endif --2.54.0
RFC PATCH 4/18 kbuild: re-enable int-in-bool-context warning
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
[ Upstream commit a3bc88645e9293f5aaac9c05a185d9f1c0594c6c ]
Original commit log:
This warning was disabled by commit bd664f6b3e37 ("disable new gcc-7.1.1 warnings for now") just because it was too noisy.
Thanks to Arnd Bergmann, all warnings have been fixed. Now, we are ready to re-enable it.
--- Makefile | 1 - 1 file changed, 1 deletion(-)
Makefile +0 -1
@@ -897,7 +897,6 @@ KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) -KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ifdef CONFIG_CC_OPTIMIZE_FOR_DEBUG
Signature · 1 line
2.54.0
Re: [PATCH RFC next 04/18] kbuild: re-enable int-in-bool-context warning
Quoted 19 lines · Quentin Schulz
kbuild: re-enable int-in-bool-context warning
[ Upstream commit
a3bc88645e9293f5aaac9c05a185d9f1c0594c6c]Original commit log:
This warning was disabled by commit
bd664f6b3e37("disable new gcc-7.1.1 warnings for now") just because it was too noisy.Thanks to Arnd Bergmann, all warnings have been fixed. Now, we are ready to re-enable it.
Signed-off-by Quentin Schulz <[email protected]>
Makefile| 1 -1 file changed, 1 deletion(-)
Makefile KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) · line 900
Quoted 5 lines
Makefile +0
-1@@ -897,7 +897,6 @@ KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) -KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
Re: [PATCH RFC next 04/18] kbuild: re-enable int-in-bool-context warning
In reply to Quentin SchulzQuoted 7 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
[ Upstream commit
a3bc88645e9293f5aaac9c05a185d9f1c0594c6c]Original commit log:
Quoted 8 lines
This warning was disabled by commit
bd664f6b3e37("disable new gcc-7.1.1 warnings for now") just because it was too noisy.Thanks to Arnd Bergmann, all warnings have been fixed. Now, we are ready to re-enable it.
Signed-off-by Quentin Schulz <[email protected]>---
Quoted 19 lines
Makefile | 1 - 1 file changed, 1 deletion(-)Makefile +0
-2@@ -897,7 +897,6 @@ KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) -KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ifdef CONFIG_CC_OPTIMIZE_FOR_DEBUG --2.54.0
RFC PATCH 5/18 kbuild: Don't try to add '-fcatch-undefined-behavior' flag
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
[ Upstream commit 7eb8e5f073051eebbf55fa6b90ed2246c2274552 ]
Original commit log:
This is no longer a valid option in clang, it was removed in 3.5, which we don't support.
https://github.com/llvm/llvm-project/commit/cb3f812b6b9fab8f3b41414f24e90222170417b4
[git conflict in context due to commit 52ee1a0294e8 ("global: Disable
deprecated-non-prototype warning with clang")]
--- Makefile | 1 - 1 file changed, 1 deletion(-)
Makefile +0 -1
@@ -1007,7 +1007,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) -KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) else
Signature · 1 line
2.54.0
Re: [PATCH RFC next 05/18] kbuild: Don't try to add '-fcatch-undefined-behavior' flag
Quoted 9 lines · Quentin Schulz
kbuild: Don't try to add '-fcatch-undefined-behavior' flag
[ Upstream commit
7eb8e5f073051eebbf55fa6b90ed2246c2274552]Original commit log:
This is no longer a valid option in clang, it was removed in 3.5, which we don't support.
Quoted 8 lines
https://github.com/llvm/llvm-project/commit/cb3f812b6b9fab8f3b41414f24e90222170417b4
[git conflict in context due to commit
52ee1a0294e8("global: Disable
deprecated-non-prototype warning with clang")]Signed-off-by Quentin Schulz <[email protected]>
Makefile| 1 -1 file changed, 1 deletion(-)
Re: [PATCH RFC next 05/18] kbuild: Don't try to add '-fcatch-undefined-behavior' flag
In reply to Quentin SchulzQuoted 10 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
[ Upstream commit
7eb8e5f073051eebbf55fa6b90ed2246c2274552]Original commit log:
This is no longer a valid option in clang, it was removed in 3.5, which we don't support.
Quoted 6 lines
https://github.com/llvm/llvm-project/commit/cb3f812b6b9fab8f3b41414f24e90222170417b4
[git conflict in context due to commit
52ee1a0294e8("global: Disable
deprecated-non-prototype warning with clang")]Signed-off-by Quentin Schulz <[email protected]>---
Quoted 19 lines
Makefile | 1 - 1 file changed, 1 deletion(-)Makefile +0
-2@@ -1007,7 +1007,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) -KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) else --2.54.0
RFC PATCH 6/18 Makefile: move deprecated-non-prototype to scripts/Makefile.extrawarn.u-boot
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
This option is specific to U-Boot and was added back in commit 52ee1a0294e8 ("global: Disable deprecated-non-prototype warning with clang"). It was added next to other flags which are imported from the Linux kernel Makefile. This makes it unnecessarily hard to backport patches from that project since we'll always have a difference in the git context.
So, move this to the new scripts/Makefile.extrawarn.u-boot file where we can store everything that is U-Boot-specific and lower the efforts for syncing with the Linux kernel for Makefile.
--- Makefile | 1 - scripts/Makefile.extrawarn.u-boot | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
Makefile +0 -1
@@ -1007,7 +1007,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) -KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) else # These warnings generated too much noise in a regular build.
scripts/Makefile.extrawarn.u-boot +18 -0
@@ -7,3 +7,21 @@ ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) KBUILD_CFLAGS += $(call cc-option, -Wvla) endif + +ifdef CONFIG_CC_IS_CLANG +# We have a number of places in the code which use the following syntax: +# +# void func(a, b, c) +# int a; /* Does a */ +# something_t *b; /* Pointer to b */ +# int c; /* Does c */ +# { +# ... +# } +# +# Which while not what we document as our coding style, this is also code +# which we have imported from other projects, and would like to re-sync +# with in the future. While the biggest example of this is the zlib code, +# there are other places as well. For now, we will silence this warning. +KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) +endif
Signature · 1 line
2.54.0
Re: [PATCH RFC next 06/18] Makefile: move deprecated-non-prototype to scripts/Makefile.extrawarn.u-boot
Quoted 13 lines · Quentin Schulz
Makefile: move deprecated-non-prototype toscripts/Makefile.extrawarn.u-bootThis option is specific to U-Boot and was added back in commit
52ee1a0294e8("global: Disable deprecated-non-prototype warning with clang"). It was added next to other flags which are imported from the Linux kernelMakefile. This makes it unnecessarily hard to backport patches from that project since we'll always have a difference in the git context.So, move this to the new
scripts/Makefile.extrawarn.u-bootfile where we can store everything that is U-Boot-specific and lower the efforts for syncing with the Linux kernel forMakefile.
Quoted 5 lines
Signed-off-by Quentin Schulz <[email protected]>
Makefile| 1 -scripts/Makefile.extrawarn.u-boot | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
Re: [PATCH RFC next 06/18] Makefile: move deprecated-non-prototype to scripts/Makefile.extrawarn.u-boot
In reply to Quentin SchulzQuoted 10 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
This option is specific to U-Boot and was added back in commit
52ee1a0294e8("global: Disable deprecated-non-prototype warning with clang"). It was added next to other flags which are imported from the Linux kernelMakefile. This makes it unnecessarily hard to backport patches from that project since we'll always have a difference in the git context.
Quoted 6 lines
So, move this to the new
scripts/Makefile.extrawarn.u-bootfile where we can store everything that is U-Boot-specific and lower the efforts for syncing with the Linux kernel forMakefile.Signed-off-by Quentin Schulz <[email protected]>---
Quoted 46 lines
Makefile | 1 - scripts/Makefile.extrawarn.u-boot | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)Makefile +0
-1@@ -1007,7 +1007,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) -KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) else # These warnings generated too much noise in a regular build.scripts/Makefile.extrawarn.u-boot +18
-1@@ -7,3 +7,21 @@ ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) KBUILD_CFLAGS += $(call cc-option, -Wvla) endif + +ifdef CONFIG_CC_IS_CLANG +# We have a number of places in the code which use the following syntax: +# +# void func(a, b, c) +# int a; /* Does a */ +# something_t *b; /* Pointer to b */ +# int c; /* Does c */ +# { +# ... +# } +# +# Which while not what we document as our coding style, this is also code +# which we have imported from other projects, and would like to re-sync +# with in the future. While the biggest example of this is the zlib code, +# there are other places as well. For now, we will silence this warning. +KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) +endif --2.54.0
RFC PATCH 7/18 scripts/Makefile.extrawarn: handle CONFIG_WERROR in U-Boot-specific file
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
This is not something that is in Linux kernel in v5.1, nor in v6.1 which will be the next sync. Since the next sync will be importing scripts/Makefile.extrawarn directly instead of backporting individual patches, CONFIG_WERROR handling would be gone.
Move the CONFIG_WERROR handling to the U-Boot-specific file such that it doesn't get removed during the next sync.
--- scripts/Makefile.extrawarn | 3 --- scripts/Makefile.extrawarn.u-boot | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
scripts/Makefile.extrawarn +0 -3
@@ -22,9 +22,6 @@ endif export KBUILD_EXTRA_WARN -KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror -KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y) - ifeq ("$(origin W)", "command line") KBUILD_EXTRA_WARN := $(W) endif
scripts/Makefile.extrawarn.u-boot +3 -0
@@ -25,3 +25,6 @@ ifdef CONFIG_CC_IS_CLANG # there are other places as well. For now, we will silence this warning. KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) endif + +KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror +KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y)
Signature · 1 line
2.54.0
Re: [PATCH RFC next 07/18] scripts/Makefile.extrawarn: handle CONFIG_WERROR in U-Boot-specific file
Quoted 7 lines · Quentin Schulz
scripts/Makefile.extrawarn: handleCONFIG_WERRORin U-Boot-specific fileThis is not something that is in Linux kernel in v5.1, nor in v6.1 which will be the next sync. Since the next sync will be importing
scripts/Makefile.extrawarndirectly instead of backporting individual patches,CONFIG_WERRORhandling would be gone.
Quoted 8 lines
Move the
CONFIG_WERRORhandling to the U-Boot-specific file such that it doesn't get removed during the next sync.Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.extrawarn| 3 ---scripts/Makefile.extrawarn.u-boot | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
Re: [PATCH RFC next 07/18] scripts/Makefile.extrawarn: handle CONFIG_WERROR in U-Boot-specific file
In reply to Quentin SchulzQuoted 8 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
This is not something that is in Linux kernel in v5.1, nor in v6.1 which will be the next sync. Since the next sync will be importing
scripts/Makefile.extrawarndirectly instead of backporting individual patches,CONFIG_WERRORhandling would be gone.
Quoted 5 lines
Move the
CONFIG_WERRORhandling to the U-Boot-specific file such that it doesn't get removed during the next sync.Signed-off-by Quentin Schulz <[email protected]>---
Quoted 33 lines
scripts/Makefile.extrawarn | 3 --- scripts/Makefile.extrawarn.u-boot | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)scripts/Makefile.extrawarn +0
-3@@ -22,9 +22,6 @@ endif export KBUILD_EXTRA_WARN -KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror -KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y) - ifeq ("$(origin W)", "command line") KBUILD_EXTRA_WARN := $(W) endifscripts/Makefile.extrawarn.u-boot +3
-1@@ -25,3 +25,6 @@ ifdef CONFIG_CC_IS_CLANG # there are other places as well. For now, we will silence this warning. KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) endif + +KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror +KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y) --2.54.0
RFC PATCH 8/18 scripts/Makefile.extrawarn: sync with 6.1
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
Sync scripts/Makefile.extrawarn with Linux kernel 6.1's.
Since it adds a new option for KBUILD_EXTRA_WARN with e, document it as done in kernel commit c77d06e70d59 ("kbuild: support W=e to make build abort in case of warning").
s/gcc/build/ in Makefile as done in kernel commit e27128db6283 ("kbuild:
rename KBUILD_ENABLE_EXTRA_GCC_CHECKS to KBUILD_EXTRA_WARN"), part of v5.4. The rest of this commit was backported with commit bd3f9ee679b4 ("kbuild: Bump the build system to 6.1").
Our scripts/Makefile.extrawarn before this commit is Linux kernel's from v5.1 with the following diff:
# diff --git a/proc/self/fd/11 b/proc/self/fd/13
# --- a/proc/self/fd/11
# +++ b/proc/self/fd/13
# @@ -13,17 +13,8 @@
#
# KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
#
# -# backward compatibility
# -KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
# -
# ifeq ("$(origin W)", "command line")
# - KBUILD_EXTRA_WARN := $(W)
# -endif
# -
# -export KBUILD_EXTRA_WARN
# -
# -ifeq ("$(origin W)", "command line")
# - KBUILD_EXTRA_WARN := $(W)
# + export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
# endif
#
# ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKSThe KBUILD_EXTRA_WARN changes were made as part of commit bd3f9ee679b4 ("kbuild: Bump the build system to 6.1") and they are available in v5.4 via kernel commit e27128db6283 ("kbuild: rename KBUILD_ENABLE_EXTRA_GCC_CHECKS to KBUILD_EXTRA_WARN") so they are pulled in this sync. Additional changes made in other files are either ignored because the files or modified code parts don't exist. The change made to the Makefile is included in this commit here.
scripts/Makefile.extrawarn is now directly copied from Linux kernel at v6.1, no changes made.
--- Makefile | 3 +- scripts/Makefile.extrawarn | 152 +++++++++++++++++++++++++++------------------ 2 files changed, 94 insertions(+), 61 deletions(-)
Makefile +2 -1
@@ -2741,10 +2741,11 @@ help: @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' @echo ' make C=2 [targets] Force check of all c source with $$CHECK' @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections' - @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where' + @echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where' @echo ' 1: warnings which may be relevant and do not occur too often' @echo ' 2: warnings which occur quite often but may still be relevant' @echo ' 3: more obscure warnings, can most likely be ignored' + @echo ' e: warnings are being treated as errors' @echo ' Multiple levels can be combined with W=12 or W=123' @echo '' @echo 'Execute "make" or "make all" to build all targets marked with [*] '
scripts/Makefile.extrawarn +92 -60
170 lines not on this page · raw message
Signature · 1 line
2.54.0
Re: [PATCH RFC next 08/18] scripts/Makefile.extrawarn: sync with 6.1
Hi Quentin,
Quoted 28 lines · Quentin Schulz
scripts/Makefile.extrawarn: sync with 6.1Sync
scripts/Makefile.extrawarnwith Linux kernel 6.1's.Since it adds a new option for
KBUILD_EXTRA_WARNwith e, document it as done in kernel commitc77d06e70d59("kbuild: support W=e to make build abort in case of warning").s/gcc/build/ in
Makefileas done in kernel commite27128db6283("kbuild:
renameKBUILD_ENABLE_EXTRA_GCC_CHECKStoKBUILD_EXTRA_WARN"), part of v5.4. The rest of this commit was backported with commitbd3f9ee679b4("kbuild: Bump the build system to 6.1").Our
scripts/Makefile.extrawarnbefore this commit is Linux kernel's from v5.1 with the following diff:# diff --git a/proc/self/fd/11 b/proc/self/fd/13 # --- a/proc/self/fd/11 # +++ b/proc/self/fd/13 # @@ -13,17 +13,8 @@ [...]
Makefile| 3 +-scripts/Makefile.extrawarn | 154 +++++++++++++++++++++++++++------------------ 2 files changed, 95 insertions(+), 62 deletions(-)
scripts/Makefile.extrawarn endif · line 20
Quoted 10 lines
scripts/Makefile.extrawarn +3
-6@@ -22,64 +17,101 @@ endif ifdef CONFIG_CC_IS_CLANG -KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) -KBUILD_CFLAGS += $(call cc-disable-warning, format) -KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) -KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) -KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) +KBUILD_CFLAGS += -Wno-initializer-overrides +# Clang before clang-16 would warn on default argument promotions. +ifneq ($(call clang-min-version, 160000),y)
clang-min-version() is not defined anywhere that I can find. So I believe $(call clang-min-version, 160000) always expands to empty, the ifneq is always true and the inner ifeq always false.
scripts/Makefile.extrawarn endif · line 28
Quoted 9 lines
scripts/Makefile.extrawarn +0
-7@@ -22,64 +17,101 @@ endif -warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) - -ifeq ("$(strip $(warning))","") - $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) -endif
Dropping this silently accepts make W=q as a no-op. That matches v6.1 so I'm fine with it, but please note the behaviour change in the commit message so anyone bisecting a "my W=foo did nothing" report finds it.
Quoted 7 lines
scripts/Makefile.extrawarn +3
-2@@ -22,64 +17,101 @@ endif -warning-1 += $(call cc-disable-warning, missing-field-initializers) -warning-1 += $(call cc-disable-warning, sign-compare) +KBUILD_CFLAGS += -Wmissing-prototypes +KBUILD_CFLAGS += -Wold-style-definition +KBUILD_CFLAGS += -Wmissing-include-dirs
...
scripts/Makefile.extrawarn endif · line 39
Quoted 4 lines
scripts/Makefile.extrawarn +4
-0+KBUILD_CFLAGS += -Wno-missing-field-initializers +KBUILD_CFLAGS += -Wno-sign-compare +KBUILD_CFLAGS += -Wno-type-limits +KBUILD_CFLAGS += -Wno-shift-negative-value
Several flags previously wrapped in cc-option / cc-disable-warning are now passed unconditionally (-Wmissing-prototypes, -Wold-style-definition, -Wmissing-include-dirs, -Wno-type-limits, -Wno-shift-negative-value). That's the v6.1 behaviour, fair enough. What's the oldest gcc we support?
Regards,
Simon
Re: [PATCH RFC next 08/18] scripts/Makefile.extrawarn: sync with 6.1
Hi Simon,
Quoted 29 lines · Simon Glass
Hi Quentin,
Quoted 25 lines · Quentin Schulz
scripts/Makefile.extrawarn: sync with 6.1Sync
scripts/Makefile.extrawarnwith Linux kernel 6.1's.Since it adds a new option for
KBUILD_EXTRA_WARNwith e, document it as done in kernel commitc77d06e70d59("kbuild: support W=e to make build abort in case of warning").s/gcc/build/ in
Makefileas done in kernel commite27128db6283("kbuild:
renameKBUILD_ENABLE_EXTRA_GCC_CHECKStoKBUILD_EXTRA_WARN"), part of v5.4. The rest of this commit was backported with commitbd3f9ee679b4("kbuild: Bump the build system to 6.1").Our
scripts/Makefile.extrawarnbefore this commit is Linux kernel's from v5.1 with the following diff:# diff --git a/proc/self/fd/11 b/proc/self/fd/13 # --- a/proc/self/fd/11 # +++ b/proc/self/fd/13 # @@ -13,17 +13,8 @@ [...]
Makefile| 3 +-scripts/Makefile.extrawarn | 154 +++++++++++++++++++++++++++------------------ 2 files changed, 95 insertions(+), 62 deletions(-)
Quoted 17 lines
scripts/Makefile.extrawarn endif · line 20
Quoted 12 lines
scripts/Makefile.extrawarn +3
-6@@ -22,64 +17,101 @@ endif ifdef CONFIG_CC_IS_CLANG -KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) -KBUILD_CFLAGS += $(call cc-disable-warning, format) -KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) -KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) -KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) +KBUILD_CFLAGS += -Wno-initializer-overrides +# Clang before clang-16 would warn on default argument promotions. +ifneq ($(call clang-min-version, 160000),y)clang-min-version() is not defined anywhere that I can find. So I believe $(call clang-min-version, 160000) always expands to empty, the ifneq is always true and the inner ifeq always false.
Thanks for catching this. It seems scripts/Makefile.compiler is also not sync'ed with 6.1. We're missing kernel commit 88b61e3bff93 ("Makefile.compiler: replace cc-ifversion with compiler-specific macros"). I'll add that to the v2.
Quoted 6 lines
Quoted 6 lines
scripts/Makefile.extrawarn +0
-4@@ -22,64 +17,101 @@ endif -warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -
Quoted 9 lines
scripts/Makefile.extrawarn endif · line 72
Quoted 3 lines
scripts/Makefile.extrawarn +0
-3-ifeq ("$(strip $(warning))","") - $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) -endifDropping this silently accepts make W=q as a no-op. That matches v6.1 so I'm fine with it, but please note the behaviour change in the commit message so anyone bisecting a "my W=foo did nothing" report finds it.
ACK. This was told in kernel commit 64a91907c896 ("kbuild: refactor scripts/Makefile.extrawarn"):
This commit slightly changes the behavior, I think all of which are OK.
[1] Currently, cc-option calls are needlessly evaluated. For example, warning-3 += $(call cc-option, -Wpacked-bitfield-compat) needs evaluating only when W=3, but it is actually evaluated for W=1, W=2 as well. With this commit, only relevant cc-option calls will be evaluated. This is a slight optimization.
[2] Currently, unsupported level like W=4 is checked by:
$(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
This will no longer be checked, but I do not think it is a big deal.
[3] Currently, 4 Clang warnings (Winitializer-overrides, Wformat, Wsign-compare, Wformat-zero-length) are shown by any of W=1, W=2, and W=3. With this commit, they will be warned only by W=1. I think this is a more correct behavior since each warning belongs to only one group.
Quoted 18 lines
Quoted 7 lines
scripts/Makefile.extrawarn +3
-2@@ -22,64 +17,101 @@ endif -warning-1 += $(call cc-disable-warning, missing-field-initializers) -warning-1 += $(call cc-disable-warning, sign-compare) +KBUILD_CFLAGS += -Wmissing-prototypes +KBUILD_CFLAGS += -Wold-style-definition +KBUILD_CFLAGS += -Wmissing-include-dirs...
scripts/Makefile.extrawarn endif · line 39
Quoted 4 lines
scripts/Makefile.extrawarn +4
-0+KBUILD_CFLAGS += -Wno-missing-field-initializers +KBUILD_CFLAGS += -Wno-sign-compare +KBUILD_CFLAGS += -Wno-type-limits +KBUILD_CFLAGS += -Wno-shift-negative-valueSeveral flags previously wrapped in cc-option / cc-disable-warning are now passed unconditionally (-Wmissing-prototypes,
(quoted diff) +0
-2-Wold-style-definition, -Wmissing-include-dirs, -Wno-type-limits, -Wno-shift-negative-value). That's the v6.1 behaviour, fair enough.
Quoted 2 lines
What's the oldest gcc we support?
Pfew... That I don't know. We have an explicit check for GCC10 on ARM since commit bb1c2b463265 ("update GCC version check after Kbuild bump"). We have GCC4 min for PPC in arch/powerpc/config.mk with checkgcc4 target.
mbedtls specifies they test against GCC 5.4, c.f. https://github.com/Mbed-TLS/mbedtls#tool-versions. Some parts in lib/mbedtls/external/mbedtls/library/aesce.c and lib/mbedtls/external/mbedtls/library/sha256.c require GCC6. lib/mbedtls/external/mbedtls/library/sha512.c requires GCC8.
lwip's CI tests on ubuntu-latest GitHub runner, c.f. https://github.com/lwip-tcpip/lwip/blob/master/.github/workflows/ci-linux.yml#L9-L17. I don't know which version we've been using but it was merged for 2025.01 and at that time ubuntu-latest GitHub worker was Ubuntu 22.04. I believe GCC10 was the version by default, though 9 to 12 are available in the Universe package feed.
microMIPS requires GCC>=4.9, c.f. check in arch/mips/include/asm/compiler.h.
include/linux/compiler-gcc.h requires GCC>=4.6.
For the rest, I don't know. Maybe Tom does?
The Linux kernel states in Documentation/process/changes.rst that the minimum GCC is 5.1 though "The gcc version requirements may vary depending on the type of CPU in your computer." (and I'm assuming "in your computer" applies to the target device, not the host machine).
Cheers,
Quentin
Re: [PATCH RFC next 08/18] scripts/Makefile.extrawarn: sync with 6.1
Quoted 130 lines · Quentin Schulz
Hi Simon,
Quoted 29 lines · Simon Glass
Hi Quentin,
Quoted 25 lines · Quentin Schulz
scripts/Makefile.extrawarn: sync with 6.1Sync
scripts/Makefile.extrawarnwith Linux kernel 6.1's.Since it adds a new option for
KBUILD_EXTRA_WARNwith e, document it as done in kernel commitc77d06e70d59("kbuild: support W=e to make build abort in case of warning").s/gcc/build/ in
Makefileas done in kernel commite27128db6283("kbuild:
renameKBUILD_ENABLE_EXTRA_GCC_CHECKStoKBUILD_EXTRA_WARN"), part of v5.4. The rest of this commit was backported with commitbd3f9ee679b4("kbuild: Bump the build system to 6.1").Our
scripts/Makefile.extrawarnbefore this commit is Linux kernel's from v5.1 with the following diff:# diff --git a/proc/self/fd/11 b/proc/self/fd/13 # --- a/proc/self/fd/11 # +++ b/proc/self/fd/13 # @@ -13,17 +13,8 @@ [...]
Makefile| 3 +-scripts/Makefile.extrawarn | 154 +++++++++++++++++++++++++++------------------ 2 files changed, 95 insertions(+), 62 deletions(-)Quoted 17 lines
scripts/Makefile.extrawarn endif · line 20
Quoted 12 lines
scripts/Makefile.extrawarn +3
-6@@ -22,64 +17,101 @@ endif ifdef CONFIG_CC_IS_CLANG -KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) -KBUILD_CFLAGS += $(call cc-disable-warning, format) -KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) -KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) -KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) +KBUILD_CFLAGS += -Wno-initializer-overrides +# Clang before clang-16 would warn on default argument promotions. +ifneq ($(call clang-min-version, 160000),y)clang-min-version() is not defined anywhere that I can find. So I believe $(call clang-min-version, 160000) always expands to empty, the ifneq is always true and the inner ifeq always false.
Thanks for catching this. It seems
scripts/Makefile.compileris also not sync'ed with 6.1. We're missing kernel commit88b61e3bff93("Makefile.compiler: replace cc-ifversion with compiler-specific macros"). I'll add that to the v2.Quoted 6 lines
Quoted 6 lines
scripts/Makefile.extrawarn +0
-4@@ -22,64 +17,101 @@ endif -warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -Quoted 9 lines
scripts/Makefile.extrawarn endif · line 72
Quoted 3 lines
scripts/Makefile.extrawarn +0
-3-ifeq ("$(strip $(warning))","") - $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) -endifDropping this silently accepts make W=q as a no-op. That matches v6.1 so I'm fine with it, but please note the behaviour change in the commit message so anyone bisecting a "my W=foo did nothing" report finds it.
ACK. This was told in kernel commit
64a91907c896("kbuild: refactorscripts/Makefile.extrawarn"):This commit slightly changes the behavior, I think all of which are OK.
[1] Currently, cc-option calls are needlessly evaluated. For example, warning-3 += $(call cc-option, -Wpacked-bitfield-compat) needs evaluating only when W=3, but it is actually evaluated for W=1, W=2 as well. With this commit, only relevant cc-option calls will be evaluated. This is a slight optimization.
[2] Currently, unsupported level like W=4 is checked by:
$(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
This will no longer be checked, but I do not think it is a big deal.[3] Currently, 4 Clang warnings (Winitializer-overrides, Wformat, Wsign-compare, Wformat-zero-length) are shown by any of W=1, W=2, and W=3. With this commit, they will be warned only by W=1. I think this is a more correct behavior since each warning belongs to only one group.
Quoted 18 lines
Quoted 7 lines
scripts/Makefile.extrawarn +3
-2@@ -22,64 +17,101 @@ endif -warning-1 += $(call cc-disable-warning, missing-field-initializers) -warning-1 += $(call cc-disable-warning, sign-compare) +KBUILD_CFLAGS += -Wmissing-prototypes +KBUILD_CFLAGS += -Wold-style-definition +KBUILD_CFLAGS += -Wmissing-include-dirs...
scripts/Makefile.extrawarn endif · line 39
Quoted 4 lines
scripts/Makefile.extrawarn +4
-0+KBUILD_CFLAGS += -Wno-missing-field-initializers +KBUILD_CFLAGS += -Wno-sign-compare +KBUILD_CFLAGS += -Wno-type-limits +KBUILD_CFLAGS += -Wno-shift-negative-valueSeveral flags previously wrapped in cc-option / cc-disable-warning are now passed unconditionally (-Wmissing-prototypes,
(quoted diff) +0
-2-Wold-style-definition, -Wmissing-include-dirs, -Wno-type-limits, -Wno-shift-negative-value). That's the v6.1 behaviour, fair enough.Quoted 2 lines
What's the oldest gcc we support?
Pfew... That I don't know. We have an explicit check for GCC10 on ARM since commit
bb1c2b463265("update GCC version check afterKbuildbump"). We have GCC4 min for PPC inarch/powerpc/config.mkwith checkgcc4 target.mbedtls specifies they test against GCC 5.4, c.f.
https://github.com/Mbed-TLS/mbedtls#tool-versions. Some parts inlib/mbedtls/external/mbedtls/library/aesce.candlib/mbedtls/external/mbedtls/library/sha256.crequire GCC6.lib/mbedtls/external/mbedtls/library/sha512.crequires GCC8.lwip's CI tests on ubuntu-latest GitHub runner, c.f. https://github.com/lwip-tcpip/lwip/blob/master/.github/workflows/ci-linux.yml#L9-L17.
I don't know which version we've been using but it was merged for 2025.01
and at that time ubuntu-latest GitHub worker was Ubuntu 22.04. I believe
GCC10 was the version by default, though 9 to 12 are available in the
Universe package feed.
Quoted 5 lines
microMIPS requires GCC>=4.9, c.f. check in
arch/mips/include/asm/compiler.h.
include/linux/compiler-gcc.hrequires GCC>=4.6.For the rest, I don't know. Maybe Tom does?
Absolute minimums are driven by other failures (for example, the bug we hit that pushed arm to gcc 10). GCC 10 is over 5 years old, so saying that's a global minimum is fine with me. And I've said before I'd be open to a global check.
Quoted 4 lines
The Linux kernel states in
Documentation/process/changes.rstthat the minimum GCC is 5.1 though "The gcc version requirements may vary depending on the type of CPU in your computer." (and I'm assuming "in your computer" applies to the target device, not the host machine).
I do wonder, idly, what platforms in the current kernel can build a functional kernel with 5.1 :)
Signature · 1 line
Tom
RFC PATCH 9/18 kbuild: support W=c and W=e shorthands for Kconfig
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
[ Upstream commit c77d06e70d59cbc6e3c22bf644bb0b197a5fc182 ]
Original commit log:
KCONFIG_WARN_UNKNOWN_SYMBOLS=1 and KCONFIG_WERROR=1 are descriptive and suitable in scripting, but typing them from the command line can be tedious.
Associate them with KBUILD_EXTRA_WARN (and the W= shorthand).
Support a new letter 'c' to enable extra checks in Kconfig. You can still manage compiler warnings (W=1) and Kconfig warnings (W=c) independently.
Reuse the letter 'e' to turn Kconfig warnings into errors.
As usual, you can combine multiple letters in KCONFIG_EXTRA_WARN.
$ KCONFIG_WARN_UNKNOWN_SYMBOLS=1 KCONFIG_WERROR=1 make defconfig
can be shortened to:
$ KBUILD_EXTRA_WARN=ce make defconfig
or, even shorter:
$ make W=ce defconfig
[note that U-Boot currently doesn't make use of the KCONFIG_WERROR or
KCONFIG_WARN_UNKNOWN_SYMBOLS symbols as we're using an ancient version of kconfig, so technically W=c won't do anything.]
--- Makefile | 10 ++++++++++ scripts/Makefile.extrawarn | 9 --------- scripts/kconfig/Makefile | 8 ++++++++ 3 files changed, 18 insertions(+), 9 deletions(-)
Makefile +10 -0
@@ -105,6 +105,15 @@ endif export quiet Q KBUILD_VERBOSE +# backward compatibility +KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS) + +ifeq ("$(origin W)", "command line") + KBUILD_EXTRA_WARN := $(W) +endif + +export KBUILD_EXTRA_WARN + # Kbuild will save output files in the current working directory. # This does not need to match to the root of the kernel source tree. #
@@ -2745,6 +2754,7 @@ help: @echo ' 1: warnings which may be relevant and do not occur too often' @echo ' 2: warnings which occur quite often but may still be relevant' @echo ' 3: more obscure warnings, can most likely be ignored' + @echo ' c: extra checks in the configuration stage (Kconfig)' @echo ' e: warnings are being treated as errors' @echo ' Multiple levels can be combined with W=12 or W=123' @echo ''
scripts/Makefile.extrawarn +0 -9
@@ -8,15 +8,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) -# backward compatibility -KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS) - -ifeq ("$(origin W)", "command line") - KBUILD_EXTRA_WARN := $(W) -endif - -export KBUILD_EXTRA_WARN - # # W=1 - warnings which may be relevant and do not occur too often #
scripts/kconfig/Makefile +8 -0
@@ -22,6 +22,14 @@ ifeq ($(quiet),silent_) silent := -s endif +ifneq ($(findstring c, $(KBUILD_EXTRA_WARN)),) +export KCONFIG_WARN_UNKNOWN_SYMBOLS=1 +endif + +ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),) +export KCONFIG_WERROR=1 +endif + # We need this, in case the user has it in its environment unexport CONFIG_
Signature · 1 line
2.54.0
Re: [PATCH RFC next 09/18] kbuild: support W=c and W=e shorthands for Kconfig
Quoted 33 lines · Quentin Schulz
kbuild: support W=c and W=e shorthands for
Kconfig[ Upstream commit
c77d06e70d59cbc6e3c22bf644bb0b197a5fc182]Original commit log:
KCONFIG_WARN_UNKNOWN_SYMBOLS=1 and KCONFIG_WERROR=1 are descriptive and suitable in scripting, but typing them from the command line can be tedious.
Associate them with
KBUILD_EXTRA_WARN(and the W= shorthand).Support a new letter 'c' to enable extra checks in
Kconfig. You can still manage compiler warnings (W=1) andKconfigwarnings (W=c) independently.Reuse the letter 'e' to turn
Kconfigwarnings into errors.As usual, you can combine multiple letters in
KCONFIG_EXTRA_WARN.$ KCONFIG_WARN_UNKNOWN_SYMBOLS=1 KCONFIG_WERROR=1 make defconfigcan be shortened to:
$ KBUILD_EXTRA_WARN=ce make defconfigor, even shorter:
$ make W=ce defconfig[note that U-Boot currently doesn't make use of the
KCONFIG_WERRORor
KCONFIG_WARN_UNKNOWN_SYMBOLSsymbols as we're using an ancient version of kconfig, so technically W=c won't do anything.]
Quoted 6 lines
Signed-off-by Quentin Schulz <[email protected]>
Makefile| 10 ++++++++++scripts/Makefile.extrawarn | 9 --------- scripts/kconfig/Makefile | 8 ++++++++ 3 files changed, 18 insertions(+), 9 deletions(-)
Re: [PATCH RFC next 09/18] kbuild: support W=c and W=e shorthands for Kconfig
In reply to Quentin SchulzQuoted 29 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
[ Upstream commit
c77d06e70d59cbc6e3c22bf644bb0b197a5fc182]Original commit log:
KCONFIG_WARN_UNKNOWN_SYMBOLS=1 and KCONFIG_WERROR=1 are descriptive and suitable in scripting, but typing them from the command line can be tedious.
Associate them with
KBUILD_EXTRA_WARN(and the W= shorthand).Support a new letter 'c' to enable extra checks in
Kconfig. You can still manage compiler warnings (W=1) andKconfigwarnings (W=c) independently.Reuse the letter 'e' to turn
Kconfigwarnings into errors.As usual, you can combine multiple letters in
KCONFIG_EXTRA_WARN.$ KCONFIG_WARN_UNKNOWN_SYMBOLS=1 KCONFIG_WERROR=1 make defconfigcan be shortened to:
$ KBUILD_EXTRA_WARN=ce make defconfigor, even shorter:
Quoted 7 lines
$ make W=ce defconfig[note that U-Boot currently doesn't make use of the
KCONFIG_WERRORor
KCONFIG_WARN_UNKNOWN_SYMBOLSsymbols as we're using an ancient version of kconfig, so technically W=c won't do anything.]Signed-off-by Quentin Schulz <[email protected]>---
Quoted 76 lines
Makefile | 10 ++++++++++ scripts/Makefile.extrawarn | 9 --------- scripts/kconfig/Makefile | 8 ++++++++ 3 files changed, 18 insertions(+), 9 deletions(-)Makefile +10
-0@@ -105,6 +105,15 @@ endif export quiet Q KBUILD_VERBOSE +# backward compatibility +KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS) + +ifeq ("$(origin W)", "command line") + KBUILD_EXTRA_WARN := $(W) +endif + +export KBUILD_EXTRA_WARN + # Kbuild will save output files in the current working directory. # This does not need to match to the root of the kernel source tree. #@@ -2745,6 +2754,7 @@ help: @echo ' 1: warnings which may be relevant and do not occur too often' @echo ' 2: warnings which occur quite often but may still be relevant' @echo ' 3: more obscure warnings, can most likely be ignored' + @echo ' c: extra checks in the configuration stage (Kconfig)' @echo ' e: warnings are being treated as errors' @echo ' Multiple levels can be combined with W=12 or W=123' @echo ''scripts/Makefile.extrawarn +0
-9@@ -8,15 +8,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) -# backward compatibility -KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS) - -ifeq ("$(origin W)", "command line") - KBUILD_EXTRA_WARN := $(W) -endif - -export KBUILD_EXTRA_WARN - # # W=1 - warnings which may be relevant and do not occur too often #scripts/kconfig/Makefile +8
-1@@ -22,6 +22,14 @@ ifeq ($(quiet),silent_) silent := -s endif +ifneq ($(findstring c, $(KBUILD_EXTRA_WARN)),) +export KCONFIG_WARN_UNKNOWN_SYMBOLS=1 +endif + +ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),) +export KCONFIG_WERROR=1 +endif + # We need this, in case the user has it in its environment unexport CONFIG_ --2.54.0
RFC PATCH 10/18 kbuild: align W=e with CONFIG_WERROR
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
[ Upstream commit f852ce052a8b78d6fade371bd1fad583541e78fa ]
Original commit log:
CONFIG_WERROR sets KBUILD_CPPFLAGS while W=e would only set KBUILD_CFLAGS.
As a preparation to unify the two mechanism, align their effects.
While at it, add some alignment whitespace to prepare for later additions to the list of changed variables.
--- scripts/Makefile.extrawarn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.extrawarn +1 -1
@@ -103,6 +103,6 @@ endif # ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),) -KBUILD_CFLAGS += -Werror +KBUILD_CPPFLAGS += -Werror endif
Signature · 1 line
2.54.0
Re: [PATCH RFC next 10/18] kbuild: align W=e with CONFIG_WERROR
Quoted 10 lines · Quentin Schulz
kbuild: align W=e with
CONFIG_WERROR[ Upstream commit
f852ce052a8b78d6fade371bd1fad583541e78fa]Original commit log:
CONFIG_WERRORsetsKBUILD_CPPFLAGSwhile W=e would only setKBUILD_CFLAGS.As a preparation to unify the two mechanism, align their effects.
Quoted 7 lines
While at it, add some alignment whitespace to prepare for later additions to the list of changed variables.
Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.extrawarn| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH RFC next 10/18] kbuild: align W=e with CONFIG_WERROR
In reply to Quentin SchulzQuoted 9 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
[ Upstream commit
f852ce052a8b78d6fade371bd1fad583541e78fa]Original commit log:
CONFIG_WERRORsetsKBUILD_CPPFLAGSwhile W=e would only setKBUILD_CFLAGS.
Quoted 7 lines
As a preparation to unify the two mechanism, align their effects.
While at it, add some alignment whitespace to prepare for later additions to the list of changed variables.
Signed-off-by Quentin Schulz <[email protected]>---
Quoted 19 lines
scripts/Makefile.extrawarn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/Makefile.extrawarn +1
-2@@ -103,6 +103,6 @@ endif # ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),) -KBUILD_CFLAGS += -Werror +KBUILD_CPPFLAGS += -Werror endif --2.54.0
RFC PATCH 11/18 kbuild: unify W=e and CONFIG_WERROR
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
[ Upstream commit e7a10929c574cf30981a8e19ef39bc35e63e8b46 ]
Original commit log:
The two mechanisms have the same effect, unify their implementation.
Also avoid spurious rebuilds when switching between the two.
[git conflict trying to remove the KBUILD_CPPFLAGS for CONFIG_WERROR,
because U-Boot didn't have it before, due to missing backport for e88ca24319e4 ("kbuild: consolidate warning flags in scripts/Makefile.extrawarn") which we won't backport for now due to too many conflicts]
--- scripts/Makefile.extrawarn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.extrawarn +2 -2
@@ -99,9 +99,9 @@ KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3 endif # -# W=e - error out on warnings +# W=e and CONFIG_WERROR - error out on warnings # -ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),) +ifneq ($(findstring e, $(KBUILD_EXTRA_WARN))$(CONFIG_WERROR),) KBUILD_CPPFLAGS += -Werror
Signature · 1 line
2.54.0
Re: [PATCH RFC next 11/18] kbuild: unify W=e and CONFIG_WERROR
Quoted 15 lines · Quentin Schulz
kbuild: unify W=e and
CONFIG_WERROR[ Upstream commit
e7a10929c574cf30981a8e19ef39bc35e63e8b46]Original commit log:
The two mechanisms have the same effect, unify their implementation.
Also avoid spurious rebuilds when switching between the two.
[git conflict trying to remove the
KBUILD_CPPFLAGSforCONFIG_WERROR,
because U-Boot didn't have it before, due to missing backport fore88ca24319e4("kbuild: consolidate warning flags inscripts/Makefile.extrawarn") which we won't backport for now due to too many conflicts]
Quoted 4 lines
Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.extrawarn| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)
Re: [PATCH RFC next 11/18] kbuild: unify W=e and CONFIG_WERROR
In reply to Quentin SchulzQuoted 11 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
[ Upstream commit
e7a10929c574cf30981a8e19ef39bc35e63e8b46]Original commit log:
The two mechanisms have the same effect, unify their implementation.
Also avoid spurious rebuilds when switching between the two.
Quoted 7 lines
[git conflict trying to remove the
KBUILD_CPPFLAGSforCONFIG_WERROR,
because U-Boot didn't have it before, due to missing backport fore88ca24319e4("kbuild: consolidate warning flags inscripts/Makefile.extrawarn") which we won't backport for now due to too many conflicts]Signed-off-by Quentin Schulz <[email protected]>---
Quoted 23 lines
scripts/Makefile.extrawarn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)scripts/Makefile.extrawarn +2
-3@@ -99,9 +99,9 @@ KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3 endif # -# W=e - error out on warnings +# W=e and CONFIG_WERROR - error out on warnings # -ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),) +ifneq ($(findstring e, $(KBUILD_EXTRA_WARN))$(CONFIG_WERROR),) KBUILD_CPPFLAGS += -Werror --2.54.0
RFC PATCH 12/18 scripts/Makefile.extrawarn.u-boot: remove redundant Werror handling
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
In the previous commit, scripts/Makefile.extrawarn from the Linux kernel gained support for adding -Werror to KBUILD_CPPFLAGS when CONFIG_WERROR is enabled, therefore this is now redundant and can be removed.
--- scripts/Makefile.extrawarn.u-boot | 3 --- 1 file changed, 3 deletions(-)
scripts/Makefile.extrawarn.u-boot +0 -3
@@ -25,6 +25,3 @@ ifdef CONFIG_CC_IS_CLANG # there are other places as well. For now, we will silence this warning. KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) endif - -KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror -KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y)
Signature · 1 line
2.54.0
Re: [PATCH RFC next 12/18] scripts/Makefile.extrawarn.u-boot: remove redundant Werror handling
Quoted 10 lines · Quentin Schulz
scripts/Makefile.extrawarn.u-boot: remove redundant Werror handlingIn the previous commit,
scripts/Makefile.extrawarnfrom the Linux kernel gained support for adding -Werror toKBUILD_CPPFLAGSwhenCONFIG_WERRORis enabled, therefore this is now redundant and can be removed.Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.extrawarn.u-boot| 3 ---1 file changed, 3 deletions(-)
Re: [PATCH RFC next 12/18] scripts/Makefile.extrawarn.u-boot: remove redundant Werror handling
In reply to Quentin SchulzQuoted 9 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
In the previous commit,
scripts/Makefile.extrawarnfrom the Linux kernel gained support for adding -Werror toKBUILD_CPPFLAGSwhenCONFIG_WERRORis enabled, therefore this is now redundant and can be removed.Signed-off-by Quentin Schulz <[email protected]>---
Quoted 18 lines
scripts/Makefile.extrawarn.u-boot | 3 --- 1 file changed, 3 deletions(-)scripts/Makefile.extrawarn.u-boot +0
-4@@ -25,6 +25,3 @@ ifdef CONFIG_CC_IS_CLANG # there are other places as well. For now, we will silence this warning. KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) endif - -KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror -KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y) --2.54.0
RFC PATCH 13/18 kbuild: rust: move `-Dwarnings` handling to `Makefile.extrawarn`
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
[ Upstream commit 592b571f20c5b905c47a1370210456f9f90ce04f ]
Original commit log:
Following commit e88ca24319e4 ("kbuild: consolidate warning flags in scripts/Makefile.extrawarn"), move -Dwarnings handling into Makefile.extrawarn like C's -Werror.
No functional change intended.
[git conflict trying to remove KBUILD_RUSTFLAGS from Makefile, which we
don't have in U-Boot]
[U-Boot doesn't build anything Rust so this is useless except for the
fact it allows to backport patches from Linux kernel easier]
--- scripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+)
scripts/Makefile.extrawarn +1 -0
@@ -104,5 +104,6 @@ endif ifneq ($(findstring e, $(KBUILD_EXTRA_WARN))$(CONFIG_WERROR),) KBUILD_CPPFLAGS += -Werror +KBUILD_RUSTFLAGS += -Dwarnings endif
Signature · 1 line
2.54.0
Re: [PATCH RFC next 13/18] kbuild: rust: move `-Dwarnings` handling to `Makefile.extrawarn`
Quoted 12 lines · Quentin Schulz
kbuild: rust: move -Dwarnings handling to Makefile.extrawarn
[ Upstream commit
592b571f20c5b905c47a1370210456f9f90ce04f]Original commit log:
Following commit
e88ca24319e4("kbuild: consolidate warning flags inscripts/Makefile.extrawarn"), move -Dwarnings handling into Makefile.extrawarn like C's -Werror.No functional change intended.
Quoted 8 lines
[git conflict trying to remove
KBUILD_RUSTFLAGSfromMakefile, which we
don't have in U-Boot]
[U-Boot doesn't build anything Rust so this is useless except for the
fact it allows to backport patches from Linux kernel easier]Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.extrawarn| 1 +1 file changed, 1 insertion(+)
Re: [PATCH RFC next 13/18] kbuild: rust: move `-Dwarnings` handling to `Makefile.extrawarn`
In reply to Quentin SchulzQuoted 11 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
[ Upstream commit
592b571f20c5b905c47a1370210456f9f90ce04f]Original commit log:
Following commit
e88ca24319e4("kbuild: consolidate warning flags inscripts/Makefile.extrawarn"), move-Dwarningshandling intoMakefile.extrawarnlike C's-Werror.
Quoted 8 lines
No functional change intended.
[git conflict trying to remove
KBUILD_RUSTFLAGSfromMakefile, which we
don't have in U-Boot]
[U-Boot doesn't build anything Rust so this is useless except for the
fact it allows to backport patches from Linux kernel easier]Signed-off-by Quentin Schulz <[email protected]>---
Quoted 18 lines
scripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+)scripts/Makefile.extrawarn +1
-1@@ -104,5 +104,6 @@ endif ifneq ($(findstring e, $(KBUILD_EXTRA_WARN))$(CONFIG_WERROR),) KBUILD_CPPFLAGS += -Werror +KBUILD_RUSTFLAGS += -Dwarnings endif --2.54.0
RFC PATCH 14/18 kbuild: respect CONFIG_WERROR for linker and assembler
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
[ Upstream commit ec4a3992bc0b5b659eceb44a9f8582b26f2c8489 ]
Original commit log:
The linker and assembler do not share the compiler flags.
Make sure they also fail on warnings with CONFIG_WERROR and W=e.
--- scripts/Makefile.extrawarn | 2 ++ 1 file changed, 2 insertions(+)
scripts/Makefile.extrawarn +2 -0
@@ -104,6 +104,8 @@ endif ifneq ($(findstring e, $(KBUILD_EXTRA_WARN))$(CONFIG_WERROR),) KBUILD_CPPFLAGS += -Werror +KBUILD_AFLAGS += -Wa,--fatal-warnings +KBUILD_LDFLAGS += --fatal-warnings KBUILD_RUSTFLAGS += -Dwarnings endif
Signature · 1 line
2.54.0
Re: [PATCH RFC next 14/18] kbuild: respect CONFIG_WERROR for linker and assembler
Quoted 6 lines · Quentin Schulz
kbuild: respect
CONFIG_WERRORfor linker and assembler[ Upstream commit
ec4a3992bc0b5b659eceb44a9f8582b26f2c8489]Original commit log:
Quoted 8 lines
The linker and assembler do not share the compiler flags.
Make sure they also fail on warnings with
CONFIG_WERRORand W=e.Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.extrawarn| 2 ++1 file changed, 2 insertions(+)
Re: [PATCH RFC next 14/18] kbuild: respect CONFIG_WERROR for linker and assembler
In reply to Quentin SchulzQuoted 5 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
[ Upstream commit
ec4a3992bc0b5b659eceb44a9f8582b26f2c8489]
Quoted 8 lines
Original commit log:
The linker and assembler do not share the compiler flags.
Make sure they also fail on warnings with
CONFIG_WERRORand W=e.Signed-off-by Quentin Schulz <[email protected]>---
Quoted 20 lines
scripts/Makefile.extrawarn | 2 ++ 1 file changed, 2 insertions(+)scripts/Makefile.extrawarn +2
-1@@ -104,6 +104,8 @@ endif ifneq ($(findstring e, $(KBUILD_EXTRA_WARN))$(CONFIG_WERROR),) KBUILD_CPPFLAGS += -Werror +KBUILD_AFLAGS += -Wa,--fatal-warnings +KBUILD_LDFLAGS += --fatal-warnings KBUILD_RUSTFLAGS += -Dwarnings endif --2.54.0
RFC PATCH 15/18 kbuild: enable -Werror for hostprogs
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
[ Upstream commit 27758d8c2583d10472b745a43ff86fef96c11ef7 ]
Original commit log:
The hostprog compilers and linkers do not share the regular compiler flags, so they are not affected by CONFIG_WERROR or W=e. As hostprogs are used during the bootstrap of the build, they can't depend on kconfig options.
Enable -Werror unconditionally.
--- scripts/Makefile.extrawarn | 5 +++++ 1 file changed, 5 insertions(+)
scripts/Makefile.extrawarn +5 -0
@@ -109,3 +109,8 @@ KBUILD_LDFLAGS += --fatal-warnings KBUILD_RUSTFLAGS += -Dwarnings endif + +# Hostprog flags are used during build bootstrapping and can not rely on CONFIG_ symbols. +KBUILD_HOSTCFLAGS += -Werror +KBUILD_HOSTLDFLAGS += -Wl,--fatal-warnings +KBUILD_HOSTRUSTFLAGS += -Dwarnings
Signature · 1 line
2.54.0
Re: [PATCH RFC next 15/18] kbuild: enable -Werror for hostprogs
Hi Quentin,
Quoted 19 lines · Quentin Schulz
kbuild: enable -Werror for hostprogs
[ Upstream commit
27758d8c2583d10472b745a43ff86fef96c11ef7]Original commit log:
The hostprog compilers and linkers do not share the regular compiler flags, so they are not affected by
CONFIG_WERRORor W=e. As hostprogs are used during the bootstrap of the build, they can't depend on kconfig options.Enable -Werror unconditionally.
Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.extrawarn| 5 +++++1 file changed, 5 insertions(+)
scripts/Makefile.extrawarn KBUILD_LDFLAGS += --fatal-warnings · line 116
Quoted 8 lines
scripts/Makefile.extrawarn +5
-0@@ -109,3 +109,8 @@ KBUILD_LDFLAGS += --fatal-warnings KBUILD_RUSTFLAGS += -Dwarnings endif + +# Hostprog flags are used during build bootstrapping and can not rely on CONFIG_ symbols. +KBUILD_HOSTCFLAGS += -Werror +KBUILD_HOSTLDFLAGS += -Wl,--fatal-warnings +KBUILD_HOSTRUSTFLAGS += -Dwarnings
Just to check, is there a reason to keep this and patch 16 separate? The next patch immediately undoes the 'unconditionally' claim made here. Anyone bisecting through this point gets host tools failing on any new compiler warning, with no way to opt out short of HOSTCFLAGS=-Wno-error - squashing would also let you drop the comment that patch 16 then has to rewrite.
If you'd rather keep them split to preserve upstream history, you could mention in the commit message that the next patch makes it conditional.
Regards,
Simon
Re: [PATCH RFC next 15/18] kbuild: enable -Werror for hostprogs
Hi Simon,
Quoted 24 lines · Simon Glass
Hi Quentin,
Quoted 21 lines · Quentin Schulz
kbuild: enable -Werror for hostprogs
[ Upstream commit
27758d8c2583d10472b745a43ff86fef96c11ef7]Original commit log:
The hostprog compilers and linkers do not share the regular compiler flags, so they are not affected by
CONFIG_WERRORor W=e. As hostprogs are used during the bootstrap of the build, they can't depend on kconfig options.Enable -Werror unconditionally.
Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.extrawarn| 5 +++++1 file changed, 5 insertions(+)scripts/Makefile.extrawarn +0
-0@@ -109,3 +109,8 @@ KBUILD_LDFLAGS += --fatal-warnings KBUILD_RUSTFLAGS += -Dwarnings
Quoted 8 lines
scripts/Makefile.extrawarn KBUILD_LDFLAGS += --fatal-warnings · line 116
Quoted 6 lines
scripts/Makefile.extrawarn +5
-0endif + +# Hostprog flags are used during build bootstrapping and can not rely on CONFIG_ symbols. +KBUILD_HOSTCFLAGS += -Werror +KBUILD_HOSTLDFLAGS += -Wl,--fatal-warnings +KBUILD_HOSTRUSTFLAGS += -DwarningsJust to check, is there a reason to keep this and patch 16 separate?
Backports from Linux kernel where they already are separate.
Quoted 6 lines
The next patch immediately undoes the 'unconditionally' claim made here. Anyone bisecting through this point gets host tools failing on any new compiler warning, with no way to opt out short of HOSTCFLAGS=-Wno-error - squashing would also let you drop the comment that patch 16 then has to rewrite.
Fair enough.
Quoted 4 lines
If you'd rather keep them split to preserve upstream history, you could mention in the commit message that the next patch makes it conditional.
I would prefer to, it should make it easier to then see which patches were backported or not (git log --oneline). But I understand this unnecessarily breaks bisectability, so no strong opinion.
Cheers,
Quentin
Re: [PATCH RFC next 15/18] kbuild: enable -Werror for hostprogs
Hi Quentin,
Quoted 48 lines · Quentin Schulz
Hi Simon,
Quoted 24 lines · Simon Glass
Hi Quentin,
Quoted 21 lines · Quentin Schulz
kbuild: enable -Werror for hostprogs
[ Upstream commit
27758d8c2583d10472b745a43ff86fef96c11ef7]Original commit log:
The hostprog compilers and linkers do not share the regular compiler flags, so they are not affected by
CONFIG_WERRORor W=e. As hostprogs are used during the bootstrap of the build, they can't depend on kconfig options.Enable -Werror unconditionally.
Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.extrawarn| 5 +++++1 file changed, 5 insertions(+)scripts/Makefile.extrawarn +0
-0@@ -109,3 +109,8 @@ KBUILD_LDFLAGS += --fatal-warnings KBUILD_RUSTFLAGS += -DwarningsQuoted 8 lines
scripts/Makefile.extrawarn KBUILD_LDFLAGS += --fatal-warnings · line 116
Quoted 6 lines
scripts/Makefile.extrawarn +5
-0endif + +# Hostprog flags are used during build bootstrapping and can not rely on CONFIG_ symbols. +KBUILD_HOSTCFLAGS += -Werror +KBUILD_HOSTLDFLAGS += -Wl,--fatal-warnings +KBUILD_HOSTRUSTFLAGS += -DwarningsJust to check, is there a reason to keep this and patch 16 separate?
Backports from Linux kernel where they already are separate.
Quoted 6 lines
The next patch immediately undoes the 'unconditionally' claim made here. Anyone bisecting through this point gets host tools failing on any new compiler warning, with no way to opt out short of HOSTCFLAGS=-Wno-error - squashing would also let you drop the comment that patch 16 then has to rewrite.
Fair enough.
Quoted 8 lines
Quoted 4 lines
If you'd rather keep them split to preserve upstream history, you could mention in the commit message that the next patch makes it conditional.
I would prefer to, it should make it easier to then see which patches were backported or not (git log --oneline). But I understand this unnecessarily breaks bisectability, so no strong opinion.
Same here, up to you.
Regards,
Simon
Re: [PATCH RFC next 15/18] kbuild: enable -Werror for hostprogs
In reply to Quentin SchulzQuoted 7 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
[ Upstream commit
27758d8c2583d10472b745a43ff86fef96c11ef7]Original commit log:
Quoted 8 lines
The hostprog compilers and linkers do not share the regular compiler flags, so they are not affected by
CONFIG_WERRORor W=e. As hostprogs are used during the bootstrap of the build, they can't depend on kconfig options.Enable -Werror unconditionally.
Signed-off-by Quentin Schulz <[email protected]>---
Doesn't the next patch reverts this? I think you can squash them in a single patch
Thanks
/Ilias
Quoted 20 lines
scripts/Makefile.extrawarn | 5 +++++ 1 file changed, 5 insertions(+)scripts/Makefile.extrawarn +5
-1@@ -109,3 +109,8 @@ KBUILD_LDFLAGS += --fatal-warnings KBUILD_RUSTFLAGS += -Dwarnings endif + +# Hostprog flags are used during build bootstrapping and can not rely on CONFIG_ symbols. +KBUILD_HOSTCFLAGS += -Werror +KBUILD_HOSTLDFLAGS += -Wl,--fatal-warnings +KBUILD_HOSTRUSTFLAGS += -Dwarnings --2.54.0
Re: [PATCH RFC next 15/18] kbuild: enable -Werror for hostprogs
Hi Ilias,
Quoted 12 lines · Ilias Apalodimas
Quoted 11 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
[ Upstream commit
27758d8c2583d10472b745a43ff86fef96c11ef7]Original commit log:
The hostprog compilers and linkers do not share the regular compiler flags, so they are not affected by
CONFIG_WERRORor W=e. As hostprogs are used during the bootstrap of the build, they can't depend on kconfig options.
Quoted 8 lines
Quoted 4 lines
Enable -Werror unconditionally.
Signed-off-by Quentin Schulz <[email protected]>---
Doesn't the next patch reverts this? I think you can squash them in a single patch
No, the next patch will guard the code but before this patch it was simply never applied so it's not a no-op.
I decided to backport them separately even if this patch here isn't great and modified right after, so that we preserve a similar history to the Linux kernel's.
I can squash them if really desired, but I like not messing too much when backporting patches.
Cheers,
Quentin
RFC PATCH 16/18 scripts/Makefile.extrawarn: Respect CONFIG_WERROR / W=e for hostprogs
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
[ Upstream commit 7ded7d37e5f5b36b4acd74380156cf07b6640c5b ]
Original commit log:
Commit 27758d8c2583 ("kbuild: enable -Werror for hostprogs") unconditionally enabled -Werror for the compiler, assembler, and linker when building the host programs, as the build footprint of the host programs is small (thus risk of build failures from warnings are low) and that stage of the build may not have Kconfig values (thus CONFIG_WERROR could not be used as a precondition).
While turning warnings into errors unconditionally happens in a few places within the kernel, it can be disruptive to people who may be building with newer compilers, such as while doing a bisect. While it is possible to avoid this behavior by passing HOSTCFLAGS=-w or HOSTCFLAGS=-Wno-error, it may not be the most intuitive for regular users not intimately familiar with Kbuild.
Avoid being disruptive to the entire build by depending on the explicit opt-in of CONFIG_WERROR or W=e to enable -Werror and the like while building the host programs. While this means there is a small portion of the build that does not have -Werror enabled (namely scripts/kconfig/* and scripts/basic/fixdep), it is better than not having it altogether.
--- scripts/Makefile.extrawarn | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
scripts/Makefile.extrawarn +5 -3
@@ -108,9 +108,11 @@ KBUILD_AFLAGS += -Wa,--fatal-warnings KBUILD_LDFLAGS += --fatal-warnings KBUILD_RUSTFLAGS += -Dwarnings -endif - -# Hostprog flags are used during build bootstrapping and can not rely on CONFIG_ symbols. +# While hostprog flags are used during build bootstrapping (thus should not +# depend on CONFIG_ symbols), -Werror is disruptive and should be opted into. +# Only apply -Werror to hostprogs built after the initial Kconfig stage. KBUILD_HOSTCFLAGS += -Werror KBUILD_HOSTLDFLAGS += -Wl,--fatal-warnings KBUILD_HOSTRUSTFLAGS += -Dwarnings + +endif
Signature · 1 line
2.54.0
Re: [PATCH RFC next 16/18] scripts/Makefile.extrawarn: Respect CONFIG_WERROR / W=e for hostprogs
Quoted 26 lines · Quentin Schulz
scripts/Makefile.extrawarn: RespectCONFIG_WERROR/ W=e for hostprogs[ Upstream commit
7ded7d37e5f5b36b4acd74380156cf07b6640c5b]Original commit log:
Commit
27758d8c2583("kbuild: enable -Werror for hostprogs") unconditionally enabled -Werror for the compiler, assembler, and linker when building the host programs, as the build footprint of the host programs is small (thus risk of build failures from warnings are low) and that stage of the build may not haveKconfigvalues (thusCONFIG_WERRORcould not be used as a precondition).While turning warnings into errors unconditionally happens in a few places within the kernel, it can be disruptive to people who may be building with newer compilers, such as while doing a bisect. While it is possible to avoid this behavior by passing HOSTCFLAGS=-w or HOSTCFLAGS=-Wno-error, it may not be the most intuitive for regular users not intimately familiar with
Kbuild.Avoid being disruptive to the entire build by depending on the explicit opt-in of
CONFIG_WERRORor W=e to enable -Werror and the like while building the host programs. While this means there is a small portion of the build that does not have -Werror enabled (namelyscripts/kconfig/*andscripts/basic/fixdep), it is better than not having it altogether.
Quoted 4 lines
Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.extrawarn| 8 +++++---1 file changed, 5 insertions(+), 3 deletions(-)
Re: [PATCH RFC next 16/18] scripts/Makefile.extrawarn: Respect CONFIG_WERROR / W=e for hostprogs
In reply to Quentin SchulzQuoted 21 lines · Quentin Schulz
From: Quentin Schulz <[email protected]>
[ Upstream commit
7ded7d37e5f5b36b4acd74380156cf07b6640c5b]Original commit log:
Commit
27758d8c2583("kbuild: enable -Werror for hostprogs") unconditionally enabled -Werror for the compiler, assembler, and linker when building the host programs, as the build footprint of the host programs is small (thus risk of build failures from warnings are low) and that stage of the build may not haveKconfigvalues (thusCONFIG_WERRORcould not be used as a precondition).While turning warnings into errors unconditionally happens in a few places within the kernel, it can be disruptive to people who may be building with newer compilers, such as while doing a bisect. While it is possible to avoid this behavior by passing HOSTCFLAGS=-w or HOSTCFLAGS=-Wno-error, it may not be the most intuitive for regular users not intimately familiar with
Kbuild.
Quoted 8 lines
Avoid being disruptive to the entire build by depending on the explicit opt-in of
CONFIG_WERRORor W=e to enable -Werror and the like while building the host programs. While this means there is a small portion of the build that does not have -Werror enabled (namelyscripts/kconfig/*andscripts/basic/fixdep), it is better than not having it altogether.Signed-off-by Quentin Schulz <[email protected]>---
Quoted 26 lines
scripts/Makefile.extrawarn | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)scripts/Makefile.extrawarn +5
-4@@ -108,9 +108,11 @@ KBUILD_AFLAGS += -Wa,--fatal-warnings KBUILD_LDFLAGS += --fatal-warnings KBUILD_RUSTFLAGS += -Dwarnings -endif - -# Hostprog flags are used during build bootstrapping and can not rely on CONFIG_ symbols. +# While hostprog flags are used during build bootstrapping (thus should not +# depend on CONFIG_ symbols), -Werror is disruptive and should be opted into. +# Only apply -Werror to hostprogs built after the initial Kconfig stage. KBUILD_HOSTCFLAGS += -Werror KBUILD_HOSTLDFLAGS += -Wl,--fatal-warnings KBUILD_HOSTRUSTFLAGS += -Dwarnings + +endif --2.54.0
RFC PATCH 17/18 scripts/Makefile.build: do not run kernel-docs with warnings
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
We have too many of them for now and the kernel has switched to a Python script with likely many other small changes. We also have a couple of patches in our fork, so it'll need to be ported to the new version once sync'ed.
For now, let's simply not run kernel-docs with warnings, which allows us to use W=e to enable Werror for host and target compilers as well as the linker and assembler. This will then be used in buildman in next commit.
--- scripts/Makefile.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/Makefile.build +4 -1
@@ -127,7 +127,10 @@ else ifeq ($(KBUILD_CHECKSRC),2) endif ifneq ($(KBUILD_EXTRA_WARN),) - cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< + # U-Boot: Too many warnings in our docs and this prevents us from using the + # very convenient W=e to configure -Werror via a Make variable, so silence it + # for now. + # cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< endif # Compile C sources (.c)
Signature · 1 line
2.54.0
Re: [PATCH RFC next 17/18] scripts/Makefile.build: do not run kernel-docs with warnings
Hi Quentin,
Quoted 18 lines · Quentin Schulz
scripts/Makefile.build: do not run kernel-docs with warningsWe have too many of them for now and the kernel has switched to a Python script with likely many other small changes. We also have a couple of patches in our fork, so it'll need to be ported to the new version once sync'ed.
For now, let's simply not run kernel-docs with warnings, which allows us to use W=e to enable Werror for host and target compilers as well as the linker and assembler. This will then be used in buildman in next commit.
Signed-off-by Quentin Schulz <[email protected]>
scripts/Makefile.build| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)
scripts/Makefile.build else ifeq ($(KBUILD_CHECKSRC),2) · line 134
Quoted 9 lines
scripts/Makefile.build +4
-1@@ -127,7 +127,10 @@ else ifeq ($(KBUILD_CHECKSRC),2) endif ifneq ($(KBUILD_EXTRA_WARN),) - cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< + # U-Boot: Too many warnings in our docs and this prevents us from using the + # very convenient W=e to configure -Werror via a Make variable, so silence it + # for now. + # cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< endif
RFC PATCH 18/18 buildman: set W flag to e to be consistent with CONFIG_WERROR
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
Buildman currently only enables Werror for KBUILD_CFLAGS (via KCFLAGS) and KBUILD_HOSTCFLAGS (via HOSTCFLAGS) but nothing else.
scripts/Makefile.extrawarn now supports --fatal-warnings for the linker and assembler, which are enabled whenever CONFIG_WERROR is set.
Let's make buildman set this variable to enable even more checks. KBUILD_CFLAGS and KBUILD_HOSTCFLAGS are kept in case buildman is run on a git-range where W=e is not available, it's better than nothing.
--- tools/buildman/builderthread.py | 1 + 1 file changed, 1 insertion(+)
tools/buildman/builderthread.py +1 -0
@@ -233,6 +233,7 @@ class BuilderThread(threading.Thread): if self.builder.warnings_as_errors: args.append('KCFLAGS=-Werror') args.append('HOSTCFLAGS=-Werror') + args.append('W=e') if self.builder.allow_missing: args.append('BINMAN_ALLOW_MISSING=1') if self.builder.no_lto:
Signature · 1 line
2.54.0
Re: [PATCH RFC next 18/18] buildman: set W flag to e to be consistent with CONFIG_WERROR
Hi Quentin,
Quoted 19 lines · Quentin Schulz
buildman: set W flag to e to be consistent with
CONFIG_WERRORBuildman currently only enables Werror for
KBUILD_CFLAGS(via KCFLAGS) andKBUILD_HOSTCFLAGS(via HOSTCFLAGS) but nothing else.
scripts/Makefile.extrawarnnow supports --fatal-warnings for the linker and assembler, which are enabled wheneverCONFIG_WERRORis set.Let's make buildman set this variable to enable even more checks.
KBUILD_CFLAGSandKBUILD_HOSTCFLAGSare kept in case buildman is run on a git-range where W=e is not available, it's better than nothing.Signed-off-by Quentin Schulz <[email protected]>
tools/buildman/builderthread.py| 1 +1 file changed, 1 insertion(+)
tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 236
Quoted 4 lines
tools/buildman/builderthread.py +1
-0@@ -233,6 +233,7 @@ class BuilderThread(threading.Thread): if self.builder.warnings_as_errors: args.append('KCFLAGS=-Werror') args.append('HOSTCFLAGS=-Werror') + args.append('W=e')
Please update test_warnings_as_errors() in tools/buildman/func_test.py to assert W=e is present in the make args alongside the existing KCFLAGS / HOSTCFLAGS checks. Otherwise the new behaviour is silently untested.
Regards,
Simon
Re: [PATCH RFC next 18/18] buildman: set W flag to e to be consistent with CONFIG_WERROR
Hi Simon,
Quoted 20 lines · Simon Glass
Hi Quentin,
Quoted 16 lines · Quentin Schulz
buildman: set W flag to e to be consistent with
CONFIG_WERRORBuildman currently only enables Werror for
KBUILD_CFLAGS(via KCFLAGS) andKBUILD_HOSTCFLAGS(via HOSTCFLAGS) but nothing else.
scripts/Makefile.extrawarnnow supports --fatal-warnings for the linker and assembler, which are enabled wheneverCONFIG_WERRORis set.Let's make buildman set this variable to enable even more checks.
KBUILD_CFLAGSandKBUILD_HOSTCFLAGSare kept in case buildman is run on a git-range where W=e is not available, it's better than nothing.Signed-off-by Quentin Schulz <[email protected]>
tools/buildman/builderthread.py| 1 +1 file changed, 1 insertion(+)
Quoted 12 lines
tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 236
Quoted 6 lines
tools/buildman/builderthread.py +1
-0@@ -233,6 +233,7 @@ class BuilderThread(threading.Thread): if self.builder.warnings_as_errors: args.append('KCFLAGS=-Werror') args.append('HOSTCFLAGS=-Werror') + args.append('W=e')Please update
test_warnings_as_errors()intools/buildman/func_test.pyto assert W=e is present in the make args alongside the existing KCFLAGS / HOSTCFLAGS checks. Otherwise the new behaviour is silently untested.
This test is only available in your fork of U-Boot. I'll therefore ignore this comment.
Cheers,
Quentin
Re: [PATCH RFC next 18/18] buildman: set W flag to e to be consistent with CONFIG_WERROR
Hi Quentin,
Quoted 37 lines · Quentin Schulz
Hi Simon,
Quoted 20 lines · Simon Glass
Hi Quentin,
Quoted 16 lines · Quentin Schulz
buildman: set W flag to e to be consistent with
CONFIG_WERRORBuildman currently only enables Werror for
KBUILD_CFLAGS(via KCFLAGS) andKBUILD_HOSTCFLAGS(via HOSTCFLAGS) but nothing else.
scripts/Makefile.extrawarnnow supports --fatal-warnings for the linker and assembler, which are enabled wheneverCONFIG_WERRORis set.Let's make buildman set this variable to enable even more checks.
KBUILD_CFLAGSandKBUILD_HOSTCFLAGSare kept in case buildman is run on a git-range where W=e is not available, it's better than nothing.Signed-off-by Quentin Schulz <[email protected]>
tools/buildman/builderthread.py| 1 +1 file changed, 1 insertion(+)Quoted 12 lines
tools/buildman/builderthread.py class BuilderThread(threading.Thread): · line 236
Quoted 6 lines
tools/buildman/builderthread.py +1
-0@@ -233,6 +233,7 @@ class BuilderThread(threading.Thread): if self.builder.warnings_as_errors: args.append('KCFLAGS=-Werror') args.append('HOSTCFLAGS=-Werror') + args.append('W=e')Please update
test_warnings_as_errors()intools/buildman/func_test.pyto assert W=e is present in the make args alongside the existing KCFLAGS / HOSTCFLAGS checks. Otherwise the new behaviour is silently untested.
Quoted 2 lines
This test is only available in your fork of U-Boot. I'll therefore ignore this comment.
Oh yes, I haven't upstreamed those extra tests yet. I'll take a look when this series is in. I sent an email about buildman if you have any thoughts on that.
Regards,
Simon
Quoted 9 lines · Quentin Schulz
I ended up being surprised host tools aren't compiled with -Werror even when
CONFIG_WERRORis set.While this is an issue for local builds, buildman (used in CI) adds -Werror to KCFLAGS and HOSTCFLAGS when passed -E (or --warnings-as-errors), which we do, see
'build all platforms in a single job' job and&buildman_and_testpy_dfntemplate.
Quoted 4 lines
It turns out that even though we claim to have synchronized our kbuild with Linux kernel v6.1, some of it was stuck to v5.1 +- some partial backports. This doesn't attempt to update everything that isn't in sync with 6.1 though!
Thanks for doing this. Having done a few of the previous re-syncs it's always hard to find every file that needs to be updated.
Quoted 18 lines
The first two patches are for fixing pytest calling make directly on a "dirty" build directory as generated by buildman using the clang-20 toolchain, but pytest does not set HOSTCC and CC to clang-20, resulting in clang flags being used with gcc).
One can simply reproduce it (after backporting up to patch "
scripts/Makefile.extrawarn: sync with 6.1") by doing so in the container:make HOSTCC=clang-20 CC=clang-20 O=build/sandbox
sandbox_defconfigmake HOSTCC=clang-20 CC=clang-20 O=build/sandbox -j`nproc make O=build/sandbox u-boot-initial-envIt'll print:
gcc: error: unrecognized command-line option '-mno-global-merge'
gcc: error: unrecognized command-line option '-Wformat-invalid-specifier'
gcc: error: unrecognized command-line option '-Qunused-arguments'
Quoted 6 lines
This is essentially what's run within
test_env_initial_env_fileintest/py/tests/test_env.py.While I'm not unhappy with the patches to pytest, it feels to me we may be missing something else for the u-boot-initial-env make target to update the kconfig symbol based on the toolchain being used when called.
Is there some other target in the Makefile that should catch this kind of change? It's not just that build target that needs to be remade, it's everything, yes?
Quoted 10 lines
While looking at the kernel git history for
Makefileandscripts/Makefile.extrawarnI also saw a few flags being removed or reworked so I took the liberty of backporting some.Then,
scripts/Makefile.extrawarnis directly imported verbatim from v6.1 which is the version we've claimed to be synced with so far.Also, patches to apply
CONFIG_WERRORto the host tools as well as linker and assembler are backported.
Quoted 9 lines
kernel-doc is made to ignore
KBUILD_EXTRA_WARNsince we have too many warnings for now and it prevents us from being able to use W=e Make variable which is extremely convenient to essentially do the same as settingCONFIG_WERRORinKconfig, just without needing to actually set it in the defconfig or in a .config. I don't like it but it is what it is. Our kernel-doc has a couple of patches on top of Linux kernel v5.11's. The kernel has moved to a Python script this year, so it's probably wise to migrate to that before trying to tackle kernel-doc warnings.
This makes sense, yes.
Signature · 1 line
Tom
Hi Tom,
Quoted 1 line · Tom Rini
On Mon, May 04, 2026 at 03:20:27PM +0200, Quentin Schulz wrote:
[...]
Quoted 21 lines
Quoted 21 lines
The first two patches are for fixing pytest calling make directly on a "dirty" build directory as generated by buildman using the clang-20 toolchain, but pytest does not set HOSTCC and CC to clang-20, resulting in clang flags being used with gcc).
One can simply reproduce it (after backporting up to patch "
scripts/Makefile.extrawarn: sync with 6.1") by doing so in the container:make HOSTCC=clang-20 CC=clang-20 O=build/sandbox
sandbox_defconfigmake HOSTCC=clang-20 CC=clang-20 O=build/sandbox -j`nproc make O=build/sandbox u-boot-initial-envIt'll print:
gcc: error: unrecognized command-line option '-mno-global-merge'
gcc: error: unrecognized command-line option '-Wformat-invalid-specifier'
gcc: error: unrecognized command-line option '-Qunused-arguments'This is essentially what's run within
test_env_initial_env_fileintest/py/tests/test_env.py.
Quoted 8 lines
Quoted 3 lines
While I'm not unhappy with the patches to pytest, it feels to me we may be missing something else for the u-boot-initial-env make target to update the kconfig symbol based on the toolchain being used when called.
Is there some other target in the
Makefilethat should catch this kind of change? It's not just that build target that needs to be remade, it's everything, yes?
For the reproducer, one actually needs to do
Makefile +3 -3
@@ -1007,15 +1007,15 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ifdef CONFIG_CC_IS_CLANG -KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) -KBUILD_CFLAGS += $(call cc-disable-warning, gnu) +KBUILD_CPPFLAGS += -Qunused-arguments +KBUILD_CFLAGS += -Wno-format-invalid-specifier +KBUILD_CFLAGS += -Wno-gnu # Quiet clang warning: comparison of unsigned expression < 0 is always
false
-KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) +KBUILD_CFLAGS += -Wno-tautological-compare
# CLANG uses a _MergedGlobals as optimization, but this breaks
modpost, as the
# source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 -KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += -mno-global-merge else
# These warnings generated too much noise in a regular build.
Which is what's being done since kernel commit a1494304346a ("kbuild: add all Clang-specific flags unconditionally"). I actually had this in an earlier version of this patch series and forgot I removed it.
This seems to apply to envtools and tools-only as well, though make prompts me for the desired state of symbols that are now reachable, e.g. ARM64_CRC32. And if I rerun the same command, then it works. It seems like the config from the previous run is used? I don't know if it's related but those two commands call make directly ($(Q)$(MAKE) $(build)=<path>). Do you have something in mind maybe? Or some more commands to run?
Cheers,
Quentin
Quoted 71 lines · Quentin Schulz
Hi Tom,
Quoted 1 line · Tom Rini
On Mon, May 04, 2026 at 03:20:27PM +0200, Quentin Schulz wrote:
[...]
Quoted 21 lines
Quoted 21 lines
The first two patches are for fixing pytest calling make directly on a "dirty" build directory as generated by buildman using the clang-20 toolchain, but pytest does not set HOSTCC and CC to clang-20, resulting in clang flags being used with gcc).
One can simply reproduce it (after backporting up to patch "
scripts/Makefile.extrawarn: sync with 6.1") by doing so in the container:make HOSTCC=clang-20 CC=clang-20 O=build/sandbox
sandbox_defconfigmake HOSTCC=clang-20 CC=clang-20 O=build/sandbox -j`nproc make O=build/sandbox u-boot-initial-envIt'll print:
gcc: error: unrecognized command-line option '-mno-global-merge'
gcc: error: unrecognized command-line option '-Wformat-invalid-specifier'
gcc: error: unrecognized command-line option '-Qunused-arguments'This is essentially what's run within
test_env_initial_env_fileintest/py/tests/test_env.py.Quoted 8 lines
Quoted 3 lines
While I'm not unhappy with the patches to pytest, it feels to me we may be missing something else for the u-boot-initial-env make target to update the kconfig symbol based on the toolchain being used when called.
Is there some other target in the
Makefilethat should catch this kind of change? It's not just that build target that needs to be remade, it's everything, yes?For the reproducer, one actually needs to do
Makefile +3
-3@@ -1007,15 +1007,15 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ifdef CONFIG_CC_IS_CLANG -KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) -KBUILD_CFLAGS += $(call cc-disable-warning, gnu) +KBUILD_CPPFLAGS += -Qunused-arguments +KBUILD_CFLAGS += -Wno-format-invalid-specifier +KBUILD_CFLAGS += -Wno-gnu # Quiet clang warning: comparison of unsigned expression < 0 is alwaysfalse
Makefile +1
-1-KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) +KBUILD_CFLAGS += -Wno-tautological-compare # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, asthe
# source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2Makefile +1
-1-KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += -mno-global-merge else # These warnings generated too much noise in a regular build.Which is what's being done since kernel commit
a1494304346a("kbuild: add all Clang-specific flags unconditionally"). I actually had this in an earlier version of this patch series and forgot I removed it.
Quoted 6 lines
This seems to apply to envtools and tools-only as well, though make prompts me for the desired state of symbols that are now reachable, e.g.
ARM64_CRC32. And if I rerun the same command, then it works. It seems like the config from the previous run is used? I don't know if it's related but those two commands call make directly ($(Q)$(MAKE) $(build)=<path>). Do you have something in mind maybe? Or some more commands to run?
I think I partly misunderstood at first. It's not that we switch from one toolchain to another, it's that we can't (as easily) use gcc for the target and clang for host tools (and vice-versa) because of how flags are set now, yes? If so, how does this work in the kernel?
Signature · 1 line
Tom
Hi Tom,
Quoted 72 lines · Tom Rini
Quoted 71 lines · Quentin Schulz
Hi Tom,
Quoted 1 line · Tom Rini
On Mon, May 04, 2026 at 03:20:27PM +0200, Quentin Schulz wrote:
[...]
Quoted 21 lines
Quoted 21 lines
The first two patches are for fixing pytest calling make directly on a "dirty" build directory as generated by buildman using the clang-20 toolchain, but pytest does not set HOSTCC and CC to clang-20, resulting in clang flags being used with gcc).
One can simply reproduce it (after backporting up to patch "
scripts/Makefile.extrawarn: sync with 6.1") by doing so in the container:make HOSTCC=clang-20 CC=clang-20 O=build/sandbox
sandbox_defconfigmake HOSTCC=clang-20 CC=clang-20 O=build/sandbox -j`nproc make O=build/sandbox u-boot-initial-envIt'll print:
gcc: error: unrecognized command-line option '-mno-global-merge'
gcc: error: unrecognized command-line option '-Wformat-invalid-specifier'
gcc: error: unrecognized command-line option '-Qunused-arguments'This is essentially what's run within
test_env_initial_env_fileintest/py/tests/test_env.py.Quoted 8 lines
Quoted 3 lines
While I'm not unhappy with the patches to pytest, it feels to me we may be missing something else for the u-boot-initial-env make target to update the kconfig symbol based on the toolchain being used when called.
Is there some other target in the
Makefilethat should catch this kind of change? It's not just that build target that needs to be remade, it's everything, yes?For the reproducer, one actually needs to do
Makefile +3
-3@@ -1007,15 +1007,15 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ifdef CONFIG_CC_IS_CLANG -KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) -KBUILD_CFLAGS += $(call cc-disable-warning, gnu) +KBUILD_CPPFLAGS += -Qunused-arguments +KBUILD_CFLAGS += -Wno-format-invalid-specifier +KBUILD_CFLAGS += -Wno-gnu # Quiet clang warning: comparison of unsigned expression < 0 is alwaysfalse
Makefile +1
-1-KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) +KBUILD_CFLAGS += -Wno-tautological-compare # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, asthe
# source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2Makefile +1
-1-KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += -mno-global-merge else # These warnings generated too much noise in a regular build.Which is what's being done since kernel commit
a1494304346a("kbuild: add all Clang-specific flags unconditionally"). I actually had this in an earlier version of this patch series and forgot I removed it.
Quoted 12 lines
Quoted 6 lines
This seems to apply to envtools and tools-only as well, though make prompts me for the desired state of symbols that are now reachable, e.g.
ARM64_CRC32. And if I rerun the same command, then it works. It seems like the config from the previous run is used? I don't know if it's related but those two commands call make directly ($(Q)$(MAKE) $(build)=<path>). Do you have something in mind maybe? Or some more commands to run?I think I partly misunderstood at first. It's not that we switch from one toolchain to another, it's that we can't (as easily) use gcc for the target and clang for host tools (and vice-versa) because of how flags are set now, yes? If so, how does this work in the kernel?
I'm not sure what's happening so it's quite difficult to put into words.
Apply the following to the master branch:
Makefile +3 -3
@@ -999,15 +999,15 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ifdef CONFIG_CC_IS_CLANG -KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) -KBUILD_CFLAGS += $(call cc-disable-warning, gnu) +KBUILD_CPPFLAGS += -Qunused-arguments +KBUILD_CFLAGS += -Wno-format-invalid-specifier +KBUILD_CFLAGS += -Wno-gnu # Quiet clang warning: comparison of unsigned expression < 0 is always
false
-KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) +KBUILD_CFLAGS += -Wno-tautological-compare
# CLANG uses a _MergedGlobals as optimization, but this breaks
modpost, as the
# source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2 -KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += -mno-global-merge KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) else
What I do:
make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma HOSTCC=clang CC=clang puma-rk3399_defconfig make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma HOSTCC=clang CC=clang V=1 make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma V=1
That is, I configure the defconfig with clang selected as toolchain, (successfully) build U-Boot with clang, then rebuild switching to gcc.
What happens is that the last make command prompts me for Kconfig symbols that are now reachable and thus kconfig doesn't know what to do with them.
See the (NEW) entries below:
scripts/kconfig/conf --syncconfig Kconfig
*
* Restart config...
*
*
* ARM architecture
*
Enable support for CRC32 instruction (ARM64_CRC32) [Y/n/?] (NEW)
Timer clock frequency (COUNTER_FREQUENCY) [24000000] 24000000
Generate position-independent pre-relocation code (POSITION_INDEPENDENT) [N/y/?] n Specify the early stack pointer relative to the .bss section (INIT_SP_RELATIVE) [N/y/?] n Emit virtualizable instructions (KVM_VIRT_INS) [N/y/?] n
ARM GICV2 driver (DRIVER_GICV2) [N/y/?] n
ARM GICV3 ITS (GIC_V3_ITS) [N/y/?] n
ARM GICV3 GIC600 SUPPORT (GICV3_SUPPORT_GIC600) [N/y/?] n
Do not enable icache (SYS_ICACHE_OFF) [N/y/?] n
Do not enable icache in SPL (SPL_SYS_ICACHE_OFF) [N/y/?] n
Do not enable dcache (SYS_DCACHE_OFF) [N/y/?] n
Do not enable dcache in SPL (SPL_SYS_DCACHE_OFF) [N/y/?] n
CP15 based cache enabling support (SYS_ARM_CACHE_CP15) [N/y/?] n
MMU-based Paged Memory Management Support (SYS_ARM_MMU) [N/y/?] n
Use the ARM v7 PMSA Compliant MPU (SYS_ARM_MPU) [N/y/?] n
Select the ARM data write cache policy
Quoted 1 line
1. Write-back (WB) (
SYS_ARM_CACHE_WRITEBACK)
2. Write-through (WT) (SYS_ARM_CACHE_WRITETHROUGH)
3. Write allocation (WA) (SYS_ARM_CACHE_WRITEALLOC)
choice[1-3?]: 1
Enable ARCH_CPU_INIT (ARCH_CPU_INIT) [N/y/?] n
ARM Generic Timer support (SYS_ARCH_TIMER) [Y/n/?] y
Support for ARM SMC Calling Convention (SMCCC) (ARM_SMCCC) [Y/?] y ARM PL310 L2 cache controller (SYS_L2_PL310) [N/y/?] n
ARM PL310 L2 cache controller in SPL (SPL_SYS_L2_PL310) [N/y/?] n L2cache off (SYS_L2CACHE_OFF) [N/y/?] n
prepare BOOT0 header (ENABLE_ARM_SOC_BOOT0_HOOK) [Y/?] y
Use an assembly optimized implementation of memcpy (USE_ARCH_MEMCPY) [N/y/?] (NEW)
Use an assembly optimized implementation of memcpy for SPL (SPL_USE_ARCH_MEMCPY) [N/y/?] n Use an assembly optimized implementation of memcpy for TPL (TPL_USE_ARCH_MEMCPY) [N/y/?] n Use an assembly optimized implementation of memset (USE_ARCH_MEMSET) [N/y/?] (NEW)
Use an assembly optimized implementation of memset for SPL (SPL_USE_ARCH_MEMSET) [N/y/?] n Use an assembly optimized implementation of memset for TPL (TPL_USE_ARCH_MEMSET) [N/y/?] n ARM64 system support AArch32 execution state (ARM64_SUPPORT_AARCH32) [Y/n/?] y Target select
1. Airoha SoCs (ARCH_AIROHA)
2. Atmel AT91 (ARCH_AT91)
3. TI DaVinci (ARCH_DAVINCI)
4. Hisilicon HiSTB SoCs (ARCH_HISTB)
5. Marvell Kirkwood (ARCH_KIRKWOOD)
6. Marvell MVEBU family (Armada XP/375/38x/3700/7K/8K) (ARCH_MVEBU)
7. Broadcom BCM283X family (ARCH_BCM283X)
8. Broadcom BCM7XXX family (ARCH_BCMSTB)
9. Broadcom broadband chip family (ARCH_BCMBCA)
10. Support vexpress_ca9x4 (TARGET_VEXPRESS_CA9X4)
11. Support Broadcom Northstar (TARGET_BCMNS)
12. Support Broadcom NS3 (TARGET_BCMNS3)
13. Samsung EXYNOS (ARCH_EXYNOS)
14. Samsung S5PC1XX (ARCH_S5PC1XX)
15. Calxeda Highbank (ARCH_HIGHBANK)
16. ARM Ltd. Integrator family (ARCH_INTEGRATOR)
17. Qualcomm IPQ40xx SoCs (ARCH_IPQ40XX)
18. TI Keystone (ARCH_KEYSTONE)
19. Texas Instruments' K3 Architecture (ARCH_K3)
20. TI OMAP2+ (ARCH_OMAP2PLUS)
21. Amlogic Meson (ARCH_MESON)
22. MediaTek SoCs (ARCH_MEDIATEK)
23. Marvell MMP (ARCH_MMP)
24. NXP LPC32xx platform (ARCH_LPC32XX)
25. NXP i.MX8 platform (ARCH_IMX8)
26. NXP i.MX8M platform (ARCH_IMX8M)
27. NXP i.MX8ULP platform (ARCH_IMX8ULP)
28. NXP i.MX9 platform (ARCH_IMX9)
29. NXP i.MXRT platform (ARCH_IMXRT)
30. NXP i.MX23 family (ARCH_MX23)
31. NXP i.MX28 family (ARCH_MX28)
32. NXP MX7ULP (ARCH_MX7ULP)
33. Freescale MX7 (ARCH_MX7)
34. Freescale MX6 (ARCH_MX6)
35. Freescale MX5 (ARCH_MX5)
36. Nexell S5P4418/S5P6818 SoC (ARCH_NEXELL)
37. Support Nuvoton SoCs (ARCH_NPCM)
38. Apple SoCs (ARCH_APPLE)
39. Actions Semi OWL SoCs (ARCH_OWL)
40. QEMU Virtual Platform (ARCH_QEMU)
41. Renesas ARM SoCs (ARCH_RENESAS)
42. Qualcomm Snapdragon SoCs (ARCH_SNAPDRAGON)
43. Altera SOCFPGA family (ARCH_SOCFPGA)
44. Support sunxi (Allwinner) SoCs (ARCH_SUNXI)
45. ST-Ericsson U8500 Series (ARCH_U8500)
46. Support Xilinx Versal Platform (ARCH_VERSAL)
47. Support AMD Versal Gen 2 Platform (ARCH_VERSAL2)
48. Support Xilinx Versal NET Platform (ARCH_VERSAL_NET)
49. Freescale Vybrid (ARCH_VF610)
50. Xilinx Zynq based platform (ARCH_ZYNQ)
51. Xilinx ZynqMP R5 based platform (ARCH_ZYNQMP_R5)
52. Xilinx ZynqMP based platform (ARCH_ZYNQMP)
53. NVIDIA Tegra (ARCH_TEGRA)
54. Support ARMv8 Arm Ltd. VExpress based boards and models
(ARCH_VEXPRESS64)
55. Support Corstone1000 Platform (TARGET_CORSTONE1000)
56. Support Total Compute Platform (TARGET_TOTAL_COMPUTE)
57. Support ls2080a_emu (TARGET_LS2080A_EMU)
58. Support ls1088aqds (TARGET_LS1088AQDS)
59. Support ls2080aqds (TARGET_LS2080AQDS)
60. Support ls2080ardb (TARGET_LS2080ARDB)
61. Support ls2081ardb (TARGET_LS2081ARDB)
62. Support lx2160ardb (TARGET_LX2160ARDB)
63. Support lx2160aqds (TARGET_LX2160AQDS)
64. Support lx2162aqds (TARGET_LX2162AQDS)
65. Support HiKey 96boards Consumer Edition Platform (TARGET_HIKEY)
66. Support HiKey960 96boards Consumer Edition Platform (TARGET_HIKEY960)
67. Support Poplar 96boards Enterprise Edition Platform (TARGET_POPLAR)
68. Support ls1012aqds (TARGET_LS1012AQDS)
69. Support ls1012ardb (TARGET_LS1012ARDB)
70. Support ls1012a2g5rdb (TARGET_LS1012A2G5RDB)
71. Support ls1012afrwy (TARGET_LS1012AFRWY)
72. Support ls1012afrdm (TARGET_LS1012AFRDM)
73. Support ls1028aqds (TARGET_LS1028AQDS)
74. Support ls1028ardb (TARGET_LS1028ARDB)
75. Support ls1088ardb (TARGET_LS1088ARDB)
76. Support ls1021aqds (TARGET_LS1021AQDS)
77. Support ls1021atwr (TARGET_LS1021ATWR)
78. Support Hitachi-Powergrids SELI8 service unit card
(TARGET_PG_WCOM_SELI8)
79. Support Hitachi-Powergrids EXPU1 service unit card
(TARGET_PG_WCOM_EXPU1)
80. Support ls1021atsn (TARGET_LS1021ATSN)
81. Support ls1021aiot (TARGET_LS1021AIOT)
82. Support ls1043aqds (TARGET_LS1043AQDS)
83. Support ls1043ardb (TARGET_LS1043ARDB)
84. Support ls1046aqds (TARGET_LS1046AQDS)
85. Support ls1046ardb (TARGET_LS1046ARDB)
86. Support ls1046afrwy (TARGET_LS1046AFRWY)
87. Analog Devices SC5XX-processor family (ARCH_SC5XX)
88. Support sl28 (TARGET_SL28)
89. Support ten64 (TARGET_TEN64)
90. Socionext UniPhier SoCs (ARCH_UNIPHIER)
91. Socionext SynQuacer SoCs (ARCH_SYNQUACER)
92. Support STMicroelectronics STM32 MCU with cortex M (ARCH_STM32)
93. Support STMicroelectronics SoCs (ARCH_STI)
94. Support STMicroelectronics STM32MP Socs with cortex A (ARCH_STM32MP)
Quoted 1 line
95. Support Rockchip SoCs (
ARCH_ROCKCHIP)
96. Support OcteonTX SoCs (ARCH_OCTEONTX)
97. Support OcteonTX2 SoCs (ARCH_OCTEONTX2)
98. Support ThunderX 88xx (TARGET_THUNDERX_88XX)
99. Support Aspeed SoCs (ARCH_ASPEED)
100. Support Phytium Durian Platform (TARGET_DURIAN)
101. Support Phytium Pomelo Platform (TARGET_POMELO)
102. Support Phytium PE2201 Platform (TARGET_PE2201)
103. Support Cortina Presidio ASIC Platform (TARGET_PRESIDIO_ASIC)
104. Xen guest ARM64 (TARGET_XENGUEST_ARM64)
105. Support HPE GXP SoCs (ARCH_GXP)
choice[1-105?]: 95
Support Rockchip PX30 (ROCKCHIP_PX30) [N/y/?] n
Support Rockchip RK3036 (ROCKCHIP_RK3036) [N/y/?] n
Support Rockchip RK3066 (ROCKCHIP_RK3066) [N/y/?] n
Support Rockchip RK3128 (ROCKCHIP_RK3128) [N/y/?] n
Support Rockchip RK3188 (ROCKCHIP_RK3188) [N/y/?] n
Support Rockchip RK3228/RK3229 (ROCKCHIP_RK322X) [N/y/?] n
Support Rockchip RK3288 (ROCKCHIP_RK3288) [N/y/?] n
Support Rockchip RK3308 (ROCKCHIP_RK3308) [N/y/?] n
Support Rockchip RK3328 (ROCKCHIP_RK3328) [N/y/?] n
Support Rockchip RK3368 (ROCKCHIP_RK3368) [N/y/?] n
Support Rockchip RK3399 (ROCKCHIP_RK3399) [Y/n/?] y
Support Rockchip RK3506 (ROCKCHIP_RK3506) [N/y/?] n
Support Rockchip RK3528 (ROCKCHIP_RK3528) [N/y/?] n
Support Rockchip RK3568 (ROCKCHIP_RK3568) [N/y/?] n
Support Rockchip RK3576 (ROCKCHIP_RK3576) [N/y/?] n
Support Rockchip RK3588 (ROCKCHIP_RK3588) [N/y/?] n
Support Rockchip RV1108 (ROCKCHIP_RV1108) [N/y/?] n
Support Rockchip RV1126 (ROCKCHIP_RV1126) [N/y/?] n
Route uart output to usb pins (ROCKCHIP_USB_UART) [N/y/?] n
SPL returns to bootrom (SPL_ROCKCHIP_BACK_TO_BROM) [N/y/?] n
TPL returns to bootrom (TPL_ROCKCHIP_BACK_TO_BROM) [Y/n/?] y
Rockchip common board file (ROCKCHIP_COMMON_BOARD) [Y/n/?] y
Rockchip SPL common board file (SPL_ROCKCHIP_COMMON_BOARD) [Y/n/?] y
Rockchip TPL common board file (TPL_ROCKCHIP_COMMON_BOARD) [Y/n/?] y
Use external TPL binary (ROCKCHIP_EXTERNAL_TPL) [N/y/?] n
Rockchip boot mode flag register address (ROCKCHIP_BOOT_MODE_REG) [0x0] 0x0
Disable device boot on power plug-in (ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON) [N/y/?] n Rockchip STIMER support (ROCKCHIP_STIMER) [Y/n/?] y
Size of IRAM reserved in SPL (ROCKCHIP_SPL_RESERVE_IRAM) [0x0] 0x0
SPL requires early-return (for RK3188-style BROM) to BROM (SPL_ROCKCHIP_EARLYRETURN_TO_BROM) [N/y/?] n Disable force_jtag feature (ROCKCHIP_DISABLE_FORCE_JTAG) [Y/n/?] y
TPL requires early-return (for RK3188-style BROM) to BROM (TPL_ROCKCHIP_EARLYRETURN_TO_BROM) [N/y/?] n Build a SPI image for rockchip (ROCKCHIP_SPI_IMAGE) [Y/n/?] y
Build a maskrom mode image for Rockchip (ROCKCHIP_MASKROM_IMAGE) [N/y/?] n
RK3399 board select
1. Asus Flip C101PA Chromebook (RK3399) (TARGET_CHROMEBOOK_BOB)
2. Samsung Chromebook Plus (RK3399) (TARGET_CHROMEBOOK_KEVIN)
3. RK3399 evaluation board (TARGET_EVB_RK3399)
4. Pinebook Pro (TARGET_PINEBOOK_PRO_RK3399)
5. PinePhone Pro (TARGET_PINEPHONE_PRO_RK3399)
Quoted 1 line
6. Theobroma Systems RK3399-Q7 (Puma) (
TARGET_PUMA_RK3399)
7. Vamrs Limited Rock960 board family (TARGET_ROCK960_RK3399)
8. Radxa ROCK Pi 4 board (TARGET_ROCKPI4_RK3399)
9. Pine64 Rockpro64 board (TARGET_ROCKPRO64_RK3399)
10. Firefly ROC-RK3399-PC board (TARGET_ROC_PC_RK3399)
choice[1-10?]: 6
Theobroma Systems RK3399-Q7 DDR Option
Quoted 1 line
1. DDR3-1333MHz (
TARGET_PUMA_RK3399_RAM_DDR3_1333)
2. DDR3-1600MHz (TARGET_PUMA_RK3399_RAM_DDR3_1600)
3. DDR3-1866MHz (TARGET_PUMA_RK3399_RAM_DDR3_1866)
choice[1-3?]: 1
Force cache maintenance to be exclusively by VA (CMO_BY_VA_ONLY) [N/y/?] n
Fix broken ARMv8 generic timer (ARMV8_CNTFRQ_BROKEN) [N/y/?] n
Install crash dump exception vectors (ARMV8_SPL_EXCEPTION_VECTORS) [N/y/?] n Enable multiple CPUs to enter into U-Boot (ARMV8_MULTIENTRY) [N/y/?] n
Enable data coherency with other cores in cluster (ARMV8_SET_SMPEN) [Y/n/?] y Enable switching to running in EL1 (ARMV8_SWITCH_TO_EL1) [N/y/?] n
Use PSCI for reset and shutdown (PSCI_RESET) [Y/n/?] y
Enable PSCI support (ARMV8_PSCI) [N/y/?] n
External aborts and SError interrupt exception are taken in EL3 (ARMV8_EA_EL3_FIRST) [N/y/?] n Use the event stream for udelay (ARMV8_UDELAY_EVENT_STREAM) [N/y/?] n
*
* General setup
*
Compile also drivers which will not load (COMPILE_TEST) [N/y/?] n
Compile U-Boot with warnings as errors (WERROR) [N/y/?] n
Local version - append to U-Boot release (LOCALVERSION) []
Automatically append version information to the version string (LOCALVERSION_AUTO) [Y/n/?] y Optimization level
Quoted 1 line
1. Optimize for size (
CC_OPTIMIZE_FOR_SIZE)
2. Optimize for speed (CC_OPTIMIZE_FOR_SPEED)
3. Optimize for debugging (CC_OPTIMIZE_FOR_DEBUG)
choice[1-3?]: 1
Allow compiler to uninline functions marked 'inline' in full U-Boot (OPTIMIZE_INLINING) [N/y/?] n Allow compiler to uninline functions marked 'inline' in SPL (SPL_OPTIMIZE_INLINING) [N/y/?] n Allow compiler to uninline functions marked 'inline' in TPL (TPL_OPTIMIZE_INLINING) [N/y/?] n Enable Link Time Optimizations (LTO) [N/y/?] n
Select U-Boot be run as a bootloader for XEN Virtual Machine (XEN) [N/y/?] n
Add arch, board, vendor and soc variables to default environment (ENV_VARS_UBOOT_CONFIG) [Y/?] y Number of DRAM banks (NR_DRAM_BANKS) [1] 1
Enable kernel command line setup (SYS_BOOT_GET_CMDLINE) [N/y/?] n
Enable kernel board information setup (SYS_BOOT_GET_KBD) [N/y/?] n
Use a custom location for the initial stack pointer address (HAS_CUSTOM_SYS_INIT_SP_ADDR) [Y/?] y
Static location for the initial stack pointer
(CUSTOM_SYS_INIT_SP_ADDR) [0x03f00000] 0x03f00000
Enable malloc() pool before relocation (SYS_MALLOC_F) [Y/?] y
Size of malloc() pool before relocation (SYS_MALLOC_F_LEN) [0x10000]0x10000
Define memory for Dynamic allocation (SYS_MALLOC_LEN) [0x2000000] 0x2000000
Enable malloc() pool in SPL (SPL_SYS_MALLOC_F) [Y/n/?] y
Size of malloc() pool in SPL (SPL_SYS_MALLOC_F_LEN) [0x8000] 0x8000
Enable malloc() pool in TPL (TPL_SYS_MALLOC_F) [Y/n/?] y
Size of malloc() pool in TPL (TPL_SYS_MALLOC_F_LEN) [0x4000] 0x4000
Inform valgrind about memory allocations (VALGRIND) [N/y/?] n
64bit physical address support (PHYS_64BIT) [Y/?] y
64bit fdt address support (FDT_64BIT) [Y/?] y
SPL image used in the combined SPL+U-Boot image (SPL_IMAGE) [spl/u-boot-spl.bin] spl/u-boot-spl.bin Recreate an ELF image from raw U-Boot binary (REMAKE_ELF) [N/y/?] n
Build target special images (BUILD_TARGET) []
Define a maximum size for the U-Boot image (HAS_BOARD_SIZE_LIMIT) [N/y/?] n
Use a custom location for the U-Boot linker script (SYS_CUSTOM_LDSCRIPT) [N/y/?] n Address in memory to use by default (SYS_LOAD_ADDR) [0x800800] 0x800800
Define max stack size that can be used by U-Boot (STACK_SIZE) [0x1000000] 0x1000000 Exclude some memory from U-Boot / OS information (SYS_MEM_TOP_HIDE) [0x0] 0x0 Maximum size in bytes reserved for U-Boot in memory (SYS_MONITOR_LEN) [0] 0
Support for multiprocessor (MP) [N/y/?] n
Text Base (TEXT_BASE) [0x00800000] 0x00800000
Use custom U-Boot Start (HAVE_SYS_UBOOT_START) [N/y/?] n
Determine CPU clock frequency at run-time (DYNAMIC_SYS_CLK_FREQ) [N/y/?] n
CPU clock frequency (SYS_CLK_FREQ) [0] 0
Enable U-Boot API (API) [N/y/?] (NEW)
Then it continues with the build, but using the flags for clang while using GCC, see:
make -f /home/qschulz/work/upstream/u-boot/scripts/Makefile.autoconf || \
{ rm -f include/config/auto.conf; false; }
mkdir -p include/asm
if [ -d /home/qschulz/work/upstream/u-boot/arch/arm/mach-rk3399/include/mach ]; then \
dest=arch/arm/mach-rk3399/include/mach; \
else \
dest=arch/arm/include/asm/arch-rk3399; \fi; \
ln -fsn /home/qschulz/work/upstream/u-boot/$dest include/asm/arch
set -e; mkdir -p include/; trap "rm -f include/.config.h.tmp" EXIT; { (echo "/* Automatically generated - do not edit */"; echo \#define CFG_BOARDDIR board/theobroma-systems/puma_rk3399; echo \#include \<configs/"puma_rk3399".h\> ; echo \#include \<asm/config.h\>; echo \#include \<linux/kconfig.h\>; echo \#include \<config_fallbacks.h\>;); } > include/.config.h.tmp; if [ ! -r include/config.h ] || ! cmp -s include/config.h include/.config.h.tmp; then : ' UPD include/config.h'; mv -f include/.config.h.tmp include/config.h; fi
aarch64-linux-gnu-gcc -E -Wall -Werror=strict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu11 -ffreestanding -fno-builtin -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -Wno-address-of-packed-member -Os -fno-stack-protector -fno-delete-null-pointer-checks -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=/home/qschulz/work/upstream/u-boot/= -gdwarf-4 -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -mno-global-merge -Wno-pointer-sign -D__KERNEL__ -D__UBOOT__ -Qunused-arguments -D__ARM__ -ffunction-sections -fdata-sections -fno-common -ffixed-x18 -pipe -Iinclude -I/home/qschulz/work/upstream/u-boot/include -I/home/qschulz/work/upstream/u-boot/arch/arm/include -include /home/qschulz/work/upstream/u-boot/include/linux/kconfig.h -nostdinc -isystem /usr/lib/gcc/aarch64-linux-gnu/15/include -DDO_DEPS_ONLY -dM include/config.h > u-boot.cfg.tmp && { grep 'define CONFIG_' u-boot.cfg.tmp | sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_IF_ENABLED_INT(/d;/define CONFIG_VAL(/d;' > u-boot.cfg; rm u-boot.cfg.tmp; } || { rm u-boot.cfg.tmp; false; }
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-mno-global-merge’; did you mean ‘-Wno-global-module’?
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-Qunused-arguments’
make[2]: *** [/home/qschulz/work/upstream/u-boot/scripts/Makefile.autoconf:84: u-boot.cfg] Error 1
make[1]: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'. Stop.
make: *** [Makefile:189: __sub-make] Error 2
If I do nothing but call
make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma V=1
again, it'll work just fine and compile with GCC flags with the GCC toolchain (well, I don't get an error anymore, so I'm assumign that what's happening :) ). So it seems to me that the symbols as used in Makefile depend on the previous make command generating the .config and syncconfig is running "too late".
Contrary to what I initially thought, it's not actually related to U-Boot host tools.
I'm not attempting to mix GCC and clang for host/target building, and I don't know if this would work in any case. I don't know if this is something we want to support anyway. As for what the Linux kernel does, they document[1] LLVM/clang support by telling the user to essentially use LLVM=1 which they claim is an alias to:
CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \
OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump READELF=llvm-readelf \
HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar HOSTLD=ld.lld
They don't really hint at CC and HOSTCC being different as being an option. Maybe it works, maybe it doesn't?
I did test in the Linux kernel whether they had the same issue but it doesn't seem like it is the case.
[1] https://www.kernel.org/doc/html/latest/kbuild/llvm.html
Hope this helps,
Cheers,
Quentin
Quoted 504 lines · Quentin Schulz
Hi Tom,
Quoted 72 lines · Tom Rini
Quoted 71 lines · Quentin Schulz
Hi Tom,
Quoted 1 line · Tom Rini
On Mon, May 04, 2026 at 03:20:27PM +0200, Quentin Schulz wrote:
[...]
Quoted 21 lines
Quoted 21 lines
The first two patches are for fixing pytest calling make directly on a "dirty" build directory as generated by buildman using the clang-20 toolchain, but pytest does not set HOSTCC and CC to clang-20, resulting in clang flags being used with gcc).
One can simply reproduce it (after backporting up to patch "
scripts/Makefile.extrawarn: sync with 6.1") by doing so in the container:make HOSTCC=clang-20 CC=clang-20 O=build/sandbox
sandbox_defconfigmake HOSTCC=clang-20 CC=clang-20 O=build/sandbox -j`nproc make O=build/sandbox u-boot-initial-envIt'll print:
gcc: error: unrecognized command-line option '-mno-global-merge'
gcc: error: unrecognized command-line option '-Wformat-invalid-specifier'
gcc: error: unrecognized command-line option '-Qunused-arguments'This is essentially what's run within
test_env_initial_env_fileintest/py/tests/test_env.py.Quoted 8 lines
Quoted 3 lines
While I'm not unhappy with the patches to pytest, it feels to me we may be missing something else for the u-boot-initial-env make target to update the kconfig symbol based on the toolchain being used when called.
Is there some other target in the
Makefilethat should catch this kind of change? It's not just that build target that needs to be remade, it's everything, yes?For the reproducer, one actually needs to do
Makefile +3
-3@@ -1007,15 +1007,15 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ifdef CONFIG_CC_IS_CLANG -KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) -KBUILD_CFLAGS += $(call cc-disable-warning, gnu) +KBUILD_CPPFLAGS += -Qunused-arguments +KBUILD_CFLAGS += -Wno-format-invalid-specifier +KBUILD_CFLAGS += -Wno-gnu # Quiet clang warning: comparison of unsigned expression < 0 is alwaysfalse
Makefile +1
-1-KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) +KBUILD_CFLAGS += -Wno-tautological-compare # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, asthe
# source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2Makefile +1
-1-KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += -mno-global-merge else # These warnings generated too much noise in a regular build.Which is what's being done since kernel commit
a1494304346a("kbuild: add all Clang-specific flags unconditionally"). I actually had this in an earlier version of this patch series and forgot I removed it.Quoted 12 lines
Quoted 6 lines
This seems to apply to envtools and tools-only as well, though make prompts me for the desired state of symbols that are now reachable, e.g.
ARM64_CRC32. And if I rerun the same command, then it works. It seems like the config from the previous run is used? I don't know if it's related but those two commands call make directly ($(Q)$(MAKE) $(build)=<path>). Do you have something in mind maybe? Or some more commands to run?I think I partly misunderstood at first. It's not that we switch from one toolchain to another, it's that we can't (as easily) use gcc for the target and clang for host tools (and vice-versa) because of how flags are set now, yes? If so, how does this work in the kernel?
I'm not sure what's happening so it's quite difficult to put into words.
Apply the following to the master branch:
Makefile +3
-3@@ -999,15 +999,15 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ifdef CONFIG_CC_IS_CLANG -KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) -KBUILD_CFLAGS += $(call cc-disable-warning, gnu) +KBUILD_CPPFLAGS += -Qunused-arguments +KBUILD_CFLAGS += -Wno-format-invalid-specifier +KBUILD_CFLAGS += -Wno-gnu # Quiet clang warning: comparison of unsigned expression < 0 is alwaysfalse
Makefile +1
-1-KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) +KBUILD_CFLAGS += -Wno-tautological-compare # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, asthe
# source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2Makefile +1
-1-KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += -mno-global-merge KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) elseWhat I do:
make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma HOSTCC=clang CC=clang puma-rk3399_defconfig
make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma HOSTCC=clang CC=clang V=1
make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma V=1That is, I configure the defconfig with clang selected as toolchain, (successfully) build U-Boot with clang, then rebuild switching to gcc.
What happens is that the last make command prompts me for
Kconfigsymbols that are now reachable and thus kconfig doesn't know what to do with them.See the (NEW) entries below:
scripts/kconfig/conf--syncconfigKconfig
*
* Restart config...
*
*
* ARM architecture
*
Enable support for CRC32 instruction (ARM64_CRC32) [Y/n/?] (NEW)Timer clock frequency (
COUNTER_FREQUENCY) [24000000] 24000000 Generate position-independent pre-relocation code (POSITION_INDEPENDENT) [N/y/?] n
Specify the early stack pointer relative to the .bss section (INIT_SP_RELATIVE) [N/y/?] n
Emit virtualizable instructions (KVM_VIRT_INS) [N/y/?] n
ARM GICV2 driver (DRIVER_GICV2) [N/y/?] n
ARM GICV3 ITS (GIC_V3_ITS) [N/y/?] n
ARM GICV3 GIC600 SUPPORT (GICV3_SUPPORT_GIC600) [N/y/?] n
Do not enable icache (SYS_ICACHE_OFF) [N/y/?] n
Do not enable icache in SPL (SPL_SYS_ICACHE_OFF) [N/y/?] n Do not enable dcache (SYS_DCACHE_OFF) [N/y/?] n
Do not enable dcache in SPL (SPL_SYS_DCACHE_OFF) [N/y/?] n CP15 based cache enabling support (SYS_ARM_CACHE_CP15) [N/y/?] n MMU-based Paged Memory Management Support (SYS_ARM_MMU) [N/y/?] n Use the ARM v7 PMSA Compliant MPU (SYS_ARM_MPU) [N/y/?] n Select the ARM data write cache policyQuoted 1 line
1. Write-back (WB) (
SYS_ARM_CACHE_WRITEBACK)2. Write-through (WT) (
SYS_ARM_CACHE_WRITETHROUGH)
3. Write allocation (WA) (SYS_ARM_CACHE_WRITEALLOC)
choice[1-3?]: 1
EnableARCH_CPU_INIT(ARCH_CPU_INIT) [N/y/?] n
ARM Generic Timer support (SYS_ARCH_TIMER) [Y/n/?] y
Support for ARM SMC Calling Convention (SMCCC) (ARM_SMCCC) [Y/?] y ARM PL310 L2 cache controller (SYS_L2_PL310) [N/y/?] n
ARM PL310 L2 cache controller in SPL (SPL_SYS_L2_PL310) [N/y/?] n L2cache off (SYS_L2CACHE_OFF) [N/y/?] n
prepare BOOT0 header (ENABLE_ARM_SOC_BOOT0_HOOK) [Y/?] y
Use an assembly optimized implementation of memcpy (USE_ARCH_MEMCPY) [N/y/?] (NEW)Use an assembly optimized implementation of memcpy for SPL (
SPL_USE_ARCH_MEMCPY) [N/y/?] n
Use an assembly optimized implementation of memcpy for TPL (TPL_USE_ARCH_MEMCPY) [N/y/?] n
Use an assembly optimized implementation of memset (USE_ARCH_MEMSET) [N/y/?] (NEW)Use an assembly optimized implementation of memset for SPL (
SPL_USE_ARCH_MEMSET) [N/y/?] n
Use an assembly optimized implementation of memset for TPL (TPL_USE_ARCH_MEMSET) [N/y/?] n
ARM64 system support AArch32 execution state (ARM64_SUPPORT_AARCH32) [Y/n/?] y
Target select
1. Airoha SoCs (ARCH_AIROHA)
2. Atmel AT91 (ARCH_AT91)
3. TI DaVinci (ARCH_DAVINCI)
4. Hisilicon HiSTB SoCs (ARCH_HISTB)
5. Marvell Kirkwood (ARCH_KIRKWOOD)
6. Marvell MVEBU family (Armada XP/375/38x/3700/7K/8K) (ARCH_MVEBU)
7. Broadcom BCM283X family (ARCH_BCM283X)
8. Broadcom BCM7XXX family (ARCH_BCMSTB)
9. Broadcom broadband chip family (ARCH_BCMBCA)
10. Supportvexpress_ca9x4(TARGET_VEXPRESS_CA9X4)
11. Support Broadcom Northstar (TARGET_BCMNS)
12. Support Broadcom NS3 (TARGET_BCMNS3)
13. Samsung EXYNOS (ARCH_EXYNOS)
14. Samsung S5PC1XX (ARCH_S5PC1XX)
15. Calxeda Highbank (ARCH_HIGHBANK)
16. ARM Ltd. Integrator family (ARCH_INTEGRATOR)
17. Qualcomm IPQ40xx SoCs (ARCH_IPQ40XX)
18. TI Keystone (ARCH_KEYSTONE)
19. Texas Instruments' K3 Architecture (ARCH_K3)
20. TI OMAP2+ (ARCH_OMAP2PLUS)
21. Amlogic Meson (ARCH_MESON)
22. MediaTek SoCs (ARCH_MEDIATEK)
23. Marvell MMP (ARCH_MMP)
24. NXP LPC32xx platform (ARCH_LPC32XX)
25. NXP i.MX8 platform (ARCH_IMX8)
26. NXP i.MX8M platform (ARCH_IMX8M)
27. NXP i.MX8ULP platform (ARCH_IMX8ULP)
28. NXP i.MX9 platform (ARCH_IMX9)
29. NXP i.MXRT platform (ARCH_IMXRT)
30. NXP i.MX23 family (ARCH_MX23)
31. NXP i.MX28 family (ARCH_MX28)
32. NXP MX7ULP (ARCH_MX7ULP)
33. Freescale MX7 (ARCH_MX7)
34. Freescale MX6 (ARCH_MX6)
35. Freescale MX5 (ARCH_MX5)
36. Nexell S5P4418/S5P6818 SoC (ARCH_NEXELL)
37. Support Nuvoton SoCs (ARCH_NPCM)
38. Apple SoCs (ARCH_APPLE)
39. Actions Semi OWL SoCs (ARCH_OWL)
40. QEMU Virtual Platform (ARCH_QEMU)
41. Renesas ARM SoCs (ARCH_RENESAS)
42. Qualcomm Snapdragon SoCs (ARCH_SNAPDRAGON)
43. Altera SOCFPGA family (ARCH_SOCFPGA)
44. Support sunxi (Allwinner) SoCs (ARCH_SUNXI)
45. ST-Ericsson U8500 Series (ARCH_U8500)
46. Support Xilinx Versal Platform (ARCH_VERSAL)
47. Support AMD Versal Gen 2 Platform (ARCH_VERSAL2)
48. Support Xilinx Versal NET Platform (ARCH_VERSAL_NET)
49. Freescale Vybrid (ARCH_VF610)
50. Xilinx Zynq based platform (ARCH_ZYNQ)
51. Xilinx ZynqMP R5 based platform (ARCH_ZYNQMP_R5)
52. Xilinx ZynqMP based platform (ARCH_ZYNQMP)
53. NVIDIA Tegra (ARCH_TEGRA)
54. Support ARMv8 Arm Ltd. VExpress based boards and models
(ARCH_VEXPRESS64)
55. Support Corstone1000 Platform (TARGET_CORSTONE1000)
56. Support Total Compute Platform (TARGET_TOTAL_COMPUTE)
57. Supportls2080a_emu(TARGET_LS2080A_EMU)
58. Support ls1088aqds (TARGET_LS1088AQDS)
59. Support ls2080aqds (TARGET_LS2080AQDS)
60. Support ls2080ardb (TARGET_LS2080ARDB)
61. Support ls2081ardb (TARGET_LS2081ARDB)
62. Support lx2160ardb (TARGET_LX2160ARDB)
63. Support lx2160aqds (TARGET_LX2160AQDS)
64. Support lx2162aqds (TARGET_LX2162AQDS)
65. Support HiKey 96boards Consumer Edition Platform (TARGET_HIKEY)
66. Support HiKey960 96boards Consumer Edition Platform (TARGET_HIKEY960)
67. Support Poplar 96boards Enterprise Edition Platform (TARGET_POPLAR)
68. Support ls1012aqds (TARGET_LS1012AQDS)
69. Support ls1012ardb (TARGET_LS1012ARDB)
70. Support ls1012a2g5rdb (TARGET_LS1012A2G5RDB)
71. Support ls1012afrwy (TARGET_LS1012AFRWY)
72. Support ls1012afrdm (TARGET_LS1012AFRDM)
73. Support ls1028aqds (TARGET_LS1028AQDS)
74. Support ls1028ardb (TARGET_LS1028ARDB)
75. Support ls1088ardb (TARGET_LS1088ARDB)
76. Support ls1021aqds (TARGET_LS1021AQDS)
77. Support ls1021atwr (TARGET_LS1021ATWR)
78. Support Hitachi-Powergrids SELI8 service unit card
(TARGET_PG_WCOM_SELI8)
79. Support Hitachi-Powergrids EXPU1 service unit card
(TARGET_PG_WCOM_EXPU1)
80. Support ls1021atsn (TARGET_LS1021ATSN)
81. Support ls1021aiot (TARGET_LS1021AIOT)
82. Support ls1043aqds (TARGET_LS1043AQDS)
83. Support ls1043ardb (TARGET_LS1043ARDB)
84. Support ls1046aqds (TARGET_LS1046AQDS)
85. Support ls1046ardb (TARGET_LS1046ARDB)
86. Support ls1046afrwy (TARGET_LS1046AFRWY)
87. Analog Devices SC5XX-processor family (ARCH_SC5XX)
88. Support sl28 (TARGET_SL28)
89. Support ten64 (TARGET_TEN64)
90. Socionext UniPhier SoCs (ARCH_UNIPHIER)
91. Socionext SynQuacer SoCs (ARCH_SYNQUACER)
92. Support STMicroelectronics STM32 MCU with cortex M (ARCH_STM32)
93. Support STMicroelectronics SoCs (ARCH_STI)
94. Support STMicroelectronics STM32MP Socs with cortex A (ARCH_STM32MP)Quoted 1 line
95. Support Rockchip SoCs (
ARCH_ROCKCHIP)96. Support OcteonTX SoCs (
ARCH_OCTEONTX)
97. Support OcteonTX2 SoCs (ARCH_OCTEONTX2)
98. Support ThunderX 88xx (TARGET_THUNDERX_88XX)
99. Support Aspeed SoCs (ARCH_ASPEED)
100. Support Phytium Durian Platform (TARGET_DURIAN)
101. Support Phytium Pomelo Platform (TARGET_POMELO)
102. Support Phytium PE2201 Platform (TARGET_PE2201)
103. Support Cortina Presidio ASIC Platform (TARGET_PRESIDIO_ASIC)
104. Xen guest ARM64 (TARGET_XENGUEST_ARM64)
105. Support HPE GXP SoCs (ARCH_GXP)
choice[1-105?]: 95
Support Rockchip PX30 (ROCKCHIP_PX30) [N/y/?] n
Support Rockchip RK3036 (ROCKCHIP_RK3036) [N/y/?] n
Support Rockchip RK3066 (ROCKCHIP_RK3066) [N/y/?] n
Support Rockchip RK3128 (ROCKCHIP_RK3128) [N/y/?] n
Support Rockchip RK3188 (ROCKCHIP_RK3188) [N/y/?] n
Support Rockchip RK3228/RK3229 (ROCKCHIP_RK322X) [N/y/?] n Support Rockchip RK3288 (ROCKCHIP_RK3288) [N/y/?] n
Support Rockchip RK3308 (ROCKCHIP_RK3308) [N/y/?] n
Support Rockchip RK3328 (ROCKCHIP_RK3328) [N/y/?] n
Support Rockchip RK3368 (ROCKCHIP_RK3368) [N/y/?] n
Support Rockchip RK3399 (ROCKCHIP_RK3399) [Y/n/?] y
Support Rockchip RK3506 (ROCKCHIP_RK3506) [N/y/?] n
Support Rockchip RK3528 (ROCKCHIP_RK3528) [N/y/?] n
Support Rockchip RK3568 (ROCKCHIP_RK3568) [N/y/?] n
Support Rockchip RK3576 (ROCKCHIP_RK3576) [N/y/?] n
Support Rockchip RK3588 (ROCKCHIP_RK3588) [N/y/?] n
Support Rockchip RV1108 (ROCKCHIP_RV1108) [N/y/?] n
Support Rockchip RV1126 (ROCKCHIP_RV1126) [N/y/?] n
Route uart output to usb pins (ROCKCHIP_USB_UART) [N/y/?] n
SPL returns to bootrom (SPL_ROCKCHIP_BACK_TO_BROM) [N/y/?] n TPL returns to bootrom (TPL_ROCKCHIP_BACK_TO_BROM) [Y/n/?] y Rockchip common board file (ROCKCHIP_COMMON_BOARD) [Y/n/?] y Rockchip SPL common board file (SPL_ROCKCHIP_COMMON_BOARD) [Y/n/?] y Rockchip TPL common board file (TPL_ROCKCHIP_COMMON_BOARD) [Y/n/?] y Use external TPL binary (ROCKCHIP_EXTERNAL_TPL) [N/y/?] n Rockchip boot mode flag register address (ROCKCHIP_BOOT_MODE_REG) [0x0]0x0Disable device boot on power plug-in (ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON) [N/y/?] n
Rockchip STIMER support (ROCKCHIP_STIMER) [Y/n/?] y
Size of IRAM reserved in SPL (ROCKCHIP_SPL_RESERVE_IRAM) [0x0]0x0SPL requires early-return (for RK3188-style BROM) to BROM (SPL_ROCKCHIP_EARLYRETURN_TO_BROM) [N/y/?] n
Disableforce_jtagfeature (ROCKCHIP_DISABLE_FORCE_JTAG) [Y/n/?] y TPL requires early-return (for RK3188-style BROM) to BROM (TPL_ROCKCHIP_EARLYRETURN_TO_BROM) [N/y/?] n
Build a SPI image for rockchip (ROCKCHIP_SPI_IMAGE) [Y/n/?] y Build a maskrom mode image for Rockchip (ROCKCHIP_MASKROM_IMAGE) [N/y/?] n RK3399 board select
1. Asus Flip C101PA Chromebook (RK3399) (TARGET_CHROMEBOOK_BOB)
2. Samsung Chromebook Plus (RK3399) (TARGET_CHROMEBOOK_KEVIN)
3. RK3399 evaluation board (TARGET_EVB_RK3399)
4. Pinebook Pro (TARGET_PINEBOOK_PRO_RK3399)
5. PinePhone Pro (TARGET_PINEPHONE_PRO_RK3399)Quoted 1 line
6. Theobroma Systems RK3399-Q7 (Puma) (
TARGET_PUMA_RK3399)7. Vamrs Limited Rock960 board family (
TARGET_ROCK960_RK3399)
8. Radxa ROCK Pi 4 board (TARGET_ROCKPI4_RK3399)
9. Pine64 Rockpro64 board (TARGET_ROCKPRO64_RK3399)
10. Firefly ROC-RK3399-PC board (TARGET_ROC_PC_RK3399)
choice[1-10?]: 6
Theobroma Systems RK3399-Q7 DDR OptionQuoted 1 line
1. DDR3-1333MHz (
TARGET_PUMA_RK3399_RAM_DDR3_1333)2. DDR3-1600MHz (
TARGET_PUMA_RK3399_RAM_DDR3_1600)
3. DDR3-1866MHz (TARGET_PUMA_RK3399_RAM_DDR3_1866)
choice[1-3?]: 1
Force cache maintenance to be exclusively by VA (CMO_BY_VA_ONLY) [N/y/?] n Fix broken ARMv8 generic timer (ARMV8_CNTFRQ_BROKEN) [N/y/?] n Install crash dump exception vectors (ARMV8_SPL_EXCEPTION_VECTORS) [N/y/?] n Enable multiple CPUs to enter into U-Boot (ARMV8_MULTIENTRY) [N/y/?] n Enable data coherency with other cores in cluster (ARMV8_SET_SMPEN) [Y/n/?] y
Enable switching to running in EL1 (ARMV8_SWITCH_TO_EL1) [N/y/?] n Use PSCI for reset and shutdown (PSCI_RESET) [Y/n/?] y
Enable PSCI support (ARMV8_PSCI) [N/y/?] n
External aborts and SError interrupt exception are taken in EL3 (ARMV8_EA_EL3_FIRST) [N/y/?] n
Use the event stream for udelay (ARMV8_UDELAY_EVENT_STREAM) [N/y/?] n *
* General setup
*
Compile also drivers which will not load (COMPILE_TEST) [N/y/?] n Compile U-Boot with warnings as errors (WERROR) [N/y/?] n
Local version - append to U-Boot release (LOCALVERSION) [] Automatically append version information to the version string (LOCALVERSION_AUTO) [Y/n/?] y
Optimization levelQuoted 1 line
1. Optimize for size (
CC_OPTIMIZE_FOR_SIZE)2. Optimize for speed (
CC_OPTIMIZE_FOR_SPEED)
3. Optimize for debugging (CC_OPTIMIZE_FOR_DEBUG)
choice[1-3?]: 1
Allow compiler to uninline functions marked 'inline' in full U-Boot (OPTIMIZE_INLINING) [N/y/?] n
Allow compiler to uninline functions marked 'inline' in SPL (SPL_OPTIMIZE_INLINING) [N/y/?] n
Allow compiler to uninline functions marked 'inline' in TPL (TPL_OPTIMIZE_INLINING) [N/y/?] n
Enable Link Time Optimizations (LTO) [N/y/?] n
Select U-Boot be run as a bootloader for XEN Virtual Machine (XEN) [N/y/?] n Add arch, board, vendor and soc variables to default environment (ENV_VARS_UBOOT_CONFIG) [Y/?] y
Number of DRAM banks (NR_DRAM_BANKS) [1] 1
Enable kernel command line setup (SYS_BOOT_GET_CMDLINE) [N/y/?] n Enable kernel board information setup (SYS_BOOT_GET_KBD) [N/y/?] n Use a custom location for the initial stack pointer address (HAS_CUSTOM_SYS_INIT_SP_ADDR) [Y/?] y
Static location for the initial stack pointer (CUSTOM_SYS_INIT_SP_ADDR)
[0x03f00000]0x03f00000
Enablemalloc()pool before relocation (SYS_MALLOC_F) [Y/?] y
Size ofmalloc()pool before relocation (SYS_MALLOC_F_LEN) [0x10000]0x10000
Define memory for Dynamic allocation (SYS_MALLOC_LEN) [0x2000000]0x2000000Enablemalloc()pool in SPL (SPL_SYS_MALLOC_F) [Y/n/?] y
Size ofmalloc()pool in SPL (SPL_SYS_MALLOC_F_LEN) [0x8000]0x8000
Enablemalloc()pool in TPL (TPL_SYS_MALLOC_F) [Y/n/?] y
Size ofmalloc()pool in TPL (TPL_SYS_MALLOC_F_LEN) [0x4000]0x4000
Inform valgrind about memory allocations (VALGRIND) [N/y/?] n 64bit physical address support (PHYS_64BIT) [Y/?] y
64bit fdt address support (FDT_64BIT) [Y/?] y
SPL image used in the combined SPL+U-Boot image (SPL_IMAGE) [spl/u-boot-spl.bin] spl/u-boot-spl.bin
Recreate an ELF image from raw U-Boot binary (REMAKE_ELF) [N/y/?] n Build target special images (BUILD_TARGET) []
Define a maximum size for the U-Boot image (HAS_BOARD_SIZE_LIMIT) [N/y/?] n Use a custom location for the U-Boot linker script (SYS_CUSTOM_LDSCRIPT) [N/y/?] n
Address in memory to use by default (SYS_LOAD_ADDR) [0x800800]0x800800Define max stack size that can be used by U-Boot (STACK_SIZE) [0x1000000]0x1000000
Exclude some memory from U-Boot / OS information (SYS_MEM_TOP_HIDE) [0x0]0x0
Maximum size in bytes reserved for U-Boot in memory (SYS_MONITOR_LEN) [0] 0 Support for multiprocessor (MP) [N/y/?] n
Text Base (TEXT_BASE) [0x00800000]0x00800000
Use custom U-Boot Start (HAVE_SYS_UBOOT_START) [N/y/?] n Determine CPU clock frequency at run-time (DYNAMIC_SYS_CLK_FREQ) [N/y/?] n CPU clock frequency (SYS_CLK_FREQ) [0] 0
Enable U-Boot API (API) [N/y/?] (NEW)Then it continues with the build, but using the flags for clang while using GCC, see:
make -f /home/qschulz/work/upstream/u-boot/scripts/Makefile.autoconf || \ { rm -f include/config/auto.conf; false; } mkdir -p include/asm if [ -d /home/qschulz/work/upstream/u-boot/arch/arm/mach-rk3399/include/mach ]; then \ dest=arch/arm/mach-rk3399/include/mach; \ else \ dest=arch/arm/include/asm/arch-rk3399; \fi; \
ln -fsn/home/qschulz/work/upstream/u-boot/$destinclude/asm/archset -e; mkdir -pinclude/; trap "rm -finclude/.config.h.tmp" EXIT; { (echo "/* Automatically generated - do not edit */"; echo \#defineCFG_BOARDDIRboard/theobroma-systems/puma_rk3399; echo \#include \<configs/"puma_rk3399".h\> ; echo \#include \<asm/config.h\>; echo \#include \<linux/kconfig.h\>; echo \#include \<config_fallbacks.h\>;); } >include/.config.h.tmp; if [ ! -rinclude/config.h] || ! cmp -sinclude/config.hinclude/.config.h.tmp; then : ' UPDinclude/config.h'; mvMakefile +0
-17-f include/.config.h.tmp include/config.h; fi aarch64-linux-gnu-gcc -E -Wall -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu11 -ffreestanding -fno-builtin -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -Wno-address-of-packed-member -Os -fno-stack-protector -fno-delete-null-pointer-checks -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=/home/qschulz/work/upstream/u-boot/= -gdwarf-4 -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -mno-global-merge -Wno-pointer-sign -D__KERNEL__ -D__UBOOT__ -Qunused-arguments -D__ARM__ -ffunction-sections -fdata-sections -fno-common -ffixed-x18 -pipe -Iinclude -I/home/qschulz/work/upstream/u-boot/include -I/home/qschulz/work/upstream/u-boot/arch/arm/include -include
/home/qschulz/work/upstream/u-boot/include/linux/kconfig.h-nostdinc -isystem/usr/lib/gcc/aarch64-linux-gnu/15/include-DDO_DEPS_ONLY -dMinclude/config.h> u-boot.cfg.tmp && { grep 'defineCONFIG_' u-boot.cfg.tmp | sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_IF_ENABLED_INT(/d;/define CONFIG_VAL(/d;' > u-boot.cfg; rm u-boot.cfg.tmp; } || { rm u-boot.cfg.tmp; false; }
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-mno-global-merge’; did you mean ‘-Wno-global-module’?
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-Qunused-arguments’
make[2]: *** [/home/qschulz/work/upstream/u-boot/scripts/Makefile.autoconf:84:
u-boot.cfg] Error 1
make[1]: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'. Stop.
make: *** [Makefile:189: __sub-make] Error 2If I do nothing but call
make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma V=1
again, it'll work just fine and compile with GCC flags with the GCC toolchain (well, I don't get an error anymore, so I'm assumign that what's happening :) ). So it seems to me that the symbols as used inMakefiledepend on the previous make command generating the .config and syncconfig is running "too late".Contrary to what I initially thought, it's not actually related to U-Boot host tools.
I'm not attempting to mix GCC and clang for host/target building, and I don't know if this would work in any case. I don't know if this is something we want to support anyway. As for what the Linux kernel does, they document[1] LLVM/clang support by telling the user to essentially use LLVM=1 which they claim is an alias to:
CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \
OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump READELF=llvm-readelf \
HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar HOSTLD=ld.lld
Quoted 7 lines
They don't really hint at CC and HOSTCC being different as being an option. Maybe it works, maybe it doesn't?
I did test in the Linux kernel whether they had the same issue but it doesn't seem like it is the case.
Ah, thanks. I'm tempted to say this is something that'll just not work until we can also switch to following the kernel way of invoking clang? But maybe it's a problem missing dependencies somewhere (not leading to some cmd file being recreated in time), rather than more missing changes.
Signature · 1 line
Tom
Hi Tom, Quentin,
Quoted 512 lines · Tom Rini
Quoted 510 lines · Quentin Schulz
Hi Tom,
Quoted 72 lines · Tom Rini
Quoted 71 lines · Quentin Schulz
Hi Tom,
Quoted 1 line · Tom Rini
On Mon, May 04, 2026 at 03:20:27PM +0200, Quentin Schulz wrote:
[...]
Quoted 21 lines
Quoted 21 lines
The first two patches are for fixing pytest calling make directly on a "dirty" build directory as generated by buildman using the clang-20 toolchain, but pytest does not set HOSTCC and CC to clang-20, resulting in clang flags being used with gcc).
One can simply reproduce it (after backporting up to patch "
scripts/Makefile.extrawarn: sync with 6.1") by doing so in the container:make HOSTCC=clang-20 CC=clang-20 O=build/sandbox
sandbox_defconfigmake HOSTCC=clang-20 CC=clang-20 O=build/sandbox -j`nproc make O=build/sandbox u-boot-initial-envIt'll print:
gcc: error: unrecognized command-line option '-mno-global-merge'
gcc: error: unrecognized command-line option '-Wformat-invalid-specifier'
gcc: error: unrecognized command-line option '-Qunused-arguments'This is essentially what's run within
test_env_initial_env_fileintest/py/tests/test_env.py.Quoted 8 lines
Quoted 3 lines
While I'm not unhappy with the patches to pytest, it feels to me we may be missing something else for the u-boot-initial-env make target to update the kconfig symbol based on the toolchain being used when called.
Is there some other target in the
Makefilethat should catch this kind of change? It's not just that build target that needs to be remade, it's everything, yes?For the reproducer, one actually needs to do
Makefile +3
-3@@ -1007,15 +1007,15 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ifdef CONFIG_CC_IS_CLANG -KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) -KBUILD_CFLAGS += $(call cc-disable-warning, gnu) +KBUILD_CPPFLAGS += -Qunused-arguments +KBUILD_CFLAGS += -Wno-format-invalid-specifier +KBUILD_CFLAGS += -Wno-gnu # Quiet clang warning: comparison of unsigned expression < 0 is alwaysfalse
Makefile +1
-1-KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) +KBUILD_CFLAGS += -Wno-tautological-compare # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, asthe
# source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2Makefile +1
-1-KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += -mno-global-merge else # These warnings generated too much noise in a regular build.Which is what's being done since kernel commit
a1494304346a("kbuild: add all Clang-specific flags unconditionally"). I actually had this in an earlier version of this patch series and forgot I removed it.Quoted 12 lines
Quoted 6 lines
This seems to apply to envtools and tools-only as well, though make prompts me for the desired state of symbols that are now reachable, e.g.
ARM64_CRC32. And if I rerun the same command, then it works. It seems like the config from the previous run is used? I don't know if it's related but those two commands call make directly ($(Q)$(MAKE) $(build)=<path>). Do you have something in mind maybe? Or some more commands to run?I think I partly misunderstood at first. It's not that we switch from one toolchain to another, it's that we can't (as easily) use gcc for the target and clang for host tools (and vice-versa) because of how flags are set now, yes? If so, how does this work in the kernel?
I'm not sure what's happening so it's quite difficult to put into words.
Apply the following to the master branch:
Makefile +3
-3@@ -999,15 +999,15 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) ifdef CONFIG_CC_IS_CLANG -KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) -KBUILD_CFLAGS += $(call cc-disable-warning, gnu) +KBUILD_CPPFLAGS += -Qunused-arguments +KBUILD_CFLAGS += -Wno-format-invalid-specifier +KBUILD_CFLAGS += -Wno-gnu # Quiet clang warning: comparison of unsigned expression < 0 is alwaysfalse
Makefile +1
-1-KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) +KBUILD_CFLAGS += -Wno-tautological-compare # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, asthe
# source of a reference will be _MergedGlobals and not on of the whitelisted names. # See modpost pattern 2Makefile +1
-1-KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) +KBUILD_CFLAGS += -mno-global-merge KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) elseWhat I do:
make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma HOSTCC=clang CC=clang puma-rk3399_defconfig
make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma HOSTCC=clang CC=clang V=1
make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma V=1That is, I configure the defconfig with clang selected as toolchain, (successfully) build U-Boot with clang, then rebuild switching to gcc.
What happens is that the last make command prompts me for
Kconfigsymbols that are now reachable and thus kconfig doesn't know what to do with them.See the (NEW) entries below:
scripts/kconfig/conf--syncconfigKconfig
*
* Restart config...
*
*
* ARM architecture
*
Enable support for CRC32 instruction (ARM64_CRC32) [Y/n/?] (NEW)Timer clock frequency (
COUNTER_FREQUENCY) [24000000] 24000000 Generate position-independent pre-relocation code (POSITION_INDEPENDENT) [N/y/?] n
Specify the early stack pointer relative to the .bss section (INIT_SP_RELATIVE) [N/y/?] n
Emit virtualizable instructions (KVM_VIRT_INS) [N/y/?] n
ARM GICV2 driver (DRIVER_GICV2) [N/y/?] n
ARM GICV3 ITS (GIC_V3_ITS) [N/y/?] n
ARM GICV3 GIC600 SUPPORT (GICV3_SUPPORT_GIC600) [N/y/?] n
Do not enable icache (SYS_ICACHE_OFF) [N/y/?] n
Do not enable icache in SPL (SPL_SYS_ICACHE_OFF) [N/y/?] n Do not enable dcache (SYS_DCACHE_OFF) [N/y/?] n
Do not enable dcache in SPL (SPL_SYS_DCACHE_OFF) [N/y/?] n CP15 based cache enabling support (SYS_ARM_CACHE_CP15) [N/y/?] n MMU-based Paged Memory Management Support (SYS_ARM_MMU) [N/y/?] n Use the ARM v7 PMSA Compliant MPU (SYS_ARM_MPU) [N/y/?] n Select the ARM data write cache policyQuoted 1 line
1. Write-back (WB) (
SYS_ARM_CACHE_WRITEBACK)2. Write-through (WT) (
SYS_ARM_CACHE_WRITETHROUGH)
3. Write allocation (WA) (SYS_ARM_CACHE_WRITEALLOC)
choice[1-3?]: 1
EnableARCH_CPU_INIT(ARCH_CPU_INIT) [N/y/?] n
ARM Generic Timer support (SYS_ARCH_TIMER) [Y/n/?] y
Support for ARM SMC Calling Convention (SMCCC) (ARM_SMCCC) [Y/?] y ARM PL310 L2 cache controller (SYS_L2_PL310) [N/y/?] n
ARM PL310 L2 cache controller in SPL (SPL_SYS_L2_PL310) [N/y/?] n L2cache off (SYS_L2CACHE_OFF) [N/y/?] n
prepare BOOT0 header (ENABLE_ARM_SOC_BOOT0_HOOK) [Y/?] y
Use an assembly optimized implementation of memcpy (USE_ARCH_MEMCPY) [N/y/?] (NEW)Use an assembly optimized implementation of memcpy for SPL (
SPL_USE_ARCH_MEMCPY) [N/y/?] n
Use an assembly optimized implementation of memcpy for TPL (TPL_USE_ARCH_MEMCPY) [N/y/?] n
Use an assembly optimized implementation of memset (USE_ARCH_MEMSET) [N/y/?] (NEW)Use an assembly optimized implementation of memset for SPL (
SPL_USE_ARCH_MEMSET) [N/y/?] n
Use an assembly optimized implementation of memset for TPL (TPL_USE_ARCH_MEMSET) [N/y/?] n
ARM64 system support AArch32 execution state (ARM64_SUPPORT_AARCH32) [Y/n/?] y
Target select
1. Airoha SoCs (ARCH_AIROHA)
2. Atmel AT91 (ARCH_AT91)
3. TI DaVinci (ARCH_DAVINCI)
4. Hisilicon HiSTB SoCs (ARCH_HISTB)
5. Marvell Kirkwood (ARCH_KIRKWOOD)
6. Marvell MVEBU family (Armada XP/375/38x/3700/7K/8K) (ARCH_MVEBU)
7. Broadcom BCM283X family (ARCH_BCM283X)
8. Broadcom BCM7XXX family (ARCH_BCMSTB)
9. Broadcom broadband chip family (ARCH_BCMBCA)
10. Supportvexpress_ca9x4(TARGET_VEXPRESS_CA9X4)
11. Support Broadcom Northstar (TARGET_BCMNS)
12. Support Broadcom NS3 (TARGET_BCMNS3)
13. Samsung EXYNOS (ARCH_EXYNOS)
14. Samsung S5PC1XX (ARCH_S5PC1XX)
15. Calxeda Highbank (ARCH_HIGHBANK)
16. ARM Ltd. Integrator family (ARCH_INTEGRATOR)
17. Qualcomm IPQ40xx SoCs (ARCH_IPQ40XX)
18. TI Keystone (ARCH_KEYSTONE)
19. Texas Instruments' K3 Architecture (ARCH_K3)
20. TI OMAP2+ (ARCH_OMAP2PLUS)
21. Amlogic Meson (ARCH_MESON)
22. MediaTek SoCs (ARCH_MEDIATEK)
23. Marvell MMP (ARCH_MMP)
24. NXP LPC32xx platform (ARCH_LPC32XX)
25. NXP i.MX8 platform (ARCH_IMX8)
26. NXP i.MX8M platform (ARCH_IMX8M)
27. NXP i.MX8ULP platform (ARCH_IMX8ULP)
28. NXP i.MX9 platform (ARCH_IMX9)
29. NXP i.MXRT platform (ARCH_IMXRT)
30. NXP i.MX23 family (ARCH_MX23)
31. NXP i.MX28 family (ARCH_MX28)
32. NXP MX7ULP (ARCH_MX7ULP)
33. Freescale MX7 (ARCH_MX7)
34. Freescale MX6 (ARCH_MX6)
35. Freescale MX5 (ARCH_MX5)
36. Nexell S5P4418/S5P6818 SoC (ARCH_NEXELL)
37. Support Nuvoton SoCs (ARCH_NPCM)
38. Apple SoCs (ARCH_APPLE)
39. Actions Semi OWL SoCs (ARCH_OWL)
40. QEMU Virtual Platform (ARCH_QEMU)
41. Renesas ARM SoCs (ARCH_RENESAS)
42. Qualcomm Snapdragon SoCs (ARCH_SNAPDRAGON)
43. Altera SOCFPGA family (ARCH_SOCFPGA)
44. Support sunxi (Allwinner) SoCs (ARCH_SUNXI)
45. ST-Ericsson U8500 Series (ARCH_U8500)
46. Support Xilinx Versal Platform (ARCH_VERSAL)
47. Support AMD Versal Gen 2 Platform (ARCH_VERSAL2)
48. Support Xilinx Versal NET Platform (ARCH_VERSAL_NET)
49. Freescale Vybrid (ARCH_VF610)
50. Xilinx Zynq based platform (ARCH_ZYNQ)
51. Xilinx ZynqMP R5 based platform (ARCH_ZYNQMP_R5)
52. Xilinx ZynqMP based platform (ARCH_ZYNQMP)
53. NVIDIA Tegra (ARCH_TEGRA)
54. Support ARMv8 Arm Ltd. VExpress based boards and models
(ARCH_VEXPRESS64)
55. Support Corstone1000 Platform (TARGET_CORSTONE1000)
56. Support Total Compute Platform (TARGET_TOTAL_COMPUTE)
57. Supportls2080a_emu(TARGET_LS2080A_EMU)
58. Support ls1088aqds (TARGET_LS1088AQDS)
59. Support ls2080aqds (TARGET_LS2080AQDS)
60. Support ls2080ardb (TARGET_LS2080ARDB)
61. Support ls2081ardb (TARGET_LS2081ARDB)
62. Support lx2160ardb (TARGET_LX2160ARDB)
63. Support lx2160aqds (TARGET_LX2160AQDS)
64. Support lx2162aqds (TARGET_LX2162AQDS)
65. Support HiKey 96boards Consumer Edition Platform (TARGET_HIKEY)
66. Support HiKey960 96boards Consumer Edition Platform (TARGET_HIKEY960)
67. Support Poplar 96boards Enterprise Edition Platform (TARGET_POPLAR)
68. Support ls1012aqds (TARGET_LS1012AQDS)
69. Support ls1012ardb (TARGET_LS1012ARDB)
70. Support ls1012a2g5rdb (TARGET_LS1012A2G5RDB)
71. Support ls1012afrwy (TARGET_LS1012AFRWY)
72. Support ls1012afrdm (TARGET_LS1012AFRDM)
73. Support ls1028aqds (TARGET_LS1028AQDS)
74. Support ls1028ardb (TARGET_LS1028ARDB)
75. Support ls1088ardb (TARGET_LS1088ARDB)
76. Support ls1021aqds (TARGET_LS1021AQDS)
77. Support ls1021atwr (TARGET_LS1021ATWR)
78. Support Hitachi-Powergrids SELI8 service unit card
(TARGET_PG_WCOM_SELI8)
79. Support Hitachi-Powergrids EXPU1 service unit card
(TARGET_PG_WCOM_EXPU1)
80. Support ls1021atsn (TARGET_LS1021ATSN)
81. Support ls1021aiot (TARGET_LS1021AIOT)
82. Support ls1043aqds (TARGET_LS1043AQDS)
83. Support ls1043ardb (TARGET_LS1043ARDB)
84. Support ls1046aqds (TARGET_LS1046AQDS)
85. Support ls1046ardb (TARGET_LS1046ARDB)
86. Support ls1046afrwy (TARGET_LS1046AFRWY)
87. Analog Devices SC5XX-processor family (ARCH_SC5XX)
88. Support sl28 (TARGET_SL28)
89. Support ten64 (TARGET_TEN64)
90. Socionext UniPhier SoCs (ARCH_UNIPHIER)
91. Socionext SynQuacer SoCs (ARCH_SYNQUACER)
92. Support STMicroelectronics STM32 MCU with cortex M (ARCH_STM32)
93. Support STMicroelectronics SoCs (ARCH_STI)
94. Support STMicroelectronics STM32MP Socs with cortex A (ARCH_STM32MP)Quoted 1 line
95. Support Rockchip SoCs (
ARCH_ROCKCHIP)96. Support OcteonTX SoCs (
ARCH_OCTEONTX)
97. Support OcteonTX2 SoCs (ARCH_OCTEONTX2)
98. Support ThunderX 88xx (TARGET_THUNDERX_88XX)
99. Support Aspeed SoCs (ARCH_ASPEED)
100. Support Phytium Durian Platform (TARGET_DURIAN)
101. Support Phytium Pomelo Platform (TARGET_POMELO)
102. Support Phytium PE2201 Platform (TARGET_PE2201)
103. Support Cortina Presidio ASIC Platform (TARGET_PRESIDIO_ASIC)
104. Xen guest ARM64 (TARGET_XENGUEST_ARM64)
105. Support HPE GXP SoCs (ARCH_GXP)
choice[1-105?]: 95
Support Rockchip PX30 (ROCKCHIP_PX30) [N/y/?] n
Support Rockchip RK3036 (ROCKCHIP_RK3036) [N/y/?] n
Support Rockchip RK3066 (ROCKCHIP_RK3066) [N/y/?] n
Support Rockchip RK3128 (ROCKCHIP_RK3128) [N/y/?] n
Support Rockchip RK3188 (ROCKCHIP_RK3188) [N/y/?] n
Support Rockchip RK3228/RK3229 (ROCKCHIP_RK322X) [N/y/?] n Support Rockchip RK3288 (ROCKCHIP_RK3288) [N/y/?] n
Support Rockchip RK3308 (ROCKCHIP_RK3308) [N/y/?] n
Support Rockchip RK3328 (ROCKCHIP_RK3328) [N/y/?] n
Support Rockchip RK3368 (ROCKCHIP_RK3368) [N/y/?] n
Support Rockchip RK3399 (ROCKCHIP_RK3399) [Y/n/?] y
Support Rockchip RK3506 (ROCKCHIP_RK3506) [N/y/?] n
Support Rockchip RK3528 (ROCKCHIP_RK3528) [N/y/?] n
Support Rockchip RK3568 (ROCKCHIP_RK3568) [N/y/?] n
Support Rockchip RK3576 (ROCKCHIP_RK3576) [N/y/?] n
Support Rockchip RK3588 (ROCKCHIP_RK3588) [N/y/?] n
Support Rockchip RV1108 (ROCKCHIP_RV1108) [N/y/?] n
Support Rockchip RV1126 (ROCKCHIP_RV1126) [N/y/?] n
Route uart output to usb pins (ROCKCHIP_USB_UART) [N/y/?] n
SPL returns to bootrom (SPL_ROCKCHIP_BACK_TO_BROM) [N/y/?] n TPL returns to bootrom (TPL_ROCKCHIP_BACK_TO_BROM) [Y/n/?] y Rockchip common board file (ROCKCHIP_COMMON_BOARD) [Y/n/?] y Rockchip SPL common board file (SPL_ROCKCHIP_COMMON_BOARD) [Y/n/?] y Rockchip TPL common board file (TPL_ROCKCHIP_COMMON_BOARD) [Y/n/?] y Use external TPL binary (ROCKCHIP_EXTERNAL_TPL) [N/y/?] n Rockchip boot mode flag register address (ROCKCHIP_BOOT_MODE_REG) [0x0]0x0Disable device boot on power plug-in (ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON) [N/y/?] n
Rockchip STIMER support (ROCKCHIP_STIMER) [Y/n/?] y
Size of IRAM reserved in SPL (ROCKCHIP_SPL_RESERVE_IRAM) [0x0]0x0SPL requires early-return (for RK3188-style BROM) to BROM (SPL_ROCKCHIP_EARLYRETURN_TO_BROM) [N/y/?] n
Disableforce_jtagfeature (ROCKCHIP_DISABLE_FORCE_JTAG) [Y/n/?] y TPL requires early-return (for RK3188-style BROM) to BROM (TPL_ROCKCHIP_EARLYRETURN_TO_BROM) [N/y/?] n
Build a SPI image for rockchip (ROCKCHIP_SPI_IMAGE) [Y/n/?] y Build a maskrom mode image for Rockchip (ROCKCHIP_MASKROM_IMAGE) [N/y/?] n RK3399 board select
1. Asus Flip C101PA Chromebook (RK3399) (TARGET_CHROMEBOOK_BOB)
2. Samsung Chromebook Plus (RK3399) (TARGET_CHROMEBOOK_KEVIN)
3. RK3399 evaluation board (TARGET_EVB_RK3399)
4. Pinebook Pro (TARGET_PINEBOOK_PRO_RK3399)
5. PinePhone Pro (TARGET_PINEPHONE_PRO_RK3399)Quoted 1 line
6. Theobroma Systems RK3399-Q7 (Puma) (
TARGET_PUMA_RK3399)7. Vamrs Limited Rock960 board family (
TARGET_ROCK960_RK3399)
8. Radxa ROCK Pi 4 board (TARGET_ROCKPI4_RK3399)
9. Pine64 Rockpro64 board (TARGET_ROCKPRO64_RK3399)
10. Firefly ROC-RK3399-PC board (TARGET_ROC_PC_RK3399)
choice[1-10?]: 6
Theobroma Systems RK3399-Q7 DDR OptionQuoted 1 line
1. DDR3-1333MHz (
TARGET_PUMA_RK3399_RAM_DDR3_1333)2. DDR3-1600MHz (
TARGET_PUMA_RK3399_RAM_DDR3_1600)
3. DDR3-1866MHz (TARGET_PUMA_RK3399_RAM_DDR3_1866)
choice[1-3?]: 1
Force cache maintenance to be exclusively by VA (CMO_BY_VA_ONLY) [N/y/?] n Fix broken ARMv8 generic timer (ARMV8_CNTFRQ_BROKEN) [N/y/?] n Install crash dump exception vectors (ARMV8_SPL_EXCEPTION_VECTORS) [N/y/?] n Enable multiple CPUs to enter into U-Boot (ARMV8_MULTIENTRY) [N/y/?] n Enable data coherency with other cores in cluster (ARMV8_SET_SMPEN) [Y/n/?] y
Enable switching to running in EL1 (ARMV8_SWITCH_TO_EL1) [N/y/?] n Use PSCI for reset and shutdown (PSCI_RESET) [Y/n/?] y
Enable PSCI support (ARMV8_PSCI) [N/y/?] n
External aborts and SError interrupt exception are taken in EL3 (ARMV8_EA_EL3_FIRST) [N/y/?] n
Use the event stream for udelay (ARMV8_UDELAY_EVENT_STREAM) [N/y/?] n *
* General setup
*
Compile also drivers which will not load (COMPILE_TEST) [N/y/?] n Compile U-Boot with warnings as errors (WERROR) [N/y/?] n
Local version - append to U-Boot release (LOCALVERSION) [] Automatically append version information to the version string (LOCALVERSION_AUTO) [Y/n/?] y
Optimization levelQuoted 1 line
1. Optimize for size (
CC_OPTIMIZE_FOR_SIZE)2. Optimize for speed (
CC_OPTIMIZE_FOR_SPEED)
3. Optimize for debugging (CC_OPTIMIZE_FOR_DEBUG)
choice[1-3?]: 1
Allow compiler to uninline functions marked 'inline' in full U-Boot (OPTIMIZE_INLINING) [N/y/?] n
Allow compiler to uninline functions marked 'inline' in SPL (SPL_OPTIMIZE_INLINING) [N/y/?] n
Allow compiler to uninline functions marked 'inline' in TPL (TPL_OPTIMIZE_INLINING) [N/y/?] n
Enable Link Time Optimizations (LTO) [N/y/?] n
Select U-Boot be run as a bootloader for XEN Virtual Machine (XEN) [N/y/?] n Add arch, board, vendor and soc variables to default environment (ENV_VARS_UBOOT_CONFIG) [Y/?] y
Number of DRAM banks (NR_DRAM_BANKS) [1] 1
Enable kernel command line setup (SYS_BOOT_GET_CMDLINE) [N/y/?] n Enable kernel board information setup (SYS_BOOT_GET_KBD) [N/y/?] n Use a custom location for the initial stack pointer address (HAS_CUSTOM_SYS_INIT_SP_ADDR) [Y/?] y
Static location for the initial stack pointer (CUSTOM_SYS_INIT_SP_ADDR)
[0x03f00000]0x03f00000
Enablemalloc()pool before relocation (SYS_MALLOC_F) [Y/?] y
Size ofmalloc()pool before relocation (SYS_MALLOC_F_LEN) [0x10000]0x10000
Define memory for Dynamic allocation (SYS_MALLOC_LEN) [0x2000000]0x2000000Enablemalloc()pool in SPL (SPL_SYS_MALLOC_F) [Y/n/?] y
Size ofmalloc()pool in SPL (SPL_SYS_MALLOC_F_LEN) [0x8000]0x8000
Enablemalloc()pool in TPL (TPL_SYS_MALLOC_F) [Y/n/?] y
Size ofmalloc()pool in TPL (TPL_SYS_MALLOC_F_LEN) [0x4000]0x4000
Inform valgrind about memory allocations (VALGRIND) [N/y/?] n 64bit physical address support (PHYS_64BIT) [Y/?] y
64bit fdt address support (FDT_64BIT) [Y/?] y
SPL image used in the combined SPL+U-Boot image (SPL_IMAGE) [spl/u-boot-spl.bin] spl/u-boot-spl.bin
Recreate an ELF image from raw U-Boot binary (REMAKE_ELF) [N/y/?] n Build target special images (BUILD_TARGET) []
Define a maximum size for the U-Boot image (HAS_BOARD_SIZE_LIMIT) [N/y/?] n Use a custom location for the U-Boot linker script (SYS_CUSTOM_LDSCRIPT) [N/y/?] n
Address in memory to use by default (SYS_LOAD_ADDR) [0x800800]0x800800Define max stack size that can be used by U-Boot (STACK_SIZE) [0x1000000]0x1000000
Exclude some memory from U-Boot / OS information (SYS_MEM_TOP_HIDE) [0x0]0x0
Maximum size in bytes reserved for U-Boot in memory (SYS_MONITOR_LEN) [0] 0 Support for multiprocessor (MP) [N/y/?] n
Text Base (TEXT_BASE) [0x00800000]0x00800000
Use custom U-Boot Start (HAVE_SYS_UBOOT_START) [N/y/?] n Determine CPU clock frequency at run-time (DYNAMIC_SYS_CLK_FREQ) [N/y/?] n CPU clock frequency (SYS_CLK_FREQ) [0] 0
Enable U-Boot API (API) [N/y/?] (NEW)Then it continues with the build, but using the flags for clang while using GCC, see:
make -f /home/qschulz/work/upstream/u-boot/scripts/Makefile.autoconf || \ { rm -f include/config/auto.conf; false; } mkdir -p include/asm if [ -d /home/qschulz/work/upstream/u-boot/arch/arm/mach-rk3399/include/mach ]; then \ dest=arch/arm/mach-rk3399/include/mach; \ else \ dest=arch/arm/include/asm/arch-rk3399; \fi; \
ln -fsn/home/qschulz/work/upstream/u-boot/$destinclude/asm/archset -e; mkdir -pinclude/; trap "rm -finclude/.config.h.tmp" EXIT; { (echo "/* Automatically generated - do not edit */"; echo \#defineCFG_BOARDDIRboard/theobroma-systems/puma_rk3399; echo \#include \<configs/"puma_rk3399".h\> ; echo \#include \<asm/config.h\>; echo \#include \<linux/kconfig.h\>; echo \#include \<config_fallbacks.h\>;); } >include/.config.h.tmp; if [ ! -rinclude/config.h] || ! cmp -sinclude/config.hinclude/.config.h.tmp; then : ' UPDinclude/config.h'; mvMakefile +0
-17-f include/.config.h.tmp include/config.h; fi aarch64-linux-gnu-gcc -E -Wall -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu11 -ffreestanding -fno-builtin -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -Wno-address-of-packed-member -Os -fno-stack-protector -fno-delete-null-pointer-checks -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=/home/qschulz/work/upstream/u-boot/= -gdwarf-4 -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-format-invalid-specifier -Wno-gnu -Wno-tautological-compare -mno-global-merge -Wno-pointer-sign -D__KERNEL__ -D__UBOOT__ -Qunused-arguments -D__ARM__ -ffunction-sections -fdata-sections -fno-common -ffixed-x18 -pipe -Iinclude -I/home/qschulz/work/upstream/u-boot/include -I/home/qschulz/work/upstream/u-boot/arch/arm/include -include
/home/qschulz/work/upstream/u-boot/include/linux/kconfig.h-nostdinc -isystem/usr/lib/gcc/aarch64-linux-gnu/15/include-DDO_DEPS_ONLY -dMinclude/config.h> u-boot.cfg.tmp && { grep 'defineCONFIG_' u-boot.cfg.tmp | sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_IF_ENABLED_INT(/d;/define CONFIG_VAL(/d;' > u-boot.cfg; rm u-boot.cfg.tmp; } || { rm u-boot.cfg.tmp; false; }
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-mno-global-merge’; did you mean ‘-Wno-global-module’?
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-Qunused-arguments’
make[2]: *** [/home/qschulz/work/upstream/u-boot/scripts/Makefile.autoconf:84:
u-boot.cfg] Error 1
make[1]: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'. Stop.
make: *** [Makefile:189: __sub-make] Error 2If I do nothing but call
make CROSS_COMPILE="aarch64-linux-gnu-" O=build/puma V=1
again, it'll work just fine and compile with GCC flags with the GCC toolchain (well, I don't get an error anymore, so I'm assumign that what's happening :) ). So it seems to me that the symbols as used inMakefiledepend on the previous make command generating the .config and syncconfig is running "too late".Contrary to what I initially thought, it's not actually related to U-Boot host tools.
I'm not attempting to mix GCC and clang for host/target building, and I don't know if this would work in any case. I don't know if this is something we want to support anyway. As for what the Linux kernel does, they document[1] LLVM/clang support by telling the user to essentially use LLVM=1 which they claim is an alias to:
CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \
OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump READELF=llvm-readelf \
HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar HOSTLD=ld.lldThey don't really hint at CC and HOSTCC being different as being an option. Maybe it works, maybe it doesn't?
I did test in the Linux kernel whether they had the same issue but it doesn't seem like it is the case.
Quoted 7 lines
Quoted 1 line
Ah, thanks. I'm tempted to say this is something that'll just not work until we can also switch to following the kernel way of invoking clang? But maybe it's a problem missing dependencies somewhere (not leading to some cmd file being recreated in time), rather than more missing changes.
The root cause is likely a stale KBUILD_CFLAGS leaking into Makefile.autoconf sub-make.
The U-Boot-specific recipe at Makefile:813 runs two steps when 'auto.conf' is stale:
1. 'make syncconfig' - regenerates 'auto.conf' (e.g. flips CC_IS_CLANG=y to CC_IS_GCC=y after a toolchain change).
2. 'make -f scripts/Makefile.autoconf' - preprocesses 'include/config.h' to produce u-boot.cfg/autoconf.mk
KBUILD_CFLAGS and KBUILD_CPPFLAGS are exported by the parent (line
576) and consumed by scripts/Makefile.autoconf:45:
c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) ...
The parent computes those at parse time from the stale 'auto.conf', so step 2's sub-make inherits clang-only flags ('-mno-global-merge', '-Qunused-arguments', ...) and feeds them to gcc, fails. The recipe deletes 'auto.conf' and aborts, so GNU make's makefile-restart never runs. A second 'make' succeeds because 'auto.conf' is already fresh on disk before parsing.
Linux doesn't hit this: its auto.conf rule only runs 'syncconfig' and lets make re-exec. Basically Makefile.autoconf is a old bridge for the include/configs -> Kconfig migration.
We should stop leaking parent parse-time CFLAGS into 'Makefile.autoconf'. That helper only does 'cpp -dM' on 'config.h' and needs UBOOTINCLUDE, PLATFORM_CPPFLAGS, '-D__KERNEL__', etc. - not warning/codegen flags. Either 'unexport KBUILD_CFLAGS KBUILD_CPPFLAGS' for that sub-make, or reset them inside 'Makefile.autoconf' after 'include config.mk' and rebuild only the cpp pieces it actually needs.
This also explains Quentin's hunch about 'u-boot-initial-env': any target that triggers the auto.conf recipe runs 'Makefile.autoconf' with the parent's stale env, regardless of which target was asked for.
Something like this before the CC = in Makefile.autoconf:
# Discard KBUILD_CFLAGS/KBUILD_CPPFLAGS inherited from the parent make. # They were computed at the parent's parse time from a possibly-stale
# auto.conf (e.g. before syncconfig detected a toolchain change), so # CC_IS_CLANG-guarded flags can leak across a clang->gcc switch and # break the cpp -dM below. Warning/codegen flags do not affect cpp # -dM output, so only the base preprocessor defines and CLANG_FLAGS # (--target=, --gcc-toolchain=, ...) need to be preserved here. KBUILD_CFLAGS := $(CLANG_FLAGS) KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__ $(CLANG_FLAGS)
CLANG_FLAGS must stay otherwise cross-compile clang builds break:
without '--target=aarch64-linux-gnu' clang falls back to the host triple and rejects arch-specific flags from PLATFORM_CPPFLAGS like '-ffixed-x18' (arch/arm/config.mk).
Regards,
Simon