From: Prarit Bhargava prarit@redhat.com
makefile: Add -Werror support for RHEL
The -Werror flag should be enabled for RHEL. In ARK, however, it is a bit tricky to enable -Werror as a build bug occasionally leaks through upstream review and into Linus' tree. As a consequence, CONFIG_WERROR cannot be enabled in ARK but the code to add the flag for RHEL commpiles can be added to the top-level makefile.
This code could be placed in the top-level Makefile, around the -Werror line added by Linus in 3fe617ccafd6 ("Enable '-Werror' by default for all kernel builds"), but given the amount of RHEL Only code here it is best to keep it separated in our top-level makefile. Reviewers should note that there is no harm in calling 'KBUILD_CFLAGS += -Werror' twice and that -Werror only appears once in gcc calls when compiling kernel files.
Signed-off-by: Prarit Bhargava prarit@redhat.com
diff --git a/makefile b/makefile index blahblah..blahblah 100644 --- a/makefile +++ b/makefile @@ -14,3 +14,13 @@ dist-%:: distg-%:: $(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
+# Enable -Werror for RHEL +ifneq ($(DISABLE_WERROR),1) +ifneq ($(WITH_GCOV),1) +ifeq ($(KBUILD_EXTMOD),) +ifneq (,$(filter $(ARCH), x86 x86_64 powerpc s390 aarch64)) +KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror +endif +endif +endif +endif
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2240
From: Brian Masney on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2240#note_1230232...
Do you also need to add `KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y)`? This is from https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit /?id=efa80b028c7a9
From: Brian Masney on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2240#note_1230234...
OK, good point about not enabling it on ARK.
From: Don Zickus on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2240#note_1230246...
@prarit - hmm, ok I am torn here. I thank you for respecting the 'do not break ARK approach'. But then I wonder what is the value of this in ARK (besides the obvious don't lose changes)? Because once your fork for RHEL, you are now stuck for XX weeks until this backlog of errors are cleaned up. Or you just disable it to move forward (which probably happened for RHEL-9).
The value of ARK/rawhide is discovering potential RHEL problems early and resolving them before RHEL sees them. Of course, fixing them can be a firedrill but I am trying to find techniques to minimize that and become more async.
Can we say upstream GA needs to be -Werror clean (for ARK), but give ourselves ~8 weeks to resolve them. This means using CONFIG_WERROR becomes a RHEL thing but maybe we track WARNINGS during the -rc cycle that need resolving?
Just trying to brainstorm using the idea of -Werror for ARK to give value to RHEL without creating the OMG firedrill behind it.
From: Prarit Bhargava on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2240#note_1230393...
Oh it certainly does need that line. I'll add it.
kernel@lists.fedoraproject.org