* [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS
@ 2023-01-04 19:54 Nathan Chancellor
2023-01-04 19:54 ` [PATCH 09/14] s390/vdso: Drop unused '-s' flag from KBUILD_AFLAGS_64 Nathan Chancellor
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: nicolas, trix, linux-kbuild, llvm, Nathan Chancellor,
kernel test robot, tglx, mingo, bp, dave.hansen, x86, tsbogend,
linux-mips, mpe, npiggin, christophe.leroy, linuxppc-dev, hca,
gor, agordeev, borntraeger, svens, linux-s390, harry.wentland,
sunpeng.li, Rodrigo.Siqueira, alexander.deucher, christian.koenig,
Xinhui.Pan, amd-gfx, dri-devel
Hi all,
Clang can emit a few different warnings when it encounters a flag that it
recognizes but does not support internally. These warnings are elevated to
errors within {as,cc}-option via -Werror to catch unsupported flags that should
not be added to KBUILD_{A,C}FLAGS; see commit c3f0d0bc5b01 ("kbuild, LLVMLinux:
Add -Werror to cc-option to support clang").
If an unsupported flag is unconditionally to KBUILD_{A,C}FLAGS, all subsequent
{as,cc}-option will always fail, preventing supported and even potentially
necessary flags from getting adding to the tool flags.
One would expect these warnings to be visible in the kernel build logs since
they are added to KBUILD_{A,C}FLAGS but unfortunately, these warnings are
hidden with clang's -Qunused-arguments flag, which is added to KBUILD_CPPFLAGS
and used for both compiling and assembling files.
Patches 1-4 address the internal inconsistencies of invoking the assembler
within kbuild by using KBUILD_AFLAGS consistently and using '-x
assembler-with-cpp' over '-x assembler'. This matches how assembly files are
built across the kernel and helps avoid problems in situations where macro
definitions or warning flags are present in KBUILD_AFLAGS, which cause
instances of -Wunused-command-line-argument when the preprocessor is not called
to consume them. There were a couple of places in architecture code where this
change would break things so those are fixed first.
Patches 5-12 clean up warnings that will show up when -Qunused-argument is
dropped. I hope none of these are controversial.
Patch 13 turns two warnings into errors so that the presence of unused flags
cannot be easily ignored.
Patch 14 drops -Qunused-argument. This is done last so that it can be easily
reverted if need be.
This series has seen my personal test framework, which tests several different
configurations and architectures, with LLVM tip of tree (16.0.0). I have done
defconfig, allmodconfig, and allnoconfig builds for arm, arm64, i386, mips,
powerpc, riscv, s390, and x86_64 with GCC 12.2.0 as well but I am hoping the
rest of the test infrastructure will catch any lurking problems.
I would like this series to stay together so that there is no opportunity for
breakage so please consider giving acks so that this can be carried via the
kbuild tree.
---
Nathan Chancellor (12):
MIPS: Always use -Wa,-msoft-float and eliminate GAS_HAS_SET_HARDFLOAT
MIPS: Prefer cc-option for additions to cflags
powerpc: Remove linker flag from KBUILD_AFLAGS
powerpc/vdso: Remove unused '-s' flag from ASFLAGS
powerpc/vdso: Improve linker flags
powerpc/vdso: Remove an unsupported flag from vgettimeofday-32.o with clang
s390/vdso: Drop unused '-s' flag from KBUILD_AFLAGS_64
s390/vdso: Drop '-shared' from KBUILD_CFLAGS_64
s390/purgatory: Remove unused '-MD' and unnecessary '-c' flags
drm/amd/display: Do not add '-mhard-float' to dml_ccflags for clang
kbuild: Turn a couple more of clang's unused option warnings into errors
kbuild: Stop using '-Qunused-arguments' with clang
Nick Desaulniers (2):
x86/boot/compressed: prefer cc-option for CFLAGS additions
kbuild: Update assembler calls to use proper flags and language target
Makefile | 1 -
arch/mips/Makefile | 13 ++-------
arch/mips/include/asm/asmmacro-32.h | 4 +--
arch/mips/include/asm/asmmacro.h | 42 ++++++++++++++---------------
arch/mips/include/asm/fpregdef.h | 14 ----------
arch/mips/include/asm/mipsregs.h | 20 +++-----------
arch/mips/kernel/genex.S | 2 +-
arch/mips/kernel/r2300_fpu.S | 4 +--
arch/mips/kernel/r4k_fpu.S | 12 ++++-----
arch/mips/kvm/fpu.S | 6 ++---
arch/mips/loongson2ef/Platform | 2 +-
arch/powerpc/Makefile | 2 +-
arch/powerpc/kernel/vdso/Makefile | 25 +++++++++++------
arch/s390/kernel/vdso64/Makefile | 4 +--
arch/s390/purgatory/Makefile | 2 +-
arch/x86/boot/compressed/Makefile | 2 +-
drivers/gpu/drm/amd/display/dc/dml/Makefile | 3 ++-
scripts/Kconfig.include | 2 +-
scripts/Makefile.clang | 2 ++
scripts/Makefile.compiler | 8 +++---
scripts/as-version.sh | 2 +-
21 files changed, 74 insertions(+), 98 deletions(-)
---
base-commit: 88603b6dc419445847923fcb7fe5080067a30f98
change-id: 20221228-drop-qunused-arguments-0c5c7dae54fb
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 09/14] s390/vdso: Drop unused '-s' flag from KBUILD_AFLAGS_64
2023-01-04 19:54 [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS Nathan Chancellor
@ 2023-01-04 19:54 ` Nathan Chancellor
2023-01-05 7:27 ` Sven Schnelle
2023-01-04 19:54 ` [PATCH 10/14] s390/vdso: Drop '-shared' from KBUILD_CFLAGS_64 Nathan Chancellor
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: nicolas, trix, linux-kbuild, llvm, Nathan Chancellor,
kernel test robot, hca, gor, agordeev, borntraeger, svens,
linux-s390
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns that KBUILD_AFLAGS_64 contains '-s', which is a linking phase
option, so it is unused.
clang-16: error: argument unused during compilation: '-s' [-Werror,-Wunused-command-line-argument]
There appears to be no equivalent for '-s' in GNU as; 'as --help' on
x86_64 notes that '-s' is ignored and 's390x-linux-gnu-as --help' makes
no mention of it whatsoever.
Just drop '-s' altogether, as it has been there since the introduction
of the vDSO, which means it is likely uneeded, given there would likely
have been a report by this point.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: hca@linux.ibm.com
Cc: gor@linux.ibm.com
Cc: agordeev@linux.ibm.com
Cc: borntraeger@linux.ibm.com
Cc: svens@linux.ibm.com
Cc: linux-s390@vger.kernel.org
---
arch/s390/kernel/vdso64/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
index 9e2b95a222a9..a2fe9383d452 100644
--- a/arch/s390/kernel/vdso64/Makefile
+++ b/arch/s390/kernel/vdso64/Makefile
@@ -22,7 +22,7 @@ KBUILD_AFLAGS += -DBUILD_VDSO
KBUILD_CFLAGS += -DBUILD_VDSO -DDISABLE_BRANCH_PROFILING
KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS))
-KBUILD_AFLAGS_64 += -m64 -s
+KBUILD_AFLAGS_64 += -m64
KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
KBUILD_CFLAGS_64 += -m64 -fPIC -shared -fno-common -fno-builtin
--
2.39.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 10/14] s390/vdso: Drop '-shared' from KBUILD_CFLAGS_64
2023-01-04 19:54 [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS Nathan Chancellor
2023-01-04 19:54 ` [PATCH 09/14] s390/vdso: Drop unused '-s' flag from KBUILD_AFLAGS_64 Nathan Chancellor
@ 2023-01-04 19:54 ` Nathan Chancellor
2023-01-05 7:31 ` Sven Schnelle
2023-01-04 19:54 ` [PATCH 11/14] s390/purgatory: Remove unused '-MD' and unnecessary '-c' flags Nathan Chancellor
2023-01-05 8:00 ` [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS Heiko Carstens
3 siblings, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: nicolas, trix, linux-kbuild, llvm, Nathan Chancellor,
kernel test robot, hca, gor, agordeev, borntraeger, svens,
linux-s390
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
points out that there is a linking phase flag added to CFLAGS, which
will only be used for compiling
clang-16: error: argument unused during compilation: '-shared' [-Werror,-Wunused-command-line-argument]
'-shared' is already present in ldflags-y so it can just be dropped.
Fixes: 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link vDSO")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: hca@linux.ibm.com
Cc: gor@linux.ibm.com
Cc: agordeev@linux.ibm.com
Cc: borntraeger@linux.ibm.com
Cc: svens@linux.ibm.com
Cc: linux-s390@vger.kernel.org
---
arch/s390/kernel/vdso64/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
index a2fe9383d452..34f9542636e9 100644
--- a/arch/s390/kernel/vdso64/Makefile
+++ b/arch/s390/kernel/vdso64/Makefile
@@ -25,7 +25,7 @@ KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS))
KBUILD_AFLAGS_64 += -m64
KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
-KBUILD_CFLAGS_64 += -m64 -fPIC -shared -fno-common -fno-builtin
+KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin
ldflags-y := -fPIC -shared -soname=linux-vdso64.so.1 \
--hash-style=both --build-id=sha1 -T
--
2.39.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 11/14] s390/purgatory: Remove unused '-MD' and unnecessary '-c' flags
2023-01-04 19:54 [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS Nathan Chancellor
2023-01-04 19:54 ` [PATCH 09/14] s390/vdso: Drop unused '-s' flag from KBUILD_AFLAGS_64 Nathan Chancellor
2023-01-04 19:54 ` [PATCH 10/14] s390/vdso: Drop '-shared' from KBUILD_CFLAGS_64 Nathan Chancellor
@ 2023-01-04 19:54 ` Nathan Chancellor
2023-01-05 7:33 ` Sven Schnelle
2023-01-05 8:00 ` [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS Heiko Carstens
3 siblings, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: nicolas, trix, linux-kbuild, llvm, Nathan Chancellor,
kernel test robot, hca, gor, agordeev, borntraeger, svens,
linux-s390
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns while building objects in the purgatory folder:
clang-16: error: argument unused during compilation: '-MD' [-Werror,-Wunused-command-line-argument]
'-MMD' is always passed to the preprocessor via c_flags, even when
KBUILD_CFLAGS is overridden in a folder, so clang complains the addition
of '-MD' will be unused. Remove '-MD' to clear up this warning, as it is
unnecessary with '-MMD'.
Additionally, '-c' is also unnecessary, remove it while in the area.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: hca@linux.ibm.com
Cc: gor@linux.ibm.com
Cc: agordeev@linux.ibm.com
Cc: borntraeger@linux.ibm.com
Cc: svens@linux.ibm.com
Cc: linux-s390@vger.kernel.org
---
arch/s390/purgatory/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile
index d237bc6841cb..32573b4f9bd2 100644
--- a/arch/s390/purgatory/Makefile
+++ b/arch/s390/purgatory/Makefile
@@ -24,7 +24,7 @@ KCSAN_SANITIZE := n
KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
-KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common
+KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
KBUILD_CFLAGS += -fno-stack-protector
KBUILD_CFLAGS += $(CLANG_FLAGS)
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
--
2.39.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 09/14] s390/vdso: Drop unused '-s' flag from KBUILD_AFLAGS_64
2023-01-04 19:54 ` [PATCH 09/14] s390/vdso: Drop unused '-s' flag from KBUILD_AFLAGS_64 Nathan Chancellor
@ 2023-01-05 7:27 ` Sven Schnelle
0 siblings, 0 replies; 8+ messages in thread
From: Sven Schnelle @ 2023-01-05 7:27 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, ndesaulniers, nicolas, trix, linux-kbuild, llvm,
kernel test robot, hca, gor, agordeev, borntraeger, linux-s390
Nathan Chancellor <nathan@kernel.org> writes:
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns that KBUILD_AFLAGS_64 contains '-s', which is a linking phase
> option, so it is unused.
>
> clang-16: error: argument unused during compilation: '-s' [-Werror,-Wunused-command-line-argument]
>
> There appears to be no equivalent for '-s' in GNU as; 'as --help' on
> x86_64 notes that '-s' is ignored and 's390x-linux-gnu-as --help' makes
> no mention of it whatsoever.
>
> Just drop '-s' altogether, as it has been there since the introduction
> of the vDSO, which means it is likely uneeded, given there would likely
> have been a report by this point.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 10/14] s390/vdso: Drop '-shared' from KBUILD_CFLAGS_64
2023-01-04 19:54 ` [PATCH 10/14] s390/vdso: Drop '-shared' from KBUILD_CFLAGS_64 Nathan Chancellor
@ 2023-01-05 7:31 ` Sven Schnelle
0 siblings, 0 replies; 8+ messages in thread
From: Sven Schnelle @ 2023-01-05 7:31 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, ndesaulniers, nicolas, trix, linux-kbuild, llvm,
kernel test robot, hca, gor, agordeev, borntraeger, linux-s390
Nathan Chancellor <nathan@kernel.org> writes:
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> points out that there is a linking phase flag added to CFLAGS, which
> will only be used for compiling
>
> clang-16: error: argument unused during compilation: '-shared' [-Werror,-Wunused-command-line-argument]
>
> '-shared' is already present in ldflags-y so it can just be dropped.
>
> Fixes: 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link vDSO")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 11/14] s390/purgatory: Remove unused '-MD' and unnecessary '-c' flags
2023-01-04 19:54 ` [PATCH 11/14] s390/purgatory: Remove unused '-MD' and unnecessary '-c' flags Nathan Chancellor
@ 2023-01-05 7:33 ` Sven Schnelle
0 siblings, 0 replies; 8+ messages in thread
From: Sven Schnelle @ 2023-01-05 7:33 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, ndesaulniers, nicolas, trix, linux-kbuild, llvm,
kernel test robot, hca, gor, agordeev, borntraeger, linux-s390
Nathan Chancellor <nathan@kernel.org> writes:
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns while building objects in the purgatory folder:
>
> clang-16: error: argument unused during compilation: '-MD' [-Werror,-Wunused-command-line-argument]
>
> '-MMD' is always passed to the preprocessor via c_flags, even when
> KBUILD_CFLAGS is overridden in a folder, so clang complains the addition
> of '-MD' will be unused. Remove '-MD' to clear up this warning, as it is
> unnecessary with '-MMD'.
>
> Additionally, '-c' is also unnecessary, remove it while in the area.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS
2023-01-04 19:54 [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS Nathan Chancellor
` (2 preceding siblings ...)
2023-01-04 19:54 ` [PATCH 11/14] s390/purgatory: Remove unused '-MD' and unnecessary '-c' flags Nathan Chancellor
@ 2023-01-05 8:00 ` Heiko Carstens
3 siblings, 0 replies; 8+ messages in thread
From: Heiko Carstens @ 2023-01-05 8:00 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, ndesaulniers, nicolas, trix, linux-kbuild, llvm,
kernel test robot, tglx, mingo, bp, dave.hansen, x86, tsbogend,
linux-mips, mpe, npiggin, christophe.leroy, linuxppc-dev, gor,
agordeev, borntraeger, svens, linux-s390, harry.wentland,
sunpeng.li, Rodrigo.Siqueira, alexander.deucher, christian.koenig,
Xinhui.Pan, amd-gfx, dri-devel
On Wed, Jan 04, 2023 at 12:54:18PM -0700, Nathan Chancellor wrote:
> Hi all,
...
> This series has seen my personal test framework, which tests several different
> configurations and architectures, with LLVM tip of tree (16.0.0). I have done
> defconfig, allmodconfig, and allnoconfig builds for arm, arm64, i386, mips,
> powerpc, riscv, s390, and x86_64 with GCC 12.2.0 as well but I am hoping the
> rest of the test infrastructure will catch any lurking problems.
>
> I would like this series to stay together so that there is no opportunity for
> breakage so please consider giving acks so that this can be carried via the
> kbuild tree.
...
> s390/vdso: Drop unused '-s' flag from KBUILD_AFLAGS_64
> s390/vdso: Drop '-shared' from KBUILD_CFLAGS_64
> s390/purgatory: Remove unused '-MD' and unnecessary '-c' flags
...
> arch/s390/kernel/vdso64/Makefile | 4 +--
> arch/s390/purgatory/Makefile | 2 +-
For the s390 bits:
Acked-by: Heiko Carstens <hca@linux.ibm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-01-05 8:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04 19:54 [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS Nathan Chancellor
2023-01-04 19:54 ` [PATCH 09/14] s390/vdso: Drop unused '-s' flag from KBUILD_AFLAGS_64 Nathan Chancellor
2023-01-05 7:27 ` Sven Schnelle
2023-01-04 19:54 ` [PATCH 10/14] s390/vdso: Drop '-shared' from KBUILD_CFLAGS_64 Nathan Chancellor
2023-01-05 7:31 ` Sven Schnelle
2023-01-04 19:54 ` [PATCH 11/14] s390/purgatory: Remove unused '-MD' and unnecessary '-c' flags Nathan Chancellor
2023-01-05 7:33 ` Sven Schnelle
2023-01-05 8:00 ` [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).