Couple of clang warnings for Rockchip boards
Hi all,
I'm looking into force-enabling CONFIG_WERROR for all Rockchip SoCs. First, let me know if this is a bad idea :)
gcc version 15.2.1 20250808 (Red Hat Cross 15.2.1-1) (GCC) for both ARM and Aarch64 machines report no warnings (built with a config fragment enabling CONFIG_WERROR).
For clang, I went for cross-compiling using either
make HOSTCC=clang CROSS_COMPILE=arm-linux-gnu- CC=clang O=build/ ... or
make HOSTCC=clang CROSS_COMPILE=aarch64-linux-gnu- CC=clang O=build/ ...
First things first, I can't even build any of the Aarch32/ARM with clang for some reason, so this only applies for Aarch64 Rockchip platforms.
Some platforms couldn't be built due to hitting the max TPL limit (e.g. PX30).
clang version 21.1.8 (Fedora 21.1.8-4.fc43) (or clang version 22.1.1 (Fedora 22.1.1-2.fc44), doesn't matter) issues three warnings:
1. Chromebooks EC fails to build:
In file included from /home/qschulz/work/upstream/u-boot/drivers/misc/cros_ec.c:21:
In file included from /home/qschulz/work/upstream/u-boot/include/cros_ec.h:12:/home/qschulz/work/upstream/u-boot/include/ec_commands.h:3578:2: error: field within 'struct ec_params_charge_state' is less aligned than 'union ec_params_charge_state::(anonymous at /home/qschulz/work/upstream/u-boot/include/ec_commands.h:3578:2)' and is usually due to 'struct ec_params_charge_state' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
3578 | union {
| ^The following
include/ec_commands.h +1 -1
@@ -3575,7 +3575,7 @@ enum charge_state_params {struct __ec_todo_packed ec_params_charge_state {uint8_t cmd;/* enum charge_state_command */ -union { +union __ec_todo_packed {struct __ec_align1 {/* no args */ } get_state;
seems to fix it. The upstream EC git repo (https://chromium.googlesource.com/chromiumos/platform/ec) has a commit with more changes, see 65da9cc08766 ("include/ec_commands.h: Fix unaligned access warnings"). It doesn't apply cleanly (and I haven't looked into other patches to backport for this to apply cleanly). I'm not sure what we're supposed to do here? I also don't have a Chromebook to test.
2. RK3528, RK3576 and RK3588 boards fail with (replace rk3528 in path for the other SoCs)
/home/qschulz/work/upstream/u-boot/arch/arm/mach-rockchip/rk3528/rk3528.c:98:45: error: value size does not match register size specified by the constraint and modifier [-Werror,-Wasm-operand-widths]
98 | asm volatile("msr cntfrq_el0, %0" : : "r"
(CONFIG_COUNTER_FREQUENCY));
| ^include/generated/autoconf.h:372:34: note: expanded from macro 'CONFIG_COUNTER_FREQUENCY'
372 | #define CONFIG_COUNTER_FREQUENCY 24000000
| ^/home/qschulz/work/upstream/u-boot/arch/arm/mach-rockchip/rk3528/rk3528.c:98:32: note: use constraint modifier "w"
98 | asm volatile("msr cntfrq_el0, %0" : : "r"
(CONFIG_COUNTER_FREQUENCY));
| ^~
| %w0Note that all Rockchip SoCs have CONFIG_COUNTER_FREQUENCY set to 24000000.
The cntfrq_el0 register is 64b (https://developer.arm.com/documentation/ddi0601/2026-03/AArch64-Registers/CNTFRQ-EL0--Counter-timer-Frequency-Register?lang=en), though the top 32b are reserved. Android decided to ignore this warning in the Little Kernel with https://android.googlesource.com/kernel/lk/+/923541d4c23565a47d020d84202a6f77d22fc149%5E%21/.
I tried to follow clang's recommendation and switch this to %w0 but it fails with:
/tmp/rk3588-a0a4b8.s: Assembler messages:/tmp/rk3588-a0a4b8.s:87: Error: operand mismatch -- `msr cntfrq_el0,w9'/tmp/rk3588-a0a4b8.s:87: Info: did you mean this?/tmp/rk3588-a0a4b8.s:87: Info: msr cntfrq_el0, x9
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
I tried casting CONFIG_COUNTER_FREQUENCY into a u64 and it builds and no magic smoke when booting a board. Whether this is the proper fix, I don't know, but the warning is then gone. We could also decide to ignore the warning like for Android's Little Kernel (where and how much this is used is unclear as the repo isn't seeing much activity).
The register documentation indicates this is not used by the hardware at all, so even if it was broken, we probably wouldn't see a difference?
3. Boards building USB TCPM fail with
In file included from /home/qschulz/work/upstream/u-boot/drivers/usb/tcpm/tcpm-uclass.c:12:
In file included from /home/qschulz/work/upstream/u-boot/include/usb/tcpm.h:12:/home/qschulz/work/upstream/u-boot/include/usb/pd.h:212:2: error: field within 'struct pd_message' is less aligned than 'union pd_message::(anonymous at /home/qschulz/work/upstream/u-boot/include/usb/pd.h:212:2)' and is usually due to 'struct pd_message' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
212 | union {
| ^This file is apparently adapted from upstream Linux, where the code is identical for that struct. So not sure what to do here.
Cheers,
Quentin
Quoted 4 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)
This is how CI works, so this part should go fine.
Quoted 8 lines
gcc version 15.2.1 20250808 (Red Hat Cross 15.2.1-1) (GCC) for both ARM and Aarch64 machines report no warnings (built with a config fragment enabling
CONFIG_WERROR).For clang, I went for cross-compiling using either
make HOSTCC=clang CROSS_COMPILE=arm-linux-gnu- CC=clang O=build/ ... or
make HOSTCC=clang CROSS_COMPILE=aarch64-linux-gnu- CC=clang O=build/ ...
I'm adding in Dmitrii here because I thought we had fixed clang builds again rather recently, but I haven't put them in CI and I thought we might also need another Kbuild re-sync for a few more things too.
Quoted 5 lines
First things first, I can't even build any of the Aarch32/ARM with clang for some reason, so this only applies for Aarch64 Rockchip platforms.
Some platforms couldn't be built due to hitting the max TPL limit (e.g. PX30).
I've also run in to this over the years trying to test clang and having LTO not work, or be very much larger than expected. Just FYI.
Quoted 33 lines
clang version 21.1.8 (Fedora 21.1.8-4.fc43) (or clang version 22.1.1 (Fedora 22.1.1-2.fc44), doesn't matter) issues three warnings:
1. Chromebooks EC fails to build:
In file included from/home/qschulz/work/upstream/u-boot/drivers/misc/cros_ec.c:21:
In file included from/home/qschulz/work/upstream/u-boot/include/cros_ec.h:12:/home/qschulz/work/upstream/u-boot/include/ec_commands.h:3578:2: error:
field within 'structec_params_charge_state' is less aligned than 'union ec_params_charge_state::(anonymous at/home/qschulz/work/upstream/u-boot/include/ec_commands.h:3578:2)' and is usually due to 'structec_params_charge_state' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]3578 | union { | ^The following
include/ec_commands.h +1
-1@@ -3575,7 +3575,7 @@ enum charge_state_params {struct __ec_todo_packed ec_params_charge_state {uint8_t cmd;/* enum charge_state_command */ -union { +union __ec_todo_packed {struct __ec_align1 {/* no args */ } get_state;
Quoted 6 lines
seems to fix it. The upstream EC git repo
(https://chromium.googlesource.com/chromiumos/platform/ec) has a commit with more changes, see65da9cc08766("include/ec_commands.h: Fix unaligned access warnings"). It doesn't apply cleanly (and I haven't looked into other patches to backport for this to apply cleanly). I'm not sure what we're supposed to do here? I also don't have a Chromebook to test.
I would just go with making the changes we need to make here, and cc'ing some board maintainers for functional testing.
Quoted 36 lines
2. RK3528, RK3576 and RK3588 boards fail with (replace rk3528 in path for the other SoCs)
/home/qschulz/work/upstream/u-boot/arch/arm/mach-rockchip/rk3528/rk3528.c:98:45:
error: value size does not match register size specified by the constraint and modifier [-Werror,-Wasm-operand-widths]
98 | asm volatile("msrcntfrq_el0, %0" : : "r"
(CONFIG_COUNTER_FREQUENCY));
| ^include/generated/autoconf.h:372:34: note: expanded from macro 'CONFIG_COUNTER_FREQUENCY'
372 | #defineCONFIG_COUNTER_FREQUENCY24000000
| ^/home/qschulz/work/upstream/u-boot/arch/arm/mach-rockchip/rk3528/rk3528.c:98:32:
note: use constraint modifier "w"
98 | asm volatile("msrcntfrq_el0, %0" : : "r"
(CONFIG_COUNTER_FREQUENCY));| ^~ | %w0Note that all Rockchip SoCs have
CONFIG_COUNTER_FREQUENCYset to 24000000.The
cntfrq_el0register is 64b (https://developer.arm.com/documentation/ddi0601/2026-03/AArch64-Registers/CNTFRQ-EL0--Counter-timer-Frequency-Register?lang=en),
though the top 32b are reserved. Android decided to ignore this warning in
the Little Kernel with https://android.googlesource.com/kernel/lk/+/923541d4c23565a47d020d84202a6f77d22fc149%5E%21/.I tried to follow clang's recommendation and switch this to %w0 but it fails with:
/tmp/rk3588-a0a4b8.s: Assembler messages:/tmp/rk3588-a0a4b8.s:87: Error: operand mismatch -- `msr cntfrq_el0,w9'/tmp/rk3588-a0a4b8.s:87: Info: did you mean this?/tmp/rk3588-a0a4b8.s:87: Info: msrcntfrq_el0, x9
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
Quoted 8 lines
I tried casting
CONFIG_COUNTER_FREQUENCYinto a u64 and it builds and no magic smoke when booting a board. Whether this is the proper fix, I don't know, but the warning is then gone. We could also decide to ignore the warning like for Android's Little Kernel (where and how much this is used is unclear as the repo isn't seeing much activity).The register documentation indicates this is not used by the hardware at all, so even if it was broken, we probably wouldn't see a difference?
Can we define it as 24000000ULL? Maybe. If not 0x16e3600ULL with a comment should work.
Quoted 12 lines
3. Boards building USB TCPM fail with
In file included from
/home/qschulz/work/upstream/u-boot/drivers/usb/tcpm/tcpm-uclass.c:12:
In file included from/home/qschulz/work/upstream/u-boot/include/usb/tcpm.h:12:/home/qschulz/work/upstream/u-boot/include/usb/pd.h:212:2: error: field within 'structpd_message' is less aligned than 'union pd_message::(anonymous at/home/qschulz/work/upstream/u-boot/include/usb/pd.h:212:2)' and is usually due to 'structpd_message' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
Quoted 5 lines
212 | union { | ^This file is apparently adapted from upstream Linux, where the code is identical for that struct. So not sure what to do here.
I'm not sure either.
Signature · 1 line
Tom
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 28 lines · Quentin Schulz
Hi Tom,
Quoted 2 lines · Tom Rini
On Wed, Apr 22, 2026 at 03:25:55PM +0200, Quentin Schulz wrote:[...]>> Some platforms couldn't be built due to hitting the max TPL
limit (e.g.
Quoted 5 lines
Quoted 1 line
PX30).
I've also run in to this over the years trying to test clang and having LTO not work, or be very much larger than expected. Just FYI.
We do document that the image is bigger in
https://docs.u-boot.org/en/latest/build/clang.html:"""
The biggest problem when trying to compile U-Boot with Clang is that almost all archs rely on storing gd in a global register and the Clang 3.5 user manual states: “Clang does not support global register variables; this is unlikely to be implemented soon because it requires additional LLVM backend support.”The ARM backend can be instructed not to use the r9 and x18 registers using -ffixed-r9 or -ffixed-x18 respectively. As global registers themselves are not supported inline assembly is needed to get and set the r9 or x18 value. This leads to larger code then strictly necessary, but at least works. """
Quoted 3 lines
so I wasn't surprised (also, TPL on PX30 is *very* close to the limit already so much so that adding a printf is sometimes enough to hit that limit, making debugging... interesting :) ).
That particular page really needs some updating, it was written forever ago and is very out of date. I do wonder if there's a more general clang+SPL problem in that I recall things like SPL for am335x_evm growing to like 4x the size, which doesn't make that much sense.
Signature · 1 line
Tom
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Quoted 10 lines
gcc version 15.2.1 20250808 (Red Hat Cross 15.2.1-1) (GCC) for both ARM and Aarch64 machines report no warnings (built with a config fragment enabling
CONFIG_WERROR).For clang, I went for cross-compiling using either
make HOSTCC=clang CROSS_COMPILE=arm-linux-gnu- CC=clang O=build/ ... or
make HOSTCC=clang CROSS_COMPILE=aarch64-linux-gnu- CC=clang O=build/ ...
Quoted 5 lines
First things first, I can't even build any of the Aarch32/ARM with clang for some reason, so this only applies for Aarch64 Rockchip platforms.
Some platforms couldn't be built due to hitting the max TPL limit (e.g. PX30).
It's interesting that clang code is larger than gcc. There was a time that I thought clang would replace gcc. But clang is much slower and if it doesn't provide code-size benefits, I'm not sure that will happen. We all use it as an lsp though, at least.
Quoted 34 lines
clang version 21.1.8 (Fedora 21.1.8-4.fc43) (or clang version 22.1.1 (Fedora 22.1.1-2.fc44), doesn't matter) issues three warnings:
1. Chromebooks EC fails to build:
In file included from/home/qschulz/work/upstream/u-boot/drivers/misc/cros_ec.c:21:
In file included from/home/qschulz/work/upstream/u-boot/include/cros_ec.h:12:/home/qschulz/work/upstream/u-boot/include/ec_commands.h:3578:2: error:
field within 'structec_params_charge_state' is less aligned than 'union ec_params_charge_state::(anonymous at/home/qschulz/work/upstream/u-boot/include/ec_commands.h:3578:2)' and is usually due to 'structec_params_charge_state' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]3578 | union { | ^The following
include/ec_commands.h +1
-1@@ -3575,7 +3575,7 @@ enum charge_state_params {struct __ec_todo_packed ec_params_charge_state {uint8_t cmd;/* enum charge_state_command */ -union { +union __ec_todo_packed {struct __ec_align1 {/* no args */ } get_state;
Quoted 7 lines
seems to fix it. The upstream EC git repo
(https://chromium.googlesource.com/chromiumos/platform/ec) has a commit with more changes, see65da9cc08766("include/ec_commands.h: Fix unaligned access warnings"). It doesn't apply cleanly (and I haven't looked into other patches to backport for this to apply cleanly). I'm not sure what we're supposed to do here? I also don't have a Chromebook to test.
It should be possible to backport this, to avoid divergence. I could look at that if you like.
For now you could use a #pragma just around the header include, or in cros_ec.c
I don't think you need to worry about the struct going wrong, so long as the size remains the same. There are two Chromebooks in the SJG lab you can try it with: bob and kevin
Quoted 39 lines
2. RK3528, RK3576 and RK3588 boards fail with (replace rk3528 in path for the other SoCs)
/home/qschulz/work/upstream/u-boot/arch/arm/mach-rockchip/rk3528/rk3528.c:98:45:
error: value size does not match register size specified by the constraint and modifier [-Werror,-Wasm-operand-widths]98 | asm volatile("msr cntfrq_el0, %0" : : "r"(
CONFIG_COUNTER_FREQUENCY));
| ^include/generated/autoconf.h:372:34: note: expanded from macro 'CONFIG_COUNTER_FREQUENCY'
372 | #defineCONFIG_COUNTER_FREQUENCY24000000
| ^/home/qschulz/work/upstream/u-boot/arch/arm/mach-rockchip/rk3528/rk3528.c:98:32:
note: use constraint modifier "w"98 | asm volatile("msr cntfrq_el0, %0" : : "r" (CONFIG_COUNTER_FREQUENCY)); | ^~ | %w0Note that all Rockchip SoCs have
CONFIG_COUNTER_FREQUENCYset to 24000000.The
cntfrq_el0register is 64b
(https://developer.arm.com/documentation/ddi0601/2026-03/AArch64-Registers/CNTFRQ-EL0--Counter-timer-Frequency-Register?lang=en),
though the top 32b are reserved. Android decided to ignore this warning in the Little Kernel with
https://android.googlesource.com/kernel/lk/+/923541d4c23565a47d020d84202a6f77d22fc149%5E%21/.I tried to follow clang's recommendation and switch this to %w0 but it fails with:
/tmp/rk3588-a0a4b8.s: Assembler messages:/tmp/rk3588-a0a4b8.s:87: Error: operand mismatch -- `msr cntfrq_el0,w9'/tmp/rk3588-a0a4b8.s:87: Info: did you mean this?/tmp/rk3588-a0a4b8.s:87: Info: msrcntfrq_el0, x9
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
Quoted 8 lines
I tried casting
CONFIG_COUNTER_FREQUENCYinto a u64 and it builds and no magic smoke when booting a board. Whether this is the proper fix, I don't know, but the warning is then gone. We could also decide to ignore the warning like for Android's Little Kernel (where and how much this is used is unclear as the repo isn't seeing much activity).The register documentation indicates this is not used by the hardware at all, so even if it was broken, we probably wouldn't see a difference?
Similar to what Tom says...does this work?:
asm volatile("msr cntfrq_el0, %0" : : "r"
((u64)CONFIG_COUNTER_FREQUENCY));
Quoted 13 lines
3. Boards building USB TCPM fail with
In file included from
/home/qschulz/work/upstream/u-boot/drivers/usb/tcpm/tcpm-uclass.c:12:
In file included from/home/qschulz/work/upstream/u-boot/include/usb/tcpm.h:12:/home/qschulz/work/upstream/u-boot/include/usb/pd.h:212:2: error: field within 'structpd_message' is less aligned than 'union pd_message::(anonymous at/home/qschulz/work/upstream/u-boot/include/usb/pd.h:212:2)' and is usually due to 'structpd_message' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
Quoted 5 lines
212 | union { | ^This file is apparently adapted from upstream Linux, where the code is identical for that struct. So not sure what to do here.
Maybe add __packed ?
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 21 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Quoted 6 lines
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Personally, I think -Werror being a pro or a con during development is up to the developer. I'm very much a "turn this on, fail the build when I transpose arguments, etc" kind of developer.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
Yes, a not uncommon occurrence is patches, or even PRs, having to be respun because of "variable unused" warnings. Which having typed that is more likely what bothers Simon's flow.
Quoted 6 lines
No defconfig seems to be setting this option, not sure exactly why that is.
Also, FYI, enabling
CONFIG_WERRORdoesn't apply the -Werror flag to the host tools, which I believe is an oversight. I see buildman sets HOSTCFLAGS=-Werror, maybe we should do that in the appropriate place based onCONFIG_WERRORas well?
What does the linux kernel do here? We're just borrowing logic again.
[snip]
Quoted 10 lines
So, looking a bit more into this, the kernel actually silences a bunch of warnings when not passing W=N to
make, one of them being unaligned-access, see https://elixir.bootlin.com/linux/v7.0/source/scripts/Makefile.warn#L155.
So maybe we need to sync some of those back to U-Boot as well?Our
scripts/Makefile.extrawarnis claimed[1] to be loosely based on Linux 6.1's, but it is actually quite different. So not sure how much we should be backporting and how.[1]
bd3f9ee679b4("kbuild: Bump the build system to 6.1")
We're likely a combination of mis-synced (assuming it's not inline with 6.1) and a case of needing to expand the new concept of scripts/Makefile.XXX-u-boot for kbuild stuff to have a Makefile.warn-u-boot for things we add.
Signature · 1 line
Tom
Hi Tom,
Quoted 7 lines · Tom Rini
Quoted 6 lines · Quentin Schulz
Hi Simon,
Quoted 3 lines · Simon Glass
Hi Quentin,
On Thu, 23 Apr 2026 at 01:26, Quentin Schulz <[email protected]> wrote:
[...]
Quoted 7 lines
Quoted 4 lines
Also, FYI, enabling
CONFIG_WERRORdoesn't apply the -Werror flag to the host tools, which I believe is an oversight. I see buildman sets HOSTCFLAGS=-Werror, maybe we should do that in the appropriate place based onCONFIG_WERRORas well?What does the linux kernel do here? We're just borrowing logic again.
27758d8c2583 ("kbuild: enable -Werror for hostprogs") and 7ded7d37e5f5 ("scripts/Makefile.extrawarn: Respect CONFIG_WERROR / W=e for hostprogs") (available in v6.18), set
ifneq ($(findstring e, $(KBUILD_EXTRA_WARN))$(CONFIG_WERROR),) [...]
# 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
so they do it.
Cheers,
Quentin
Quoted 34 lines · Quentin Schulz
Hi Tom,
Quoted 7 lines · Tom Rini
Quoted 6 lines · Quentin Schulz
Hi Simon,
Quoted 3 lines · Simon Glass
Hi Quentin,
On Thu, 23 Apr 2026 at 01:26, Quentin Schulz <[email protected]> wrote:
[...]
Quoted 7 lines
Quoted 4 lines
Also, FYI, enabling
CONFIG_WERRORdoesn't apply the -Werror flag to the host tools, which I believe is an oversight. I see buildman sets HOSTCFLAGS=-Werror, maybe we should do that in the appropriate place based onCONFIG_WERRORas well?What does the linux kernel do here? We're just borrowing logic again.
27758d8c2583("kbuild: enable -Werror for hostprogs") and7ded7d37e5f5("scripts/Makefile.extrawarn: RespectCONFIG_WERROR/ W=e for hostprogs") (available in v6.18), setifneq ($(findstring e, $(KBUILD_EXTRA_WARN))$(CONFIG_WERROR),) [...]
# 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
Quoted 1 line
so they do it.
OK, so it's just part of being so behind. I'd be fine with cherry-picking that logic now, if it's easy.
Signature · 1 line
Tom
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w -o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames, etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 2 lines
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in Kconfig makes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.
Quoted 5 lines
Also, FYI, enabling
CONFIG_WERRORdoesn't apply the -Werror flag to the host tools, which I believe is an oversight. I see buildman sets HOSTCFLAGS=-Werror, maybe we should do that in the appropriate place based onCONFIG_WERRORas well?
Yes, that seems to be an oversight.
Quoted 23 lines
Quoted 14 lines
Quoted 14 lines
gcc version 15.2.1 20250808 (Red Hat Cross 15.2.1-1) (GCC) for both ARM and Aarch64 machines report no warnings (built with a config fragment enabling
CONFIG_WERROR).For clang, I went for cross-compiling using either
make HOSTCC=clang CROSS_COMPILE=arm-linux-gnu- CC=clang O=build/ ... or
make HOSTCC=clang CROSS_COMPILE=aarch64-linux-gnu- CC=clang O=build/ ...First things first, I can't even build any of the Aarch32/ARM with clang for some reason, so this only applies for Aarch64 Rockchip platforms.
Quoted 8 lines
Quoted 2 lines
Some platforms couldn't be built due to hitting the max TPL limit (e.g. PX30).
It's interesting that clang code is larger than gcc. There was a time that I thought clang would replace gcc. But clang is much slower and if it doesn't provide code-size benefits, I'm not sure that will happen. We all use it as an lsp though, at least.
Quoted 3 lines
From what I've gathered, clang can cross-compile to many different
archs with a single binary, GCC goes for separate toolchains, which kinda is a pain to be honest.
Yes it seems so. I've never actually tried it though, have you? For my workflow, buildman handles the toolchains.
Quoted 7 lines
Also, it's nice for build systems like Buildroot or Yocto to only need a single toolchain (either clang or GCC, but not both) for everything. So in an ideal world if you want to use clang for everything, you could. Last time I checked, you cannot build TF-A on RK3399 with clang only. I'm also not entirely sure how far we are from building the kernel with clang, or maybe it's already fully supported.
I don't know either. I wonder how it handles linker scripts?
Quoted 47 lines
Quoted 35 lines
Quoted 35 lines
clang version 21.1.8 (Fedora 21.1.8-4.fc43) (or clang version 22.1.1 (Fedora 22.1.1-2.fc44), doesn't matter) issues three warnings:
1. Chromebooks EC fails to build:
In file included from/home/qschulz/work/upstream/u-boot/drivers/misc/cros_ec.c:21:
In file included from/home/qschulz/work/upstream/u-boot/include/cros_ec.h:12:/home/qschulz/work/upstream/u-boot/include/ec_commands.h:3578:2: error:
field within 'structec_params_charge_state' is less aligned than 'union ec_params_charge_state::(anonymous at/home/qschulz/work/upstream/u-boot/include/ec_commands.h:3578:2)' and is usually due to 'structec_params_charge_state' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]3578 | union { | ^The following
include/ec_commands.h +1
-1@@ -3575,7 +3575,7 @@ enum charge_state_params {struct __ec_todo_packed ec_params_charge_state {uint8_t cmd;/* enum charge_state_command */ -union { +union __ec_todo_packed {struct __ec_align1 {/* no args */ } get_state;Quoted 11 lines
Quoted 7 lines
seems to fix it. The upstream EC git repo
(https://chromium.googlesource.com/chromiumos/platform/ec) has a commit with more changes, see65da9cc08766("include/ec_commands.h: Fix unaligned access warnings"). It doesn't apply cleanly (and I haven't looked into other patches to backport for this to apply cleanly). I'm not sure what we're supposed to do here? I also don't have a Chromebook to test.It should be possible to backport this, to avoid divergence. I could look at that if you like.
Quoted 6 lines
That'd be nice :) Maybe the solution would be a sync with upstream instead of backporting select patches? I have no experience with CrOS EC so no clue what we're supposed to do here, especially since if I understood correctly, they switched to Zephyr somewhat recently, so maybe the API changed and isn't backward compatible (I don't think the Rockchip Chromebooks were migrated to that).
Yes, I led that effort in the distant past - we changed from a home-grown OS to Zephyr. But it still uses the same protocol.
https://chromium.googlesource.com/chromiumos/platform/ec/+/HEAD/docs/zephyr/README.md
Quoted 5 lines
Quoted 3 lines
For now you could use a #pragma just around the header include, or in
cros_ec.cI'd rather not silence warnings if we're planning on fixing them soon-ish :)
Indeed, I'll take a look at updating the file.
Quoted 6 lines
Quoted 5 lines
I don't think you need to worry about the struct going wrong, so long as the size remains the same. There are two Chromebooks in the SJG lab you can try it with: bob and kevin
Quoted 8 lines
Well, if we pack it, it may change the size, that's the whole point of packing no? Or you meant checking that the current size of the struct is the same after packing it to make clang happy?
But also, are we doing anything with this? Like some CrOS EC checks in labgrid for example? I cannot see any test for the crosec command in test/py/tests/ for example. No test specific to a chromebook either (git grep chromebook test/py/tests).
It is used for the sandbox keyboard, for example.
Quoted 16 lines
Quoted 4 lines
Quoted 4 lines
2. RK3528, RK3576 and RK3588 boards fail with (replace rk3528 in path for the other SoCs)
[...]
Quoted 11 lines
Quoted 8 lines
I tried casting
CONFIG_COUNTER_FREQUENCYinto a u64 and it builds and no magic smoke when booting a board. Whether this is the proper fix, I don't know, but the warning is then gone. We could also decide to ignore the warning like for Android's Little Kernel (where and how much this is used is unclear as the repo isn't seeing much activity).The register documentation indicates this is not used by the hardware at all, so even if it was broken, we probably wouldn't see a difference?
Similar to what Tom says...does this work?:
Quoted 7 lines
Quoted 3 lines
asm volatile("msr
cntfrq_el0, %0" : : "r"
((u64)CONFIG_COUNTER_FREQUENCY));Yes this was among the things I tried (see paragraph with the magic smoke not happening). I should probably start practicing condensing my mails :)
Ah OK, missed that sorry.
Quoted 32 lines
Quoted 17 lines
Quoted 17 lines
3. Boards building USB TCPM fail with
In file included from
/home/qschulz/work/upstream/u-boot/drivers/usb/tcpm/tcpm-uclass.c:12:
In file included from/home/qschulz/work/upstream/u-boot/include/usb/tcpm.h:12:/home/qschulz/work/upstream/u-boot/include/usb/pd.h:212:2: error: field within 'structpd_message' is less aligned than 'union pd_message::(anonymous at/home/qschulz/work/upstream/u-boot/include/usb/pd.h:212:2)' and is usually due to 'structpd_message' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]212 | union { | ^Quoted 5 lines
Quoted 2 lines
This file is apparently adapted from upstream Linux, where the code is identical for that struct. So not sure what to do here.
Maybe add
__packed?We could, but if upstream (Linux) didn't fix it, maybe there's a reason and we should discuss it there first?
So, looking a bit more into this, the kernel actually silences a bunch of warnings when not passing W=N to
make, one of them being unaligned-access, see
https://elixir.bootlin.com/linux/v7.0/source/scripts/Makefile.warn#L155.
So maybe we need to sync some of those back to U-Boot as well?
Quoted 3 lines
Our
scripts/Makefile.extrawarnis claimed[1] to be loosely based on Linux 6.1's, but it is actually quite different. So not sure how much we should be backporting and how.
In most cases it would be better to line up with the Linux version as much as possible. But for unaligned-access, I suspect we have good reason to warn about that since it can cause some boards to fail to boot.
Regards,
Simon
Quoted 1 line
[1]
bd3f9ee679b4("kbuild: Bump the build system to 6.1")
Quoted 49 lines · Simon Glass
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w
(quoted diff) +0
-2-o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames,etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in
Kconfigmakes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.
The point of a configuration is that it configures the build. Stuff in environment (directly or make FOO=bar) is a workaround and anti-pattern. Having to run one of the config front-end to change the config is a feature, and good thing.
Signature · 1 line
Tom
Hi Tom,
Quoted 59 lines · Tom Rini
Quoted 49 lines · Simon Glass
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w
(quoted diff) +0
-2-o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames,etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in
Kconfigmakes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.
Quoted 4 lines
The point of a configuration is that it configures the build. Stuff in environment (directly or make FOO=bar) is a workaround and anti-pattern. Having to run one of the config front-end to change the config is a feature, and good thing.
To give an example, we have boards which enable LTO, but it is sometimes useful to disable it during development - it used to be a huge time sync but something seems to have changed recently, as I don't see much of a performance gap now. We don't want people disabling LTO in the defconfig, though. The same applies for things like V=1
So I think there are build features which are of no use to end-users, but are helpful for development. That is the distinction we have had for a while and it would be a shame to lose it.
Regards,
Simon
Quoted 74 lines · Simon Glass
Hi Tom,
Quoted 59 lines · Tom Rini
Quoted 49 lines · Simon Glass
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w
(quoted diff) +0
-2-o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames,etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in
Kconfigmakes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.Quoted 4 lines
The point of a configuration is that it configures the build. Stuff in environment (directly or make FOO=bar) is a workaround and anti-pattern. Having to run one of the config front-end to change the config is a feature, and good thing.
To give an example, we have boards which enable LTO, but it is sometimes useful to disable it during development - it used to be a huge time sync but something seems to have changed recently, as I don't see much of a performance gap now. We don't want people disabling LTO in the defconfig, though. The same applies for things like V=1
Quoted 3 lines
So I think there are build features which are of no use to end-users, but are helpful for development. That is the distinction we have had for a while and it would be a shame to lose it.
Yes, the LTO thing is a good example of something we shouldn't have done really. Outside of sandbox you cannot just disable it.
Signature · 1 line
Tom
Quoted 75 lines · Tom Rini
Quoted 74 lines · Simon Glass
Hi Tom,
Quoted 59 lines · Tom Rini
Quoted 49 lines · Simon Glass
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w
(quoted diff) +0
-2-o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames,etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in
Kconfigmakes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.Quoted 4 lines
The point of a configuration is that it configures the build. Stuff in environment (directly or make FOO=bar) is a workaround and anti-pattern. Having to run one of the config front-end to change the config is a feature, and good thing.
To give an example, we have boards which enable LTO, but it is sometimes useful to disable it during development - it used to be a huge time sync but something seems to have changed recently, as I don't see much of a performance gap now. We don't want people disabling LTO in the defconfig, though. The same applies for things like V=1
Quoted 7 lines
Quoted 3 lines
So I think there are build features which are of no use to end-users, but are helpful for development. That is the distinction we have had for a while and it would be a shame to lose it.
Yes, the LTO thing is a good example of something we shouldn't have done really. Outside of sandbox you cannot just disable it.
FYI, the Linux kernel defaults to CONFIG_WERROR=y. See commit 3fe617ccafd6 ("Enable '-Werror' by default for all kernel builds") (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3fe617ccafd6f5bb33c2391d6f4eeb41c1fd0151).
I wouldn't necessarily recommend to switch it on right now, but I think it could be a good idea in the mid-term. We're also very far behind in terms of warn flags compared to the kernel. Syncing will take some time though. For now I'm looking into enabling -Werror for host tools and this resulted in (so far) 21 patches.
Cheers,
Quentin
Hi Quentin,
Quoted 77 lines · Quentin Schulz
Quoted 75 lines · Tom Rini
Quoted 74 lines · Simon Glass
Hi Tom,
Quoted 59 lines · Tom Rini
Quoted 49 lines · Simon Glass
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w
(quoted diff) +0
-2-o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames,etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in
Kconfigmakes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.Quoted 4 lines
The point of a configuration is that it configures the build. Stuff in environment (directly or make FOO=bar) is a workaround and anti-pattern. Having to run one of the config front-end to change the config is a feature, and good thing.
To give an example, we have boards which enable LTO, but it is sometimes useful to disable it during development - it used to be a huge time sync but something seems to have changed recently, as I don't see much of a performance gap now. We don't want people disabling LTO in the defconfig, though. The same applies for things like V=1
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
So I think there are build features which are of no use to end-users, but are helpful for development. That is the distinction we have had for a while and it would be a shame to lose it.
Yes, the LTO thing is a good example of something we shouldn't have done really. Outside of sandbox you cannot just disable it.
Are you sure about that? I seldom build with LTO, except for CI. For an incremental build the non-LTO is often twice as fast. Most of the time when developing new features I am just trying to make things work, so it is big time-saver in the IDE. To some extent this is changing, though (LSPs and AI tools). The main impact for me is with sandbox incremental builds.
Quoted 5 lines
Quoted 1 line
FYI, the Linux kernel defaults to
CONFIG_WERROR=y. See commit3fe617ccafd6("Enable '-Werror' by default for all kernel builds")
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3fe617ccafd6f5bb33c2391d6f4eeb41c1fd0151).
Do we suffer from this same problem?
Quoted 6 lines
I wouldn't necessarily recommend to switch it on right now, but I think it could be a good idea in the mid-term. We're also very far behind in terms of warn flags compared to the kernel. Syncing will take some time though. For now I'm looking into enabling -Werror for host tools and this resulted in (so far) 21 patches.
I must be misunderstanding what you are referring to here. I don't see any warnings when building tools-only - certainly I would not put up with that. Do you mean that you are enabling additional warnings?
We already have CI checking (which fails on the first warning) and we already show the warnings for normal builds. Importantly, without -Werror, we show *all* the warnings rather than just stopping at the first one depending on -j, etc.
So forcing this option seems to be a tax on people who fix warnings, imposed by those who don't. It really should be the other way around :-)
BTW we do have KCFLAGS which can be used to set Werror (and also perhaps other things).
Regards,
Simon
Quoted 80 lines · Simon Glass
Hi Quentin,
Quoted 77 lines · Quentin Schulz
Quoted 75 lines · Tom Rini
Quoted 74 lines · Simon Glass
Hi Tom,
Quoted 59 lines · Tom Rini
Quoted 49 lines · Simon Glass
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w
(quoted diff) +0
-2-o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames,etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in
Kconfigmakes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.Quoted 4 lines
The point of a configuration is that it configures the build. Stuff in environment (directly or make FOO=bar) is a workaround and anti-pattern. Having to run one of the config front-end to change the config is a feature, and good thing.
To give an example, we have boards which enable LTO, but it is sometimes useful to disable it during development - it used to be a huge time sync but something seems to have changed recently, as I don't see much of a performance gap now. We don't want people disabling LTO in the defconfig, though. The same applies for things like V=1
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
So I think there are build features which are of no use to end-users, but are helpful for development. That is the distinction we have had for a while and it would be a shame to lose it.
Yes, the LTO thing is a good example of something we shouldn't have done really. Outside of sandbox you cannot just disable it.
Are you sure about that?
Yes. Outside of sandbox LTO is enabled because the platform binaries will exceed their non-optional size constraints.
Quoted 6 lines
I seldom build with LTO, except for CI. For
an incremental build the non-LTO is often twice as fast. Most of the time when developing new features I am just trying to make things work, so it is big time-saver in the IDE. To some extent this is changing, though (LSPs and AI tools). The main impact for me is with sandbox incremental builds.
We could maybe just drop LTO from sandbox, now that it's enabled more widely on hardware.
Quoted 24 lines
Quoted 5 lines
Quoted 1 line
FYI, the Linux kernel defaults to
CONFIG_WERROR=y. See commit3fe617ccafd6("Enable '-Werror' by default for all kernel builds")
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3fe617ccafd6f5bb33c2391d6f4eeb41c1fd0151).Do we suffer from this same problem?
Quoted 6 lines
I wouldn't necessarily recommend to switch it on right now, but I think it could be a good idea in the mid-term. We're also very far behind in terms of warn flags compared to the kernel. Syncing will take some time though. For now I'm looking into enabling -Werror for host tools and this resulted in (so far) 21 patches.
I must be misunderstanding what you are referring to here. I don't see any warnings when building tools-only - certainly I would not put up with that. Do you mean that you are enabling additional warnings?
We already have CI checking (which fails on the first warning) and we already show the warnings for normal builds. Importantly, without -Werror, we show *all* the warnings rather than just stopping at the first one depending on -j, etc.
Quoted 6 lines
So forcing this option seems to be a tax on people who fix warnings, imposed by those who don't. It really should be the other way around :-)
BTW we do have KCFLAGS which can be used to set Werror (and also perhaps other things).
I'll note that I just had to request changes on another patch because they didn't realize warnings had to be fixed. It's quite likely that making CONFIG_WERROR=y will save more people more time (maybe document make -k? I don't know what people don't know about these days, but I do "make -kj" a lot when doing the randconfig stuff for example) than what we do today.
Signature · 1 line
Tom
Quoted 86 lines · Tom Rini
Quoted 84 lines · Simon Glass
Hi Quentin,
Quoted 81 lines · Quentin Schulz
Quoted 79 lines · Tom Rini
Quoted 77 lines · Simon Glass
Hi Tom,
Quoted 59 lines · Tom Rini
Quoted 49 lines · Simon Glass
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w
(quoted diff) +0
-2-o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames,etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in
Kconfigmakes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.Quoted 4 lines
The point of a configuration is that it configures the build. Stuff in environment (directly or make FOO=bar) is a workaround and anti-pattern. Having to run one of the config front-end to change the config is a feature, and good thing.
To give an example, we have boards which enable LTO, but it is sometimes useful to disable it during development - it used to be a huge time sync but something seems to have changed recently, as I don't see much of a performance gap now. We don't want people disabling LTO in the defconfig, though. The same applies for things like V=1
So I think there are build features which are of no use to end-users, but are helpful for development. That is the distinction we have had for a while and it would be a shame to lose it.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Yes, the LTO thing is a good example of something we shouldn't have done really. Outside of sandbox you cannot just disable it.
Are you sure about that?
Yes. Outside of sandbox LTO is enabled because the platform binaries will exceed their non-optional size constraints.
That is certainly true for some boards, but I'm not sure it is very many.
Quoted 10 lines
Quoted 7 lines
I seldom build with LTO, except for CI. For
an incremental build the non-LTO is often twice as fast. Most of the time when developing new features I am just trying to make things work, so it is big time-saver in the IDE. To some extent this is changing, though (LSPs and AI tools). The main impact for me is with sandbox incremental builds.We could maybe just drop LTO from sandbox, now that it's enabled more widely on hardware.
The nice thing about LTO for sandbox is that it tests a different build path. We could perhaps disable it for just the 'sandbox' board?
Quoted 32 lines
Quoted 25 lines
Quoted 6 lines
Quoted 2 lines
FYI, the Linux kernel defaults to
CONFIG_WERROR=y. See commit3fe617ccafd6("Enable '-Werror' by default for all kernel builds")
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3fe617ccafd6f5bb33c2391d6f4eeb41c1fd0151).Do we suffer from this same problem?
Quoted 6 lines
I wouldn't necessarily recommend to switch it on right now, but I think it could be a good idea in the mid-term. We're also very far behind in terms of warn flags compared to the kernel. Syncing will take some time though. For now I'm looking into enabling -Werror for host tools and this resulted in (so far) 21 patches.
I must be misunderstanding what you are referring to here. I don't see any warnings when building tools-only - certainly I would not put up with that. Do you mean that you are enabling additional warnings?
We already have CI checking (which fails on the first warning) and we already show the warnings for normal builds. Importantly, without -Werror, we show *all* the warnings rather than just stopping at the first one depending on -j, etc.
Quoted 6 lines
So forcing this option seems to be a tax on people who fix warnings, imposed by those who don't. It really should be the other way around :-)
BTW we do have KCFLAGS which can be used to set Werror (and also perhaps other things).
Quoted 6 lines
I'll note that I just had to request changes on another patch because they didn't realize warnings had to be fixed. It's quite likely that making
CONFIG_WERROR=ywill save more people more time (maybe document make -k? I don't know what people don't know about these days, but I do "make -kj" a lot when doing the randconfig stuff for example) than what we do today.
Yes, could be, particular if people are not using -s with make. I really dislike warnings quite a lot. I'd be happy enough with CONFIG_WERROR if we have an env var to disable -Werror like we have for LTO.
Regards,
Simon
Hi Simon,
Quoted 150 lines · Simon Glass
Quoted 86 lines · Tom Rini
Quoted 84 lines · Simon Glass
Hi Quentin,
Quoted 81 lines · Quentin Schulz
Quoted 79 lines · Tom Rini
Quoted 77 lines · Simon Glass
Hi Tom,
Quoted 59 lines · Tom Rini
Quoted 49 lines · Simon Glass
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w
(quoted diff) +0
-2-o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames,etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in
Kconfigmakes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.Quoted 4 lines
The point of a configuration is that it configures the build. Stuff in environment (directly or make FOO=bar) is a workaround and anti-pattern. Having to run one of the config front-end to change the config is a feature, and good thing.
To give an example, we have boards which enable LTO, but it is sometimes useful to disable it during development - it used to be a huge time sync but something seems to have changed recently, as I don't see much of a performance gap now. We don't want people disabling LTO in the defconfig, though. The same applies for things like V=1
So I think there are build features which are of no use to end-users, but are helpful for development. That is the distinction we have had for a while and it would be a shame to lose it.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Yes, the LTO thing is a good example of something we shouldn't have done really. Outside of sandbox you cannot just disable it.
Are you sure about that?
Yes. Outside of sandbox LTO is enabled because the platform binaries will exceed their non-optional size constraints.
That is certainly true for some boards, but I'm not sure it is very many.
Quoted 10 lines
Quoted 7 lines
I seldom build with LTO, except for CI. For
an incremental build the non-LTO is often twice as fast. Most of the time when developing new features I am just trying to make things work, so it is big time-saver in the IDE. To some extent this is changing, though (LSPs and AI tools). The main impact for me is with sandbox incremental builds.We could maybe just drop LTO from sandbox, now that it's enabled more widely on hardware.
The nice thing about LTO for sandbox is that it tests a different build path. We could perhaps disable it for just the 'sandbox' board?
Quoted 32 lines
Quoted 25 lines
Quoted 6 lines
Quoted 2 lines
FYI, the Linux kernel defaults to
CONFIG_WERROR=y. See commit3fe617ccafd6("Enable '-Werror' by default for all kernel builds")
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3fe617ccafd6f5bb33c2391d6f4eeb41c1fd0151).Do we suffer from this same problem?
Quoted 6 lines
I wouldn't necessarily recommend to switch it on right now, but I think it could be a good idea in the mid-term. We're also very far behind in terms of warn flags compared to the kernel. Syncing will take some time though. For now I'm looking into enabling -Werror for host tools and this resulted in (so far) 21 patches.
I must be misunderstanding what you are referring to here. I don't see any warnings when building tools-only - certainly I would not put up with that. Do you mean that you are enabling additional warnings?
We already have CI checking (which fails on the first warning) and we already show the warnings for normal builds. Importantly, without -Werror, we show *all* the warnings rather than just stopping at the first one depending on -j, etc.
Quoted 6 lines
So forcing this option seems to be a tax on people who fix warnings, imposed by those who don't. It really should be the other way around :-)
BTW we do have KCFLAGS which can be used to set Werror (and also perhaps other things).
Quoted 6 lines
I'll note that I just had to request changes on another patch because they didn't realize warnings had to be fixed. It's quite likely that making
CONFIG_WERROR=ywill save more people more time (maybe document make -k? I don't know what people don't know about these days, but I do "make -kj" a lot when doing the randconfig stuff for example) than what we do today.
Quoted 5 lines
Yes, could be, particular if people are not using -s with make. I really dislike warnings quite a lot. I'd be happy enough with
CONFIG_WERRORif we have an env var to disable -Werror like we have for LTO.
I'll let Tom speak his mind whether that's a good idea.
I really don't want to be touching scripts/Makefile.extrawarn once sync'ed with the one in Linux kernel's, so adding some logic in there is a no-no in my book. So it means we can only change the CONFIG_WERROR symbol. But we kinda don't want to rename it as it'll likely be used throughout the source code (hopefully spreading more and more over time) since we also want to sync as much as possible kbuild/makefiles from the Linux kernel. So what I thought could be a way to make this more palatable to you would be to introduce an invisible symbol which depends on an env variable.
Something like
config DISABLE_WERROR_FROM_ENV
def_bool $(success, test "$(DISABLE_WERROR)" != "1" )
help
Allow to override CONFIG_WERROR from .config via the DISABLE_WERROR
environment variable.
config WERROR
depends on !DISABLE_WERROR_FROM_ENV
for example (untested).
Cheers,
Quentin
Quoted 178 lines · Quentin Schulz
Hi Simon,
Quoted 150 lines · Simon Glass
Quoted 86 lines · Tom Rini
Quoted 84 lines · Simon Glass
Hi Quentin,
Quoted 81 lines · Quentin Schulz
Quoted 79 lines · Tom Rini
Quoted 77 lines · Simon Glass
Hi Tom,
Quoted 59 lines · Tom Rini
Quoted 49 lines · Simon Glass
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w
(quoted diff) +0
-2-o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames,etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in
Kconfigmakes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.Quoted 4 lines
The point of a configuration is that it configures the build. Stuff in environment (directly or make FOO=bar) is a workaround and anti-pattern. Having to run one of the config front-end to change the config is a feature, and good thing.
To give an example, we have boards which enable LTO, but it is sometimes useful to disable it during development - it used to be a huge time sync but something seems to have changed recently, as I don't see much of a performance gap now. We don't want people disabling LTO in the defconfig, though. The same applies for things like V=1
So I think there are build features which are of no use to end-users, but are helpful for development. That is the distinction we have had for a while and it would be a shame to lose it.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Yes, the LTO thing is a good example of something we shouldn't have done really. Outside of sandbox you cannot just disable it.
Are you sure about that?
Yes. Outside of sandbox LTO is enabled because the platform binaries will exceed their non-optional size constraints.
That is certainly true for some boards, but I'm not sure it is very many.
Quoted 10 lines
Quoted 7 lines
I seldom build with LTO, except for CI. For
an incremental build the non-LTO is often twice as fast. Most of the time when developing new features I am just trying to make things work, so it is big time-saver in the IDE. To some extent this is changing, though (LSPs and AI tools). The main impact for me is with sandbox incremental builds.We could maybe just drop LTO from sandbox, now that it's enabled more widely on hardware.
The nice thing about LTO for sandbox is that it tests a different build path. We could perhaps disable it for just the 'sandbox' board?
Quoted 32 lines
Quoted 25 lines
Quoted 6 lines
Quoted 2 lines
FYI, the Linux kernel defaults to
CONFIG_WERROR=y. See commit3fe617ccafd6("Enable '-Werror' by default for all kernel builds")
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3fe617ccafd6f5bb33c2391d6f4eeb41c1fd0151).Do we suffer from this same problem?
Quoted 6 lines
I wouldn't necessarily recommend to switch it on right now, but I think it could be a good idea in the mid-term. We're also very far behind in terms of warn flags compared to the kernel. Syncing will take some time though. For now I'm looking into enabling -Werror for host tools and this resulted in (so far) 21 patches.
I must be misunderstanding what you are referring to here. I don't see any warnings when building tools-only - certainly I would not put up with that. Do you mean that you are enabling additional warnings?
We already have CI checking (which fails on the first warning) and we already show the warnings for normal builds. Importantly, without -Werror, we show *all* the warnings rather than just stopping at the first one depending on -j, etc.
Quoted 6 lines
So forcing this option seems to be a tax on people who fix warnings, imposed by those who don't. It really should be the other way around :-)
BTW we do have KCFLAGS which can be used to set Werror (and also perhaps other things).
Quoted 6 lines
I'll note that I just had to request changes on another patch because they didn't realize warnings had to be fixed. It's quite likely that making
CONFIG_WERROR=ywill save more people more time (maybe document make -k? I don't know what people don't know about these days, but I do "make -kj" a lot when doing the randconfig stuff for example) than what we do today.Quoted 5 lines
Yes, could be, particular if people are not using -s with make. I really dislike warnings quite a lot. I'd be happy enough with
CONFIG_WERRORif we have an env var to disable -Werror like we have for LTO.I'll let Tom speak his mind whether that's a good idea.
I really don't want to be touching
scripts/Makefile.extrawarnonce sync'ed with the one in Linux kernel's, so adding some logic in there is a no-no in my book. So it means we can only change theCONFIG_WERRORsymbol. But we kinda don't want to rename it as it'll likely be used throughout the source code (hopefully spreading more and more over time) since we also want to sync as much as possible kbuild/makefiles from the Linux kernel. So what I thought could be a way to make this more palatable to you would be to introduce an invisible symbol which depends on an env variable.Something like
config
DISABLE_WERROR_FROM_ENV
def_bool$(success, test "$(DISABLE_WERROR)" != "1" )
help
Allow to overrideCONFIG_WERRORfrom .config via theDISABLE_WERROR
environment variable.
Quoted 4 lines
config WERROR
depends on !DISABLE_WERROR_FROM_ENVfor example (untested).
Yes, I thought I was clear enough earlier in the thread. Changing this behavior from the environment isn't something we should do and is bad design. We're stuck with the LTO one for the moment and should not add more.
Signature · 1 line
Tom
Hi Quentin,
Quoted 180 lines · Quentin Schulz
Hi Simon,
Quoted 150 lines · Simon Glass
Quoted 86 lines · Tom Rini
Quoted 84 lines · Simon Glass
Hi Quentin,
Quoted 81 lines · Quentin Schulz
Quoted 79 lines · Tom Rini
Quoted 77 lines · Simon Glass
Hi Tom,
Quoted 59 lines · Tom Rini
Quoted 49 lines · Simon Glass
Hi Quentin,
Quoted 29 lines · Quentin Schulz
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Quentin,
Quoted 5 lines · Quentin Schulz
Hi all,
I'm looking into force-enabling
CONFIG_WERRORfor all Rockchip SoCs. First, let me know if this is a bad idea :)Quoted 8 lines
I don't like it, as it makes development slower. I like to see all the warnings created by a change and tend to fix them iteratively. We already have a warning check in CI. A better approach is to
Can you use: KCFLAGS=-Werror
either in your environment or on the 'make' cmdline?
Well, if it's during development, you can always disable WERROR? The fact that I've never actually enabled -Werror locally in about a decade in U-Boot probably isn't a good sign. One of the things that make me wary though is compiler updates with new warnings. I've tested with clang 22, don't know when clang 23 is planned to be released. GCC 16 is about to be released as well.
Quoted 2 lines
By having the check in CI, we have a longer-than-necessary feedback loop for contributors. Has this been an issue in the past? /me shrugs
This is strange though, because people should see the warnings during development. I wonder if it is scrolling off the screen.
One my bugbears is non-actionable output. When the build succeeds (with no warnings) I see no output, using 'buildman -I --board xxx -w
(quoted diff) +0
-2-o /tmp/b/xxx' or in fact these days 'um build xxx'. This uses 'make -s' under the hood, so that it doesn't print a huge list of filenames,etc. I also sometimes do a 'fresh' build with 'um build -F xxx' to check everything is clean ('buildman -m' does something similar).
Note that buildman returns exit code 101 if there are any warnings, so the build basically fails.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
No defconfig seems to be setting this option, not sure exactly why that is.
To me this is a difference between 'functionality' options and development options. Putting development options in
Kconfigmakes it harder to turn them on and off, since you must either edit the defconfig or edit the .config file. It is easier to just pass an environment variable.Quoted 4 lines
The point of a configuration is that it configures the build. Stuff in environment (directly or make FOO=bar) is a workaround and anti-pattern. Having to run one of the config front-end to change the config is a feature, and good thing.
To give an example, we have boards which enable LTO, but it is sometimes useful to disable it during development - it used to be a huge time sync but something seems to have changed recently, as I don't see much of a performance gap now. We don't want people disabling LTO in the defconfig, though. The same applies for things like V=1
So I think there are build features which are of no use to end-users, but are helpful for development. That is the distinction we have had for a while and it would be a shame to lose it.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Yes, the LTO thing is a good example of something we shouldn't have done really. Outside of sandbox you cannot just disable it.
Are you sure about that?
Yes. Outside of sandbox LTO is enabled because the platform binaries will exceed their non-optional size constraints.
That is certainly true for some boards, but I'm not sure it is very many.
Quoted 10 lines
Quoted 7 lines
I seldom build with LTO, except for CI. For
an incremental build the non-LTO is often twice as fast. Most of the time when developing new features I am just trying to make things work, so it is big time-saver in the IDE. To some extent this is changing, though (LSPs and AI tools). The main impact for me is with sandbox incremental builds.We could maybe just drop LTO from sandbox, now that it's enabled more widely on hardware.
The nice thing about LTO for sandbox is that it tests a different build path. We could perhaps disable it for just the 'sandbox' board?
Quoted 32 lines
Quoted 25 lines
Quoted 6 lines
Quoted 2 lines
FYI, the Linux kernel defaults to
CONFIG_WERROR=y. See commit3fe617ccafd6("Enable '-Werror' by default for all kernel builds")
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3fe617ccafd6f5bb33c2391d6f4eeb41c1fd0151).Do we suffer from this same problem?
Quoted 6 lines
I wouldn't necessarily recommend to switch it on right now, but I think it could be a good idea in the mid-term. We're also very far behind in terms of warn flags compared to the kernel. Syncing will take some time though. For now I'm looking into enabling -Werror for host tools and this resulted in (so far) 21 patches.
I must be misunderstanding what you are referring to here. I don't see any warnings when building tools-only - certainly I would not put up with that. Do you mean that you are enabling additional warnings?
We already have CI checking (which fails on the first warning) and we already show the warnings for normal builds. Importantly, without -Werror, we show *all* the warnings rather than just stopping at the first one depending on -j, etc.
Quoted 6 lines
So forcing this option seems to be a tax on people who fix warnings, imposed by those who don't. It really should be the other way around :-)
BTW we do have KCFLAGS which can be used to set Werror (and also perhaps other things).
Quoted 6 lines
I'll note that I just had to request changes on another patch because they didn't realize warnings had to be fixed. It's quite likely that making
CONFIG_WERROR=ywill save more people more time (maybe document make -k? I don't know what people don't know about these days, but I do "make -kj" a lot when doing the randconfig stuff for example) than what we do today.Quoted 5 lines
Yes, could be, particular if people are not using -s with make. I really dislike warnings quite a lot. I'd be happy enough with
CONFIG_WERRORif we have an env var to disable -Werror like we have for LTO.I'll let Tom speak his mind whether that's a good idea.
I really don't want to be touching
scripts/Makefile.extrawarnonce sync'ed with the one in Linux kernel's, so adding some logic in there is a no-no in my book. So it means we can only change theCONFIG_WERRORsymbol. But we kinda don't want to rename it as it'll likely be used throughout the source code (hopefully spreading more and more over time) since we also want to sync as much as possible kbuild/makefiles from the Linux kernel. So what I thought could be a way to make this more palatable to you would be to introduce an invisible symbol which depends on an env variable.Something like
config
DISABLE_WERROR_FROM_ENV
def_bool$(success, test "$(DISABLE_WERROR)" != "1" ) help
Allow to overrideCONFIG_WERRORfrom .config via theDISABLE_WERROR
environment variable.
Quoted 4 lines
config WERROR
depends on !DISABLE_WERROR_FROM_ENVfor example (untested).
That's clever!
But Tom is very opposed to being able to disable -Werror from the environment for boards which enable it. Let's leave it alone.
Regards,
Simon