* [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS
@ 2023-01-04 19:54 ` Nathan Chancellor
0 siblings, 0 replies; 76+ 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] 76+ messages in thread
* [PATCH 01/14] x86/boot/compressed: prefer cc-option for CFLAGS additions
2023-01-04 19:54 ` Nathan Chancellor
` (2 preceding siblings ...)
(?)
@ 2023-01-04 19:54 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ 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
From: Nick Desaulniers <ndesaulniers@google.com>
as-option tests new options using KBUILD_CFLAGS, which causes problems
when using as-option to update KBUILD_AFLAGS because many compiler
options are not valid assembler options.
This will be fixed in a follow up patch. Before doing so, move the
assembler test for -Wa,-mrelax-relocations=no from using as-option to
cc-option.
Link: https://lore.kernel.org/llvm/CAK7LNATcHt7GcXZ=jMszyH=+M_LC9Qr6yeAGRCBbE6xriLxtUQ@mail.gmail.com/
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: tglx@linutronix.de
Cc: mingo@redhat.com
Cc: bp@alien8.de
Cc: dave.hansen@linux.intel.com
Cc: x86@kernel.org
---
arch/x86/boot/compressed/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 1acff356d97a..6b6cfe607bdb 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -50,7 +50,7 @@ KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
KBUILD_CFLAGS += -D__DISABLE_EXPORTS
# Disable relocation relaxation in case the link is not PIE.
-KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no)
+KBUILD_CFLAGS += $(call cc-option,-Wa$(comma)-mrelax-relocations=no)
KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h
# sev.c indirectly inludes inat-table.h which is generated during
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS
@ 2023-01-04 19:54 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: trix, dave.hansen, dri-devel, amd-gfx, agordeev, linux-s390,
kernel test robot, mpe, x86, Rodrigo.Siqueira, christophe.leroy,
mingo, borntraeger, llvm, nicolas, gor, linux-kbuild, sunpeng.li,
hca, npiggin, Nathan Chancellor, bp, tglx, tsbogend, Xinhui.Pan,
linux-mips, svens, alexander.deucher, linuxppc-dev,
christian.koenig
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] 76+ messages in thread
* [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS
@ 2023-01-04 19:54 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: trix, dave.hansen, dri-devel, amd-gfx, agordeev, linux-s390,
kernel test robot, mpe, x86, Rodrigo.Siqueira, christophe.leroy,
mingo, borntraeger, harry.wentland, llvm, nicolas, gor,
linux-kbuild, sunpeng.li, hca, npiggin, Nathan Chancellor, bp,
tglx, tsbogend, Xinhui.Pan, linux-mips, svens, alexander.deucher,
linuxppc-dev, christian.koenig
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] 76+ messages in thread
* [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS
@ 2023-01-04 19:54 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: trix, dave.hansen, dri-devel, amd-gfx, agordeev, linux-s390,
kernel test robot, x86, Rodrigo.Siqueira, mingo, borntraeger,
harry.wentland, llvm, nicolas, gor, linux-kbuild, sunpeng.li,
hca, npiggin, Nathan Chancellor, bp, tglx, tsbogend, Xinhui.Pan,
linux-mips, svens, alexander.deucher, linuxppc-dev,
christian.koenig
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] 76+ messages in thread
* [PATCH 02/14] MIPS: Always use -Wa,-msoft-float and eliminate GAS_HAS_SET_HARDFLOAT
2023-01-04 19:54 ` Nathan Chancellor
` (3 preceding siblings ...)
(?)
@ 2023-01-04 19:54 ` Nathan Chancellor
2023-01-09 21:18 ` Nick Desaulniers
` (2 more replies)
-1 siblings, 3 replies; 76+ 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, tsbogend, linux-mips
-Wa,-msoft-float is tested with as-option, which will be a problem for
clang with an upcoming change to move as-option to use KBUILD_AFLAGS
instead of KBUILD_CFLAGS due to a lack of '-mno-abicalls' in
KBUILD_AFLAGS at the point that this check occurs; $(cflags-y) is added
to KBUILD_AFLAGS towards the end of this file.
clang: error: ignoring '-fno-PIE' option as it cannot be used with implicit usage of -mabicalls and the N64 ABI [-Werror,-Woption-ignored]
This could be resolved by switching to a cc-option check but
'$(cflags-y)' would need to be added so that '-mno-abicalls' is present
for the test. However, this check is no longer necessary, as
-msoft-float is supported by all supported assembler versions (GNU as
2.25+ and LLVM 11+). Eliminate GAS_HAS_SET_HARDFLOAT and all of its
uses, inlining SET_HARDFLOAT where necessary.
Link: https://lore.kernel.org/202209101939.bvk64Fok-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: tsbogend@alpha.franken.de
Cc: linux-mips@vger.kernel.org
---
arch/mips/Makefile | 11 +---------
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 +++---
9 files changed, 40 insertions(+), 75 deletions(-)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 490dea07d4e0..a00a6d94e16f 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -95,7 +95,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz
# crossformat linking we rely on the elf2ecoff tool for format conversion.
#
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
-cflags-y += -msoft-float
+cflags-y += -msoft-float -Wa,-msoft-float
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
KBUILD_AFLAGS_MODULE += -mlong-calls
KBUILD_CFLAGS_MODULE += -mlong-calls
@@ -104,15 +104,6 @@ ifeq ($(CONFIG_RELOCATABLE),y)
LDFLAGS_vmlinux += --emit-relocs
endif
-#
-# pass -msoft-float to GAS if it supports it. However on newer binutils
-# (specifically newer than 2.24.51.20140728) we then also need to explicitly
-# set ".set hardfloat" in all files which manipulate floating point registers.
-#
-ifneq ($(call as-option,-Wa$(comma)-msoft-float,),)
- cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float
-endif
-
cflags-y += -ffreestanding
cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
diff --git a/arch/mips/include/asm/asmmacro-32.h b/arch/mips/include/asm/asmmacro-32.h
index 1c08c1f7903c..83a4940b7c89 100644
--- a/arch/mips/include/asm/asmmacro-32.h
+++ b/arch/mips/include/asm/asmmacro-32.h
@@ -15,7 +15,7 @@
.macro fpu_save_single thread tmp=t0
.set push
- SET_HARDFLOAT
+ .set hardfloat
cfc1 \tmp, fcr31
s.d $f0, THREAD_FPR0(\thread)
s.d $f2, THREAD_FPR2(\thread)
@@ -39,7 +39,7 @@
.macro fpu_restore_single thread tmp=t0
.set push
- SET_HARDFLOAT
+ .set hardfloat
lw \tmp, THREAD_FCR31(\thread)
l.d $f0, THREAD_FPR0(\thread)
l.d $f2, THREAD_FPR2(\thread)
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h
index ca83ada7015f..1c4438f3f2ab 100644
--- a/arch/mips/include/asm/asmmacro.h
+++ b/arch/mips/include/asm/asmmacro.h
@@ -83,7 +83,7 @@
.macro fpu_save_16even thread tmp=t0
.set push
- SET_HARDFLOAT
+ .set hardfloat
cfc1 \tmp, fcr31
sdc1 $f0, THREAD_FPR0(\thread)
sdc1 $f2, THREAD_FPR2(\thread)
@@ -109,7 +109,7 @@
.set push
.set mips64r2
.set fp=64
- SET_HARDFLOAT
+ .set hardfloat
sdc1 $f1, THREAD_FPR1(\thread)
sdc1 $f3, THREAD_FPR3(\thread)
sdc1 $f5, THREAD_FPR5(\thread)
@@ -142,7 +142,7 @@
.macro fpu_restore_16even thread tmp=t0
.set push
- SET_HARDFLOAT
+ .set hardfloat
lw \tmp, THREAD_FCR31(\thread)
ldc1 $f0, THREAD_FPR0(\thread)
ldc1 $f2, THREAD_FPR2(\thread)
@@ -168,7 +168,7 @@
.set push
.set mips64r2
.set fp=64
- SET_HARDFLOAT
+ .set hardfloat
ldc1 $f1, THREAD_FPR1(\thread)
ldc1 $f3, THREAD_FPR3(\thread)
ldc1 $f5, THREAD_FPR5(\thread)
@@ -373,7 +373,7 @@
.macro _cfcmsa rd, cs
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
insn_if_mips 0x787e0059 | (\cs << 11)
insn32_if_mm 0x587e0056 | (\cs << 11)
move \rd, $1
@@ -383,7 +383,7 @@
.macro _ctcmsa cd, rs
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
move $1, \rs
insn_if_mips 0x783e0819 | (\cd << 6)
insn32_if_mm 0x583e0816 | (\cd << 6)
@@ -393,7 +393,7 @@
.macro ld_b wd, off, base
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
PTR_ADDU $1, \base, \off
insn_if_mips 0x78000820 | (\wd << 6)
insn32_if_mm 0x58000807 | (\wd << 6)
@@ -403,7 +403,7 @@
.macro ld_h wd, off, base
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
PTR_ADDU $1, \base, \off
insn_if_mips 0x78000821 | (\wd << 6)
insn32_if_mm 0x58000817 | (\wd << 6)
@@ -413,7 +413,7 @@
.macro ld_w wd, off, base
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
PTR_ADDU $1, \base, \off
insn_if_mips 0x78000822 | (\wd << 6)
insn32_if_mm 0x58000827 | (\wd << 6)
@@ -423,7 +423,7 @@
.macro ld_d wd, off, base
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
PTR_ADDU $1, \base, \off
insn_if_mips 0x78000823 | (\wd << 6)
insn32_if_mm 0x58000837 | (\wd << 6)
@@ -433,7 +433,7 @@
.macro st_b wd, off, base
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
PTR_ADDU $1, \base, \off
insn_if_mips 0x78000824 | (\wd << 6)
insn32_if_mm 0x5800080f | (\wd << 6)
@@ -443,7 +443,7 @@
.macro st_h wd, off, base
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
PTR_ADDU $1, \base, \off
insn_if_mips 0x78000825 | (\wd << 6)
insn32_if_mm 0x5800081f | (\wd << 6)
@@ -453,7 +453,7 @@
.macro st_w wd, off, base
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
PTR_ADDU $1, \base, \off
insn_if_mips 0x78000826 | (\wd << 6)
insn32_if_mm 0x5800082f | (\wd << 6)
@@ -463,7 +463,7 @@
.macro st_d wd, off, base
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
PTR_ADDU $1, \base, \off
insn_if_mips 0x78000827 | (\wd << 6)
insn32_if_mm 0x5800083f | (\wd << 6)
@@ -473,7 +473,7 @@
.macro copy_s_w ws, n
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
insn_if_mips 0x78b00059 | (\n << 16) | (\ws << 11)
insn32_if_mm 0x58b00056 | (\n << 16) | (\ws << 11)
.set pop
@@ -482,7 +482,7 @@
.macro copy_s_d ws, n
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
insn_if_mips 0x78b80059 | (\n << 16) | (\ws << 11)
insn32_if_mm 0x58b80056 | (\n << 16) | (\ws << 11)
.set pop
@@ -491,7 +491,7 @@
.macro insert_w wd, n
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
insn_if_mips 0x79300819 | (\n << 16) | (\wd << 6)
insn32_if_mm 0x59300816 | (\n << 16) | (\wd << 6)
.set pop
@@ -500,7 +500,7 @@
.macro insert_d wd, n
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
insn_if_mips 0x79380819 | (\n << 16) | (\wd << 6)
insn32_if_mm 0x59380816 | (\n << 16) | (\wd << 6)
.set pop
@@ -553,7 +553,7 @@
st_d 29, THREAD_FPR29 - FPR_BASE_OFFS, FPR_BASE
st_d 30, THREAD_FPR30 - FPR_BASE_OFFS, FPR_BASE
st_d 31, THREAD_FPR31 - FPR_BASE_OFFS, FPR_BASE
- SET_HARDFLOAT
+ .set hardfloat
_cfcmsa $1, MSA_CSR
sw $1, THREAD_MSA_CSR(\thread)
.set pop
@@ -562,7 +562,7 @@
.macro msa_restore_all thread
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
lw $1, THREAD_MSA_CSR(\thread)
_ctcmsa MSA_CSR, $1
#ifdef TOOLCHAIN_SUPPORTS_MSA
@@ -618,7 +618,7 @@
.macro msa_init_all_upper
.set push
.set noat
- SET_HARDFLOAT
+ .set hardfloat
not $1, zero
msa_init_upper 0
msa_init_upper 1
diff --git a/arch/mips/include/asm/fpregdef.h b/arch/mips/include/asm/fpregdef.h
index f184ba088532..429481f9028d 100644
--- a/arch/mips/include/asm/fpregdef.h
+++ b/arch/mips/include/asm/fpregdef.h
@@ -14,20 +14,6 @@
#include <asm/sgidefs.h>
-/*
- * starting with binutils 2.24.51.20140729, MIPS binutils warn about mixing
- * hardfloat and softfloat object files. The kernel build uses soft-float by
- * default, so we also need to pass -msoft-float along to GAS if it supports it.
- * But this in turn causes assembler errors in files which access hardfloat
- * registers. We detect if GAS supports "-msoft-float" in the Makefile and
- * explicitly put ".set hardfloat" where floating point registers are touched.
- */
-#ifdef GAS_HAS_SET_HARDFLOAT
-#define SET_HARDFLOAT .set hardfloat
-#else
-#define SET_HARDFLOAT
-#endif
-
#if _MIPS_SIM == _MIPS_SIM_ABI32
/*
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 99eeafe6dcab..2d53704d9f24 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -2367,7 +2367,7 @@ do { \
/*
* Macros to access the floating point coprocessor control registers
*/
-#define _read_32bit_cp1_register(source, gas_hardfloat) \
+#define read_32bit_cp1_register(source) \
({ \
unsigned int __res; \
\
@@ -2377,36 +2377,24 @@ do { \
" # gas fails to assemble cfc1 for some archs, \n" \
" # like Octeon. \n" \
" .set mips1 \n" \
- " "STR(gas_hardfloat)" \n" \
+ " .set hardfloat \n" \
" cfc1 %0,"STR(source)" \n" \
" .set pop \n" \
: "=r" (__res)); \
__res; \
})
-#define _write_32bit_cp1_register(dest, val, gas_hardfloat) \
+#define write_32bit_cp1_register(dest, val) \
do { \
__asm__ __volatile__( \
" .set push \n" \
" .set reorder \n" \
- " "STR(gas_hardfloat)" \n" \
+ " .set hardfloat \n" \
" ctc1 %0,"STR(dest)" \n" \
" .set pop \n" \
: : "r" (val)); \
} while (0)
-#ifdef GAS_HAS_SET_HARDFLOAT
-#define read_32bit_cp1_register(source) \
- _read_32bit_cp1_register(source, .set hardfloat)
-#define write_32bit_cp1_register(dest, val) \
- _write_32bit_cp1_register(dest, val, .set hardfloat)
-#else
-#define read_32bit_cp1_register(source) \
- _read_32bit_cp1_register(source, )
-#define write_32bit_cp1_register(dest, val) \
- _write_32bit_cp1_register(dest, val, )
-#endif
-
#ifdef TOOLCHAIN_SUPPORTS_DSP
#define rddsp(mask) \
({ \
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 3425df6019c0..b6de8e88c1bd 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -480,7 +480,7 @@ NESTED(nmi_handler, PT_SIZE, sp)
.set push
/* gas fails to assemble cfc1 for some archs (octeon).*/ \
.set mips1
- SET_HARDFLOAT
+ .set hardfloat
cfc1 a1, fcr31
.set pop
.endm
diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S
index 2748c55820c2..6c745aa9e825 100644
--- a/arch/mips/kernel/r2300_fpu.S
+++ b/arch/mips/kernel/r2300_fpu.S
@@ -64,7 +64,7 @@ LEAF(_restore_fp)
*/
LEAF(_save_fp_context)
.set push
- SET_HARDFLOAT
+ .set hardfloat
li v0, 0 # assume success
cfc1 t1, fcr31
EX2(s.d $f0, 0(a0))
@@ -98,7 +98,7 @@ LEAF(_save_fp_context)
*/
LEAF(_restore_fp_context)
.set push
- SET_HARDFLOAT
+ .set hardfloat
li v0, 0 # assume success
EX(lw t0, (a1))
EX2(l.d $f0, 0(a0))
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
index 2e687c60bc4f..4e8c98517d9d 100644
--- a/arch/mips/kernel/r4k_fpu.S
+++ b/arch/mips/kernel/r4k_fpu.S
@@ -26,7 +26,7 @@
.macro EX insn, reg, src
.set push
- SET_HARDFLOAT
+ .set hardfloat
.set nomacro
.ex\@: \insn \reg, \src
.set pop
@@ -98,14 +98,14 @@ LEAF(_init_msa_upper)
*/
LEAF(_save_fp_context)
.set push
- SET_HARDFLOAT
+ .set hardfloat
cfc1 t1, fcr31
.set pop
#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPSR2) || \
defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
.set push
- SET_HARDFLOAT
+ .set hardfloat
#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5)
.set mips32r2
.set fp=64
@@ -135,7 +135,7 @@ LEAF(_save_fp_context)
#endif
.set push
- SET_HARDFLOAT
+ .set hardfloat
/* Store the 16 even double precision registers */
EX sdc1 $f0, 0(a0)
EX sdc1 $f2, 16(a0)
@@ -173,7 +173,7 @@ LEAF(_restore_fp_context)
#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPSR2) || \
defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
.set push
- SET_HARDFLOAT
+ .set hardfloat
#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5)
.set mips32r2
.set fp=64
@@ -201,7 +201,7 @@ LEAF(_restore_fp_context)
1: .set pop
#endif
.set push
- SET_HARDFLOAT
+ .set hardfloat
EX ldc1 $f0, 0(a0)
EX ldc1 $f2, 16(a0)
EX ldc1 $f4, 32(a0)
diff --git a/arch/mips/kvm/fpu.S b/arch/mips/kvm/fpu.S
index 16f17c6390dd..eb2e8cc3532f 100644
--- a/arch/mips/kvm/fpu.S
+++ b/arch/mips/kvm/fpu.S
@@ -22,7 +22,7 @@
LEAF(__kvm_save_fpu)
.set push
- SET_HARDFLOAT
+ .set hardfloat
.set fp=64
mfc0 t0, CP0_STATUS
sll t0, t0, 5 # is Status.FR set?
@@ -66,7 +66,7 @@ LEAF(__kvm_save_fpu)
LEAF(__kvm_restore_fpu)
.set push
- SET_HARDFLOAT
+ .set hardfloat
.set fp=64
mfc0 t0, CP0_STATUS
sll t0, t0, 5 # is Status.FR set?
@@ -110,7 +110,7 @@ LEAF(__kvm_restore_fpu)
LEAF(__kvm_restore_fcsr)
.set push
- SET_HARDFLOAT
+ .set hardfloat
lw t0, VCPU_FCR31(a0)
/*
* The ctc1 must stay at this offset in __kvm_restore_fcsr.
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 03/14] MIPS: Prefer cc-option for additions to cflags
2023-01-04 19:54 ` Nathan Chancellor
` (4 preceding siblings ...)
(?)
@ 2023-01-04 19:54 ` Nathan Chancellor
2023-01-09 21:21 ` Nick Desaulniers
` (2 more replies)
-1 siblings, 3 replies; 76+ 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, tsbogend, linux-mips
A future change will switch as-option to use KBUILD_AFLAGS instead of
KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause
issues if the flag being tested requires a flag previously added to
KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions
so that the flags are tested properly.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: tsbogend@alpha.franken.de
Cc: linux-mips@vger.kernel.org
---
arch/mips/Makefile | 2 +-
arch/mips/loongson2ef/Platform | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index a00a6d94e16f..04e46ec24319 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -143,7 +143,7 @@ cflags-y += -fno-stack-check
#
# Avoid this by explicitly disabling that assembler behaviour.
#
-cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
+cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
#
# CPU-dependent compiler/assembler options for optimization.
diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
index eebabf9df6ac..c6f7a4b95997 100644
--- a/arch/mips/loongson2ef/Platform
+++ b/arch/mips/loongson2ef/Platform
@@ -25,7 +25,7 @@ cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f
# binutils does not merge support for the flag then we can revisit & remove
# this later - for now it ensures vendor toolchains don't cause problems.
#
-cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
+cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
# Enable the workarounds for Loongson2f
ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 04/14] kbuild: Update assembler calls to use proper flags and language target
2023-01-04 19:54 ` Nathan Chancellor
` (5 preceding siblings ...)
(?)
@ 2023-01-04 19:54 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ 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
From: Nick Desaulniers <ndesaulniers@google.com>
as-instr uses KBUILD_AFLAGS, but as-option uses KBUILD_CFLAGS. This can
cause as-option to fail unexpectedly when CONFIG_WERROR is set, because
clang will emit -Werror,-Wunused-command-line-argument for various -m
and -f flags in KBUILD_CFLAGS for assembler sources.
Callers of as-option and as-instr should be adding flags to
KBUILD_AFLAGS / aflags-y, not KBUILD_CFLAGS / cflags-y. Use
KBUILD_AFLAGS in all macros to clear up the initial problem.
Unfortunately, -Wunused-command-line-argument can still be triggered
with clang by the presence of warning flags or macro definitions because
'-x assembler' is used, instead of '-x assembler-with-cpp', which will
consume these flags. Switch to '-x assembler-with-cpp' in places where
'-x assembler' is used, as the compiler is always used as the driver for
out of line assembler sources in the kernel.
Finally, add -Werror to these macros so that they behave consistently
whether or not CONFIG_WERROR is set.
Link: https://github.com/ClangBuiltLinux/linux/issues/1699
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
[nathan: Reworded and expanded on problems in commit message
Use '-x assembler-with-cpp' in a couple more places]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Benchmarking '-x assembler' vs. '-x assembler-with-cpp' does show that
invoking the preprocessor incurs some overhead but my kernel builds do
not show any noticeable slowdowns due to how infrequently these macros
are used.
$ hyperfine -L lang assembler,assembler-with-cpp -N -w 5 "/usr/bin/gcc -x {lang} -c -o /dev/null /dev/null"
Benchmark 1: /usr/bin/gcc -x assembler -c -o /dev/null /dev/null
Time (mean ± σ): 5.5 ms ± 0.5 ms [User: 4.1 ms, System: 1.3 ms]
Range (min … max): 4.3 ms … 6.3 ms 472 runs
Benchmark 2: /usr/bin/gcc -x assembler-with-cpp -c -o /dev/null /dev/null
Time (mean ± σ): 12.7 ms ± 1.0 ms [User: 9.1 ms, System: 3.6 ms]
Range (min … max): 9.6 ms … 14.2 ms 225 runs
Summary
'/usr/bin/gcc -x assembler -c -o /dev/null /dev/null' ran
2.29 ± 0.28 times faster than '/usr/bin/gcc -x assembler-with-cpp -c -o /dev/null /dev/null'
$ hyperfine -L lang assembler,assembler-with-cpp -N -w 5 "/usr/bin/clang -x {lang} -c -o /dev/null /dev/null"
Benchmark 1: /usr/bin/clang -x assembler -c -o /dev/null /dev/null
Time (mean ± σ): 21.0 ms ± 1.1 ms [User: 9.6 ms, System: 11.1 ms]
Range (min … max): 13.9 ms … 22.0 ms 138 runs
Benchmark 2: /usr/bin/clang -x assembler-with-cpp -c -o /dev/null /dev/null
Time (mean ± σ): 56.9 ms ± 3.2 ms [User: 27.2 ms, System: 29.5 ms]
Range (min … max): 53.9 ms … 62.1 ms 48 runs
Summary
'/usr/bin/clang -x assembler -c -o /dev/null /dev/null' ran
2.71 ± 0.20 times faster than '/usr/bin/clang -x assembler-with-cpp -c -o /dev/null /dev/null'
---
scripts/Kconfig.include | 2 +-
scripts/Makefile.compiler | 8 ++++----
scripts/as-version.sh | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
index 274125307ebd..5a84b6443875 100644
--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -33,7 +33,7 @@ ld-option = $(success,$(LD) -v $(1))
# $(as-instr,<instr>)
# Return y if the assembler supports <instr>, n otherwise
-as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler -o /dev/null -)
+as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler-with-cpp -o /dev/null -)
# check if $(CC) and $(LD) exist
$(error-if,$(failure,command -v $(CC)),C compiler '$(CC)' not found)
diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index 3d8adfd34af1..7aa1fbc4aafe 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -29,16 +29,16 @@ try-run = $(shell set -e; \
fi)
# as-option
-# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
+# Usage: aflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
as-option = $(call try-run,\
- $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2))
+ $(CC) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /dev/null -o "$$TMP",$(1),$(2))
# as-instr
-# Usage: cflags-y += $(call as-instr,instr,option1,option2)
+# Usage: aflags-y += $(call as-instr,instr,option1,option2)
as-instr = $(call try-run,\
- printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
+ printf "%b\n" "$(1)" | $(CC) -Werror $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3))
# __cc-option
# Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586)
diff --git a/scripts/as-version.sh b/scripts/as-version.sh
index 1a21495e9ff0..af717476152d 100755
--- a/scripts/as-version.sh
+++ b/scripts/as-version.sh
@@ -45,7 +45,7 @@ orig_args="$@"
# Get the first line of the --version output.
IFS='
'
-set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler /dev/null -o /dev/null 2>/dev/null)
+set -- $(LC_ALL=C "$@" -Wa,--version -c -x assembler-with-cpp /dev/null -o /dev/null 2>/dev/null)
# Split the line on spaces.
IFS=' '
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 05/14] powerpc: Remove linker flag from KBUILD_AFLAGS
2023-01-04 19:54 ` Nathan Chancellor
@ 2023-01-04 19:54 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ 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, mpe, npiggin, christophe.leroy, linuxppc-dev
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
points out that KBUILD_AFLAGS contains a linker flag, which will be
used:
clang: error: -Wl,-a32: 'linker' input unused [-Werror,-Wunused-command-line-argument]
This was likely supposed to be '-Wa,-a$(BITS)'. However, this change is
unnecessary, as all supported versions of clang and gcc will pass '-a64'
or '-a32' to GNU as based on the value of '-m'; the behavior of the
latest stable release of the oldest supported major version of each
compiler is shown below and each compiler's latest release exhibits the
same behavior (GCC 12.2.0 and Clang 15.0.6).
$ powerpc64-linux-gcc --version | head -1
powerpc64-linux-gcc (GCC) 5.5.0
$ powerpc64-linux-gcc -m64 -### -x assembler-with-cpp -c -o /dev/null /dev/null &| grep 'as '
.../as -a64 -mppc64 -many -mbig -o /dev/null /tmp/cctwuBzZ.s
$ powerpc64-linux-gcc -m32 -### -x assembler-with-cpp -c -o /dev/null /dev/null &| grep 'as '
.../as -a32 -mppc -many -mbig -o /dev/null /tmp/ccaZP4mF.sg
$ clang --version | head -1
Ubuntu clang version 11.1.0-++20211011094159+1fdec59bffc1-1~exp1~20211011214622.5
$ clang --target=powerpc64-linux-gnu -fno-integrated-as -m64 -### \
-x assembler-with-cpp -c -o /dev/null /dev/null &| grep gnu-as
"/usr/bin/powerpc64-linux-gnu-as" "-a64" "-mppc64" "-many" "-o" "/dev/null" "/tmp/null-80267c.s"
$ clang --target=powerpc64-linux-gnu -fno-integrated-as -m64 -### \
-x assembler-with-cpp -c -o /dev/null /dev/null &| grep gnu-as
"/usr/bin/powerpc64-linux-gnu-as" "-a32" "-mppc" "-many" "-o" "/dev/null" "/tmp/null-ab8f8d.s"
Remove this flag altogether to avoid future issues.
Fixes: 1421dc6d4829 ("powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: mpe@ellerman.id.au
Cc: npiggin@gmail.com
Cc: christophe.leroy@csgroup.eu
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index dc4cbf0a5ca9..4fd630efe39d 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -90,7 +90,7 @@ aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
ifeq ($(HAS_BIARCH),y)
KBUILD_CFLAGS += -m$(BITS)
-KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS)
+KBUILD_AFLAGS += -m$(BITS)
KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
endif
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 05/14] powerpc: Remove linker flag from KBUILD_AFLAGS
@ 2023-01-04 19:54 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: kernel test robot, linux-kbuild, trix, llvm, npiggin,
Nathan Chancellor, linuxppc-dev, nicolas
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
points out that KBUILD_AFLAGS contains a linker flag, which will be
used:
clang: error: -Wl,-a32: 'linker' input unused [-Werror,-Wunused-command-line-argument]
This was likely supposed to be '-Wa,-a$(BITS)'. However, this change is
unnecessary, as all supported versions of clang and gcc will pass '-a64'
or '-a32' to GNU as based on the value of '-m'; the behavior of the
latest stable release of the oldest supported major version of each
compiler is shown below and each compiler's latest release exhibits the
same behavior (GCC 12.2.0 and Clang 15.0.6).
$ powerpc64-linux-gcc --version | head -1
powerpc64-linux-gcc (GCC) 5.5.0
$ powerpc64-linux-gcc -m64 -### -x assembler-with-cpp -c -o /dev/null /dev/null &| grep 'as '
.../as -a64 -mppc64 -many -mbig -o /dev/null /tmp/cctwuBzZ.s
$ powerpc64-linux-gcc -m32 -### -x assembler-with-cpp -c -o /dev/null /dev/null &| grep 'as '
.../as -a32 -mppc -many -mbig -o /dev/null /tmp/ccaZP4mF.sg
$ clang --version | head -1
Ubuntu clang version 11.1.0-++20211011094159+1fdec59bffc1-1~exp1~20211011214622.5
$ clang --target=powerpc64-linux-gnu -fno-integrated-as -m64 -### \
-x assembler-with-cpp -c -o /dev/null /dev/null &| grep gnu-as
"/usr/bin/powerpc64-linux-gnu-as" "-a64" "-mppc64" "-many" "-o" "/dev/null" "/tmp/null-80267c.s"
$ clang --target=powerpc64-linux-gnu -fno-integrated-as -m64 -### \
-x assembler-with-cpp -c -o /dev/null /dev/null &| grep gnu-as
"/usr/bin/powerpc64-linux-gnu-as" "-a32" "-mppc" "-many" "-o" "/dev/null" "/tmp/null-ab8f8d.s"
Remove this flag altogether to avoid future issues.
Fixes: 1421dc6d4829 ("powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: mpe@ellerman.id.au
Cc: npiggin@gmail.com
Cc: christophe.leroy@csgroup.eu
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index dc4cbf0a5ca9..4fd630efe39d 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -90,7 +90,7 @@ aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
ifeq ($(HAS_BIARCH),y)
KBUILD_CFLAGS += -m$(BITS)
-KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS)
+KBUILD_AFLAGS += -m$(BITS)
KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
endif
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-04 19:54 ` Nathan Chancellor
@ 2023-01-04 19:54 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ 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, mpe, npiggin, christophe.leroy, linuxppc-dev
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns that ASFLAGS 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]
Looking at the GAS sources, '-s' is only useful when targeting Solaris
and it is ignored for the powerpc target so just drop the flag
altogether, as it is not needed.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: mpe@ellerman.id.au
Cc: npiggin@gmail.com
Cc: christophe.leroy@csgroup.eu
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/kernel/vdso/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index 6a977b0d8ffc..45c0cc5d34b6 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -51,10 +51,10 @@ ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
-AS32FLAGS := -D__VDSO32__ -s
+AS32FLAGS := -D__VDSO32__
CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
-AS64FLAGS := -D__VDSO64__ -s
+AS64FLAGS := -D__VDSO64__
targets += vdso32.lds
CPPFLAGS_vdso32.lds += -P -C -Upowerpc
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-04 19:54 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: kernel test robot, linux-kbuild, trix, llvm, npiggin,
Nathan Chancellor, linuxppc-dev, nicolas
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns that ASFLAGS 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]
Looking at the GAS sources, '-s' is only useful when targeting Solaris
and it is ignored for the powerpc target so just drop the flag
altogether, as it is not needed.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: mpe@ellerman.id.au
Cc: npiggin@gmail.com
Cc: christophe.leroy@csgroup.eu
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/kernel/vdso/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index 6a977b0d8ffc..45c0cc5d34b6 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -51,10 +51,10 @@ ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
-AS32FLAGS := -D__VDSO32__ -s
+AS32FLAGS := -D__VDSO32__
CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
-AS64FLAGS := -D__VDSO64__ -s
+AS64FLAGS := -D__VDSO64__
targets += vdso32.lds
CPPFLAGS_vdso32.lds += -P -C -Upowerpc
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 07/14] powerpc/vdso: Improve linker flags
2023-01-04 19:54 ` Nathan Chancellor
@ 2023-01-04 19:54 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ 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, mpe, npiggin, christophe.leroy, linuxppc-dev
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, there
are several warnings in the PowerPC vDSO:
clang-16: error: -Wl,-soname=linux-vdso32.so.1: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-16: error: -Wl,--hash-style=both: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-16: error: argument unused during compilation: '-shared' [-Werror,-Wunused-command-line-argument]
clang-16: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
clang-16: error: argument unused during compilation: '-Wa,-maltivec' [-Werror,-Wunused-command-line-argument]
The first group of warnings point out that linker flags were being added
to all invocations of $(CC), even though they will only be used during
the final vDSO link. Move those flags to ldflags-y.
The second group of warnings are compiler or assembler flags that will
be unused during linking. Filter them out from KBUILD_CFLAGS so that
they are not used during linking.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: mpe@ellerman.id.au
Cc: npiggin@gmail.com
Cc: christophe.leroy@csgroup.eu
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/kernel/vdso/Makefile | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index 45c0cc5d34b6..769b62832b38 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -47,13 +47,17 @@ KCOV_INSTRUMENT := n
UBSAN_SANITIZE := n
KASAN_SANITIZE := n
-ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
-ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
-
-CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
+ccflags-y := -fno-common -fno-builtin
+ldflags-y := -Wl,--hash-style=both -nostdlib -shared
+ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
+# Filter flags that clang will warn are unused for linking
+ldflags-y += $(filter-out $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
+
+CC32FLAGS := -m32
+LD32FLAGS := -Wl,-soname=linux-vdso32.so.1
AS32FLAGS := -D__VDSO32__
-CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
+LD64FLAGS := -Wl,-soname=linux-vdso64.so.1
AS64FLAGS := -D__VDSO64__
targets += vdso32.lds
@@ -92,14 +96,14 @@ include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE
# actual build commands
quiet_cmd_vdso32ld_and_check = VDSO32L $@
- cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
+ cmd_vdso32ld_and_check = $(VDSOCC) $(ldflags-y) $(CC32FLAGS) $(LD32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
quiet_cmd_vdso32as = VDSO32A $@
cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
quiet_cmd_vdso32cc = VDSO32C $@
cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $<
quiet_cmd_vdso64ld_and_check = VDSO64L $@
- cmd_vdso64ld_and_check = $(VDSOCC) $(c_flags) $(CC64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
+ cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(CC64FLAGS) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
quiet_cmd_vdso64as = VDSO64A $@
cmd_vdso64as = $(VDSOCC) $(a_flags) $(CC64FLAGS) $(AS64FLAGS) -c -o $@ $<
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 07/14] powerpc/vdso: Improve linker flags
@ 2023-01-04 19:54 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: kernel test robot, linux-kbuild, trix, llvm, npiggin,
Nathan Chancellor, linuxppc-dev, nicolas
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, there
are several warnings in the PowerPC vDSO:
clang-16: error: -Wl,-soname=linux-vdso32.so.1: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-16: error: -Wl,--hash-style=both: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang-16: error: argument unused during compilation: '-shared' [-Werror,-Wunused-command-line-argument]
clang-16: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
clang-16: error: argument unused during compilation: '-Wa,-maltivec' [-Werror,-Wunused-command-line-argument]
The first group of warnings point out that linker flags were being added
to all invocations of $(CC), even though they will only be used during
the final vDSO link. Move those flags to ldflags-y.
The second group of warnings are compiler or assembler flags that will
be unused during linking. Filter them out from KBUILD_CFLAGS so that
they are not used during linking.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: mpe@ellerman.id.au
Cc: npiggin@gmail.com
Cc: christophe.leroy@csgroup.eu
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/kernel/vdso/Makefile | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index 45c0cc5d34b6..769b62832b38 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -47,13 +47,17 @@ KCOV_INSTRUMENT := n
UBSAN_SANITIZE := n
KASAN_SANITIZE := n
-ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
-ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
-
-CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
+ccflags-y := -fno-common -fno-builtin
+ldflags-y := -Wl,--hash-style=both -nostdlib -shared
+ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
+# Filter flags that clang will warn are unused for linking
+ldflags-y += $(filter-out $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
+
+CC32FLAGS := -m32
+LD32FLAGS := -Wl,-soname=linux-vdso32.so.1
AS32FLAGS := -D__VDSO32__
-CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
+LD64FLAGS := -Wl,-soname=linux-vdso64.so.1
AS64FLAGS := -D__VDSO64__
targets += vdso32.lds
@@ -92,14 +96,14 @@ include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE
# actual build commands
quiet_cmd_vdso32ld_and_check = VDSO32L $@
- cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
+ cmd_vdso32ld_and_check = $(VDSOCC) $(ldflags-y) $(CC32FLAGS) $(LD32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
quiet_cmd_vdso32as = VDSO32A $@
cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
quiet_cmd_vdso32cc = VDSO32C $@
cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $<
quiet_cmd_vdso64ld_and_check = VDSO64L $@
- cmd_vdso64ld_and_check = $(VDSOCC) $(c_flags) $(CC64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
+ cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(CC64FLAGS) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
quiet_cmd_vdso64as = VDSO64A $@
cmd_vdso64as = $(VDSOCC) $(a_flags) $(CC64FLAGS) $(AS64FLAGS) -c -o $@ $<
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 08/14] powerpc/vdso: Remove an unsupported flag from vgettimeofday-32.o with clang
2023-01-04 19:54 ` Nathan Chancellor
@ 2023-01-04 19:54 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ 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, mpe, npiggin, christophe.leroy, linuxppc-dev
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns:
clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
This flag is supported for 64-bit powerpc but not 32-bit, hence the warning.
Just remove the flag from vgettimeofday-32.o's CFLAGS when using clang, as has
been done for other flags previously.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: mpe@ellerman.id.au
Cc: npiggin@gmail.com
Cc: christophe.leroy@csgroup.eu
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/kernel/vdso/Makefile | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index 769b62832b38..4ee7d36ce752 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -16,6 +16,11 @@ ifneq ($(c-gettimeofday-y),)
CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables
CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE)
CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
+ # This flag is supported by clang for 64-bit but not 32-bit so it will cause
+ # an unused command line flag warning for this file.
+ ifdef CONFIG_CC_IS_CLANG
+ CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection
+ endif
CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y)
CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector)
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 08/14] powerpc/vdso: Remove an unsupported flag from vgettimeofday-32.o with clang
@ 2023-01-04 19:54 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: kernel test robot, linux-kbuild, trix, llvm, npiggin,
Nathan Chancellor, linuxppc-dev, nicolas
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns:
clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
This flag is supported for 64-bit powerpc but not 32-bit, hence the warning.
Just remove the flag from vgettimeofday-32.o's CFLAGS when using clang, as has
been done for other flags previously.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: mpe@ellerman.id.au
Cc: npiggin@gmail.com
Cc: christophe.leroy@csgroup.eu
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/kernel/vdso/Makefile | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index 769b62832b38..4ee7d36ce752 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -16,6 +16,11 @@ ifneq ($(c-gettimeofday-y),)
CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables
CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE)
CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
+ # This flag is supported by clang for 64-bit but not 32-bit so it will cause
+ # an unused command line flag warning for this file.
+ ifdef CONFIG_CC_IS_CLANG
+ CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection
+ endif
CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y)
CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector)
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 09/14] s390/vdso: Drop unused '-s' flag from KBUILD_AFLAGS_64
2023-01-04 19:54 ` Nathan Chancellor
` (10 preceding siblings ...)
(?)
@ 2023-01-04 19:54 ` Nathan Chancellor
2023-01-05 7:27 ` Sven Schnelle
-1 siblings, 1 reply; 76+ 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] 76+ messages in thread
* [PATCH 10/14] s390/vdso: Drop '-shared' from KBUILD_CFLAGS_64
2023-01-04 19:54 ` Nathan Chancellor
` (11 preceding siblings ...)
(?)
@ 2023-01-04 19:54 ` Nathan Chancellor
2023-01-05 7:31 ` Sven Schnelle
-1 siblings, 1 reply; 76+ 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] 76+ messages in thread
* [PATCH 11/14] s390/purgatory: Remove unused '-MD' and unnecessary '-c' flags
2023-01-04 19:54 ` Nathan Chancellor
` (12 preceding siblings ...)
(?)
@ 2023-01-04 19:54 ` Nathan Chancellor
2023-01-05 7:33 ` Sven Schnelle
-1 siblings, 1 reply; 76+ 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] 76+ messages in thread
* [PATCH 12/14] drm/amd/display: Do not add '-mhard-float' to dml_ccflags for clang
2023-01-04 19:54 ` Nathan Chancellor
(?)
@ 2023-01-04 19:54 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ 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, harry.wentland, sunpeng.li, Rodrigo.Siqueira,
alexander.deucher, christian.koenig, Xinhui.Pan, amd-gfx,
dri-devel
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns:
clang-16: error: argument unused during compilation: '-mhard-float' [-Werror,-Wunused-command-line-argument]
Similar to commit 84edc2eff827 ("selftest/fpu: avoid clang warning"),
just add this flag to GCC builds. Commit 0f0727d971f6 ("drm/amd/display:
readd -msse2 to prevent Clang from emitting libcalls to undefined SW FP
routines") added '-msse2' to prevent clang from emitting software
floating point routines.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: harry.wentland@amd.com
Cc: sunpeng.li@amd.com
Cc: Rodrigo.Siqueira@amd.com
Cc: alexander.deucher@amd.com
Cc: christian.koenig@amd.com
Cc: Xinhui.Pan@amd.com
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
---
drivers/gpu/drm/amd/display/dc/dml/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
index 0ecea87cf48f..9d0f79dff2e3 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
@@ -26,7 +26,8 @@
# subcomponents.
ifdef CONFIG_X86
-dml_ccflags := -mhard-float -msse
+dml_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
+dml_ccflags := $(dml_ccflags-y) -msse
endif
ifdef CONFIG_PPC64
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 12/14] drm/amd/display: Do not add '-mhard-float' to dml_ccflags for clang
@ 2023-01-04 19:54 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: Xinhui.Pan, kernel test robot, linux-kbuild, sunpeng.li, trix,
llvm, Rodrigo.Siqueira, amd-gfx, Nathan Chancellor, dri-devel,
alexander.deucher, christian.koenig, nicolas
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns:
clang-16: error: argument unused during compilation: '-mhard-float' [-Werror,-Wunused-command-line-argument]
Similar to commit 84edc2eff827 ("selftest/fpu: avoid clang warning"),
just add this flag to GCC builds. Commit 0f0727d971f6 ("drm/amd/display:
readd -msse2 to prevent Clang from emitting libcalls to undefined SW FP
routines") added '-msse2' to prevent clang from emitting software
floating point routines.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: harry.wentland@amd.com
Cc: sunpeng.li@amd.com
Cc: Rodrigo.Siqueira@amd.com
Cc: alexander.deucher@amd.com
Cc: christian.koenig@amd.com
Cc: Xinhui.Pan@amd.com
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
---
drivers/gpu/drm/amd/display/dc/dml/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
index 0ecea87cf48f..9d0f79dff2e3 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
@@ -26,7 +26,8 @@
# subcomponents.
ifdef CONFIG_X86
-dml_ccflags := -mhard-float -msse
+dml_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
+dml_ccflags := $(dml_ccflags-y) -msse
endif
ifdef CONFIG_PPC64
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 12/14] drm/amd/display: Do not add '-mhard-float' to dml_ccflags for clang
@ 2023-01-04 19:54 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-04 19:54 UTC (permalink / raw)
To: masahiroy, ndesaulniers
Cc: Xinhui.Pan, kernel test robot, linux-kbuild, sunpeng.li, trix,
llvm, Rodrigo.Siqueira, amd-gfx, Nathan Chancellor, dri-devel,
alexander.deucher, harry.wentland, christian.koenig, nicolas
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns:
clang-16: error: argument unused during compilation: '-mhard-float' [-Werror,-Wunused-command-line-argument]
Similar to commit 84edc2eff827 ("selftest/fpu: avoid clang warning"),
just add this flag to GCC builds. Commit 0f0727d971f6 ("drm/amd/display:
readd -msse2 to prevent Clang from emitting libcalls to undefined SW FP
routines") added '-msse2' to prevent clang from emitting software
floating point routines.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: harry.wentland@amd.com
Cc: sunpeng.li@amd.com
Cc: Rodrigo.Siqueira@amd.com
Cc: alexander.deucher@amd.com
Cc: christian.koenig@amd.com
Cc: Xinhui.Pan@amd.com
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
---
drivers/gpu/drm/amd/display/dc/dml/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
index 0ecea87cf48f..9d0f79dff2e3 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
@@ -26,7 +26,8 @@
# subcomponents.
ifdef CONFIG_X86
-dml_ccflags := -mhard-float -msse
+dml_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
+dml_ccflags := $(dml_ccflags-y) -msse
endif
ifdef CONFIG_PPC64
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 13/14] kbuild: Turn a couple more of clang's unused option warnings into errors
2023-01-04 19:54 ` Nathan Chancellor
` (14 preceding siblings ...)
(?)
@ 2023-01-04 19:54 ` Nathan Chancellor
2023-01-09 22:15 ` Nick Desaulniers
-1 siblings, 1 reply; 76+ 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
Currently, these warnings are hidden with -Qunused-arguments in
KBUILD_CPPFLAGS. Once that option is removed, these warnings should be
turned into hard errors to make unconditionally added but unsupported
flags for the current compilation mode or target obvious due to a failed
build; otherwise, the warnings might just be ignored if the build log is
not checked.
Link: https://github.com/ClangBuiltLinux/linux/issues/1587
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
scripts/Makefile.clang | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
index 87285b76adb2..70b354fa1cb4 100644
--- a/scripts/Makefile.clang
+++ b/scripts/Makefile.clang
@@ -36,6 +36,8 @@ endif
# so they can be implemented or wrapped in cc-option.
CLANG_FLAGS += -Werror=unknown-warning-option
CLANG_FLAGS += -Werror=ignored-optimization-argument
+CLANG_FLAGS += -Werror=option-ignored
+CLANG_FLAGS += -Werror=unused-command-line-argument
KBUILD_CFLAGS += $(CLANG_FLAGS)
KBUILD_AFLAGS += $(CLANG_FLAGS)
export CLANG_FLAGS
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ messages in thread
* [PATCH 14/14] kbuild: Stop using '-Qunused-arguments' with clang
2023-01-04 19:54 ` Nathan Chancellor
` (15 preceding siblings ...)
(?)
@ 2023-01-04 19:54 ` Nathan Chancellor
2023-01-09 22:17 ` Nick Desaulniers
-1 siblings, 1 reply; 76+ 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
This option masks all unused command line argument warnings, which can
hide potential issues, such as an architecture Makefile adding an
unsupported flag to KBUILD_AFLAGS or KBUILD_CFLAGS, which will cause all
as-option and cc-options to silently fail due to -Werror with no
indication as to why in the main kernel build.
Remove this flag so that warnings of this nature can be caught early and
obviously in a build.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Makefile | 1 -
1 file changed, 1 deletion(-)
diff --git a/Makefile b/Makefile
index c05b4fb7121e..4bc79d2a42f2 100644
--- a/Makefile
+++ b/Makefile
@@ -878,7 +878,6 @@ KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
ifdef CONFIG_CC_IS_CLANG
-KBUILD_CPPFLAGS += -Qunused-arguments
# The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
KBUILD_CFLAGS += -Wno-gnu
else
--
2.39.0
^ permalink raw reply related [flat|nested] 76+ 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; 76+ 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] 76+ 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; 76+ 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] 76+ 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; 76+ 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] 76+ messages in thread
* Re: [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS
2023-01-04 19:54 ` Nathan Chancellor
(?)
(?)
@ 2023-01-05 8:00 ` Heiko Carstens
-1 siblings, 0 replies; 76+ 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] 76+ messages in thread
* Re: [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS
@ 2023-01-05 8:00 ` Heiko Carstens
0 siblings, 0 replies; 76+ messages in thread
From: Heiko Carstens @ 2023-01-05 8:00 UTC (permalink / raw)
To: Nathan Chancellor
Cc: trix, dave.hansen, dri-devel, amd-gfx, agordeev, linux-s390,
kernel test robot, mpe, masahiroy, x86, Rodrigo.Siqueira,
christophe.leroy, mingo, borntraeger, llvm, nicolas, gor,
linux-kbuild, sunpeng.li, npiggin, bp, tglx, tsbogend,
Xinhui.Pan, ndesaulniers, linux-mips, svens, alexander.deucher,
linuxppc-dev, christian.koenig
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] 76+ messages in thread
* Re: [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS
@ 2023-01-05 8:00 ` Heiko Carstens
0 siblings, 0 replies; 76+ messages in thread
From: Heiko Carstens @ 2023-01-05 8:00 UTC (permalink / raw)
To: Nathan Chancellor
Cc: trix, dave.hansen, dri-devel, amd-gfx, agordeev, linux-s390,
kernel test robot, masahiroy, x86, Rodrigo.Siqueira, mingo,
borntraeger, harry.wentland, llvm, nicolas, gor, linux-kbuild,
sunpeng.li, npiggin, bp, tglx, tsbogend, Xinhui.Pan,
ndesaulniers, linux-mips, svens, alexander.deucher, linuxppc-dev,
christian.koenig
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] 76+ messages in thread
* Re: [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS
@ 2023-01-05 8:00 ` Heiko Carstens
0 siblings, 0 replies; 76+ messages in thread
From: Heiko Carstens @ 2023-01-05 8:00 UTC (permalink / raw)
To: Nathan Chancellor
Cc: trix, dave.hansen, dri-devel, amd-gfx, agordeev, linux-s390,
kernel test robot, mpe, masahiroy, x86, Rodrigo.Siqueira,
christophe.leroy, mingo, borntraeger, harry.wentland, llvm,
nicolas, gor, linux-kbuild, sunpeng.li, npiggin, bp, tglx,
tsbogend, Xinhui.Pan, ndesaulniers, linux-mips, svens,
alexander.deucher, linuxppc-dev, christian.koenig
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] 76+ messages in thread
* Re: [PATCH 12/14] drm/amd/display: Do not add '-mhard-float' to dml_ccflags for clang
2023-01-04 19:54 ` Nathan Chancellor
@ 2023-01-05 14:21 ` Alex Deucher
-1 siblings, 0 replies; 76+ messages in thread
From: Alex Deucher @ 2023-01-05 14:21 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, ndesaulniers, Xinhui.Pan, kernel test robot,
linux-kbuild, sunpeng.li, trix, llvm, Rodrigo.Siqueira, amd-gfx,
dri-devel, alexander.deucher, christian.koenig, nicolas
On Wed, Jan 4, 2023 at 2:55 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns:
>
> clang-16: error: argument unused during compilation: '-mhard-float' [-Werror,-Wunused-command-line-argument]
>
> Similar to commit 84edc2eff827 ("selftest/fpu: avoid clang warning"),
> just add this flag to GCC builds. Commit 0f0727d971f6 ("drm/amd/display:
> readd -msse2 to prevent Clang from emitting libcalls to undefined SW FP
> routines") added '-msse2' to prevent clang from emitting software
> floating point routines.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: harry.wentland@amd.com
> Cc: sunpeng.li@amd.com
> Cc: Rodrigo.Siqueira@amd.com
> Cc: alexander.deucher@amd.com
> Cc: christian.koenig@amd.com
> Cc: Xinhui.Pan@amd.com
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Feel free to take this via whatever tree makes sense.
Alex
> ---
> drivers/gpu/drm/amd/display/dc/dml/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> index 0ecea87cf48f..9d0f79dff2e3 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> @@ -26,7 +26,8 @@
> # subcomponents.
>
> ifdef CONFIG_X86
> -dml_ccflags := -mhard-float -msse
> +dml_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
> +dml_ccflags := $(dml_ccflags-y) -msse
> endif
>
> ifdef CONFIG_PPC64
>
> --
> 2.39.0
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 12/14] drm/amd/display: Do not add '-mhard-float' to dml_ccflags for clang
@ 2023-01-05 14:21 ` Alex Deucher
0 siblings, 0 replies; 76+ messages in thread
From: Alex Deucher @ 2023-01-05 14:21 UTC (permalink / raw)
To: Nathan Chancellor
Cc: llvm, kernel test robot, linux-kbuild, sunpeng.li, trix,
masahiroy, Xinhui.Pan, ndesaulniers, amd-gfx, dri-devel,
alexander.deucher, Rodrigo.Siqueira, christian.koenig, nicolas
On Wed, Jan 4, 2023 at 2:55 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns:
>
> clang-16: error: argument unused during compilation: '-mhard-float' [-Werror,-Wunused-command-line-argument]
>
> Similar to commit 84edc2eff827 ("selftest/fpu: avoid clang warning"),
> just add this flag to GCC builds. Commit 0f0727d971f6 ("drm/amd/display:
> readd -msse2 to prevent Clang from emitting libcalls to undefined SW FP
> routines") added '-msse2' to prevent clang from emitting software
> floating point routines.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: harry.wentland@amd.com
> Cc: sunpeng.li@amd.com
> Cc: Rodrigo.Siqueira@amd.com
> Cc: alexander.deucher@amd.com
> Cc: christian.koenig@amd.com
> Cc: Xinhui.Pan@amd.com
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Feel free to take this via whatever tree makes sense.
Alex
> ---
> drivers/gpu/drm/amd/display/dc/dml/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> index 0ecea87cf48f..9d0f79dff2e3 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> @@ -26,7 +26,8 @@
> # subcomponents.
>
> ifdef CONFIG_X86
> -dml_ccflags := -mhard-float -msse
> +dml_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
> +dml_ccflags := $(dml_ccflags-y) -msse
> endif
>
> ifdef CONFIG_PPC64
>
> --
> 2.39.0
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 02/14] MIPS: Always use -Wa,-msoft-float and eliminate GAS_HAS_SET_HARDFLOAT
2023-01-04 19:54 ` [PATCH 02/14] MIPS: Always use -Wa,-msoft-float and eliminate GAS_HAS_SET_HARDFLOAT Nathan Chancellor
@ 2023-01-09 21:18 ` Nick Desaulniers
2023-01-10 7:45 ` Philippe Mathieu-Daudé
2023-01-10 8:30 ` Thomas Bogendoerfer
2 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 21:18 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
tsbogend, linux-mips
On Wed, Jan 4, 2023 at 11:54 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> -Wa,-msoft-float is tested with as-option, which will be a problem for
> clang with an upcoming change to move as-option to use KBUILD_AFLAGS
> instead of KBUILD_CFLAGS due to a lack of '-mno-abicalls' in
> KBUILD_AFLAGS at the point that this check occurs; $(cflags-y) is added
> to KBUILD_AFLAGS towards the end of this file.
>
> clang: error: ignoring '-fno-PIE' option as it cannot be used with implicit usage of -mabicalls and the N64 ABI [-Werror,-Woption-ignored]
>
> This could be resolved by switching to a cc-option check but
> '$(cflags-y)' would need to be added so that '-mno-abicalls' is present
> for the test. However, this check is no longer necessary, as
> -msoft-float is supported by all supported assembler versions (GNU as
> 2.25+ and LLVM 11+). Eliminate GAS_HAS_SET_HARDFLOAT and all of its
> uses, inlining SET_HARDFLOAT where necessary.
>
> Link: https://lore.kernel.org/202209101939.bvk64Fok-lkp@intel.com/
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Cc: tsbogend@alpha.franken.de
> Cc: linux-mips@vger.kernel.org
> ---
> arch/mips/Makefile | 11 +---------
> 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 +++---
> 9 files changed, 40 insertions(+), 75 deletions(-)
>
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index 490dea07d4e0..a00a6d94e16f 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -95,7 +95,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz
> # crossformat linking we rely on the elf2ecoff tool for format conversion.
> #
> cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
> -cflags-y += -msoft-float
> +cflags-y += -msoft-float -Wa,-msoft-float
> LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
> KBUILD_AFLAGS_MODULE += -mlong-calls
> KBUILD_CFLAGS_MODULE += -mlong-calls
> @@ -104,15 +104,6 @@ ifeq ($(CONFIG_RELOCATABLE),y)
> LDFLAGS_vmlinux += --emit-relocs
> endif
>
> -#
> -# pass -msoft-float to GAS if it supports it. However on newer binutils
> -# (specifically newer than 2.24.51.20140728) we then also need to explicitly
> -# set ".set hardfloat" in all files which manipulate floating point registers.
> -#
> -ifneq ($(call as-option,-Wa$(comma)-msoft-float,),)
> - cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float
> -endif
> -
> cflags-y += -ffreestanding
>
> cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
> diff --git a/arch/mips/include/asm/asmmacro-32.h b/arch/mips/include/asm/asmmacro-32.h
> index 1c08c1f7903c..83a4940b7c89 100644
> --- a/arch/mips/include/asm/asmmacro-32.h
> +++ b/arch/mips/include/asm/asmmacro-32.h
> @@ -15,7 +15,7 @@
>
> .macro fpu_save_single thread tmp=t0
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> cfc1 \tmp, fcr31
> s.d $f0, THREAD_FPR0(\thread)
> s.d $f2, THREAD_FPR2(\thread)
> @@ -39,7 +39,7 @@
>
> .macro fpu_restore_single thread tmp=t0
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> lw \tmp, THREAD_FCR31(\thread)
> l.d $f0, THREAD_FPR0(\thread)
> l.d $f2, THREAD_FPR2(\thread)
> diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h
> index ca83ada7015f..1c4438f3f2ab 100644
> --- a/arch/mips/include/asm/asmmacro.h
> +++ b/arch/mips/include/asm/asmmacro.h
> @@ -83,7 +83,7 @@
>
> .macro fpu_save_16even thread tmp=t0
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> cfc1 \tmp, fcr31
> sdc1 $f0, THREAD_FPR0(\thread)
> sdc1 $f2, THREAD_FPR2(\thread)
> @@ -109,7 +109,7 @@
> .set push
> .set mips64r2
> .set fp=64
> - SET_HARDFLOAT
> + .set hardfloat
> sdc1 $f1, THREAD_FPR1(\thread)
> sdc1 $f3, THREAD_FPR3(\thread)
> sdc1 $f5, THREAD_FPR5(\thread)
> @@ -142,7 +142,7 @@
>
> .macro fpu_restore_16even thread tmp=t0
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> lw \tmp, THREAD_FCR31(\thread)
> ldc1 $f0, THREAD_FPR0(\thread)
> ldc1 $f2, THREAD_FPR2(\thread)
> @@ -168,7 +168,7 @@
> .set push
> .set mips64r2
> .set fp=64
> - SET_HARDFLOAT
> + .set hardfloat
> ldc1 $f1, THREAD_FPR1(\thread)
> ldc1 $f3, THREAD_FPR3(\thread)
> ldc1 $f5, THREAD_FPR5(\thread)
> @@ -373,7 +373,7 @@
> .macro _cfcmsa rd, cs
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> insn_if_mips 0x787e0059 | (\cs << 11)
> insn32_if_mm 0x587e0056 | (\cs << 11)
> move \rd, $1
> @@ -383,7 +383,7 @@
> .macro _ctcmsa cd, rs
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> move $1, \rs
> insn_if_mips 0x783e0819 | (\cd << 6)
> insn32_if_mm 0x583e0816 | (\cd << 6)
> @@ -393,7 +393,7 @@
> .macro ld_b wd, off, base
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> PTR_ADDU $1, \base, \off
> insn_if_mips 0x78000820 | (\wd << 6)
> insn32_if_mm 0x58000807 | (\wd << 6)
> @@ -403,7 +403,7 @@
> .macro ld_h wd, off, base
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> PTR_ADDU $1, \base, \off
> insn_if_mips 0x78000821 | (\wd << 6)
> insn32_if_mm 0x58000817 | (\wd << 6)
> @@ -413,7 +413,7 @@
> .macro ld_w wd, off, base
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> PTR_ADDU $1, \base, \off
> insn_if_mips 0x78000822 | (\wd << 6)
> insn32_if_mm 0x58000827 | (\wd << 6)
> @@ -423,7 +423,7 @@
> .macro ld_d wd, off, base
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> PTR_ADDU $1, \base, \off
> insn_if_mips 0x78000823 | (\wd << 6)
> insn32_if_mm 0x58000837 | (\wd << 6)
> @@ -433,7 +433,7 @@
> .macro st_b wd, off, base
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> PTR_ADDU $1, \base, \off
> insn_if_mips 0x78000824 | (\wd << 6)
> insn32_if_mm 0x5800080f | (\wd << 6)
> @@ -443,7 +443,7 @@
> .macro st_h wd, off, base
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> PTR_ADDU $1, \base, \off
> insn_if_mips 0x78000825 | (\wd << 6)
> insn32_if_mm 0x5800081f | (\wd << 6)
> @@ -453,7 +453,7 @@
> .macro st_w wd, off, base
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> PTR_ADDU $1, \base, \off
> insn_if_mips 0x78000826 | (\wd << 6)
> insn32_if_mm 0x5800082f | (\wd << 6)
> @@ -463,7 +463,7 @@
> .macro st_d wd, off, base
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> PTR_ADDU $1, \base, \off
> insn_if_mips 0x78000827 | (\wd << 6)
> insn32_if_mm 0x5800083f | (\wd << 6)
> @@ -473,7 +473,7 @@
> .macro copy_s_w ws, n
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> insn_if_mips 0x78b00059 | (\n << 16) | (\ws << 11)
> insn32_if_mm 0x58b00056 | (\n << 16) | (\ws << 11)
> .set pop
> @@ -482,7 +482,7 @@
> .macro copy_s_d ws, n
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> insn_if_mips 0x78b80059 | (\n << 16) | (\ws << 11)
> insn32_if_mm 0x58b80056 | (\n << 16) | (\ws << 11)
> .set pop
> @@ -491,7 +491,7 @@
> .macro insert_w wd, n
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> insn_if_mips 0x79300819 | (\n << 16) | (\wd << 6)
> insn32_if_mm 0x59300816 | (\n << 16) | (\wd << 6)
> .set pop
> @@ -500,7 +500,7 @@
> .macro insert_d wd, n
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> insn_if_mips 0x79380819 | (\n << 16) | (\wd << 6)
> insn32_if_mm 0x59380816 | (\n << 16) | (\wd << 6)
> .set pop
> @@ -553,7 +553,7 @@
> st_d 29, THREAD_FPR29 - FPR_BASE_OFFS, FPR_BASE
> st_d 30, THREAD_FPR30 - FPR_BASE_OFFS, FPR_BASE
> st_d 31, THREAD_FPR31 - FPR_BASE_OFFS, FPR_BASE
> - SET_HARDFLOAT
> + .set hardfloat
> _cfcmsa $1, MSA_CSR
> sw $1, THREAD_MSA_CSR(\thread)
> .set pop
> @@ -562,7 +562,7 @@
> .macro msa_restore_all thread
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> lw $1, THREAD_MSA_CSR(\thread)
> _ctcmsa MSA_CSR, $1
> #ifdef TOOLCHAIN_SUPPORTS_MSA
> @@ -618,7 +618,7 @@
> .macro msa_init_all_upper
> .set push
> .set noat
> - SET_HARDFLOAT
> + .set hardfloat
> not $1, zero
> msa_init_upper 0
> msa_init_upper 1
> diff --git a/arch/mips/include/asm/fpregdef.h b/arch/mips/include/asm/fpregdef.h
> index f184ba088532..429481f9028d 100644
> --- a/arch/mips/include/asm/fpregdef.h
> +++ b/arch/mips/include/asm/fpregdef.h
> @@ -14,20 +14,6 @@
>
> #include <asm/sgidefs.h>
>
> -/*
> - * starting with binutils 2.24.51.20140729, MIPS binutils warn about mixing
> - * hardfloat and softfloat object files. The kernel build uses soft-float by
> - * default, so we also need to pass -msoft-float along to GAS if it supports it.
> - * But this in turn causes assembler errors in files which access hardfloat
> - * registers. We detect if GAS supports "-msoft-float" in the Makefile and
> - * explicitly put ".set hardfloat" where floating point registers are touched.
> - */
> -#ifdef GAS_HAS_SET_HARDFLOAT
> -#define SET_HARDFLOAT .set hardfloat
> -#else
> -#define SET_HARDFLOAT
> -#endif
> -
> #if _MIPS_SIM == _MIPS_SIM_ABI32
>
> /*
> diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
> index 99eeafe6dcab..2d53704d9f24 100644
> --- a/arch/mips/include/asm/mipsregs.h
> +++ b/arch/mips/include/asm/mipsregs.h
> @@ -2367,7 +2367,7 @@ do { \
> /*
> * Macros to access the floating point coprocessor control registers
> */
> -#define _read_32bit_cp1_register(source, gas_hardfloat) \
> +#define read_32bit_cp1_register(source) \
> ({ \
> unsigned int __res; \
> \
> @@ -2377,36 +2377,24 @@ do { \
> " # gas fails to assemble cfc1 for some archs, \n" \
> " # like Octeon. \n" \
> " .set mips1 \n" \
> - " "STR(gas_hardfloat)" \n" \
> + " .set hardfloat \n" \
> " cfc1 %0,"STR(source)" \n" \
> " .set pop \n" \
> : "=r" (__res)); \
> __res; \
> })
>
> -#define _write_32bit_cp1_register(dest, val, gas_hardfloat) \
> +#define write_32bit_cp1_register(dest, val) \
> do { \
> __asm__ __volatile__( \
> " .set push \n" \
> " .set reorder \n" \
> - " "STR(gas_hardfloat)" \n" \
> + " .set hardfloat \n" \
> " ctc1 %0,"STR(dest)" \n" \
> " .set pop \n" \
> : : "r" (val)); \
> } while (0)
>
> -#ifdef GAS_HAS_SET_HARDFLOAT
> -#define read_32bit_cp1_register(source) \
> - _read_32bit_cp1_register(source, .set hardfloat)
> -#define write_32bit_cp1_register(dest, val) \
> - _write_32bit_cp1_register(dest, val, .set hardfloat)
> -#else
> -#define read_32bit_cp1_register(source) \
> - _read_32bit_cp1_register(source, )
> -#define write_32bit_cp1_register(dest, val) \
> - _write_32bit_cp1_register(dest, val, )
> -#endif
> -
> #ifdef TOOLCHAIN_SUPPORTS_DSP
> #define rddsp(mask) \
> ({ \
> diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
> index 3425df6019c0..b6de8e88c1bd 100644
> --- a/arch/mips/kernel/genex.S
> +++ b/arch/mips/kernel/genex.S
> @@ -480,7 +480,7 @@ NESTED(nmi_handler, PT_SIZE, sp)
> .set push
> /* gas fails to assemble cfc1 for some archs (octeon).*/ \
> .set mips1
> - SET_HARDFLOAT
> + .set hardfloat
> cfc1 a1, fcr31
> .set pop
> .endm
> diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S
> index 2748c55820c2..6c745aa9e825 100644
> --- a/arch/mips/kernel/r2300_fpu.S
> +++ b/arch/mips/kernel/r2300_fpu.S
> @@ -64,7 +64,7 @@ LEAF(_restore_fp)
> */
> LEAF(_save_fp_context)
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> li v0, 0 # assume success
> cfc1 t1, fcr31
> EX2(s.d $f0, 0(a0))
> @@ -98,7 +98,7 @@ LEAF(_save_fp_context)
> */
> LEAF(_restore_fp_context)
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> li v0, 0 # assume success
> EX(lw t0, (a1))
> EX2(l.d $f0, 0(a0))
> diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
> index 2e687c60bc4f..4e8c98517d9d 100644
> --- a/arch/mips/kernel/r4k_fpu.S
> +++ b/arch/mips/kernel/r4k_fpu.S
> @@ -26,7 +26,7 @@
>
> .macro EX insn, reg, src
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> .set nomacro
> .ex\@: \insn \reg, \src
> .set pop
> @@ -98,14 +98,14 @@ LEAF(_init_msa_upper)
> */
> LEAF(_save_fp_context)
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> cfc1 t1, fcr31
> .set pop
>
> #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPSR2) || \
> defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5)
> .set mips32r2
> .set fp=64
> @@ -135,7 +135,7 @@ LEAF(_save_fp_context)
> #endif
>
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> /* Store the 16 even double precision registers */
> EX sdc1 $f0, 0(a0)
> EX sdc1 $f2, 16(a0)
> @@ -173,7 +173,7 @@ LEAF(_restore_fp_context)
> #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPSR2) || \
> defined(CONFIG_CPU_MIPSR5) || defined(CONFIG_CPU_MIPSR6)
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR5)
> .set mips32r2
> .set fp=64
> @@ -201,7 +201,7 @@ LEAF(_restore_fp_context)
> 1: .set pop
> #endif
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> EX ldc1 $f0, 0(a0)
> EX ldc1 $f2, 16(a0)
> EX ldc1 $f4, 32(a0)
> diff --git a/arch/mips/kvm/fpu.S b/arch/mips/kvm/fpu.S
> index 16f17c6390dd..eb2e8cc3532f 100644
> --- a/arch/mips/kvm/fpu.S
> +++ b/arch/mips/kvm/fpu.S
> @@ -22,7 +22,7 @@
>
> LEAF(__kvm_save_fpu)
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> .set fp=64
> mfc0 t0, CP0_STATUS
> sll t0, t0, 5 # is Status.FR set?
> @@ -66,7 +66,7 @@ LEAF(__kvm_save_fpu)
>
> LEAF(__kvm_restore_fpu)
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> .set fp=64
> mfc0 t0, CP0_STATUS
> sll t0, t0, 5 # is Status.FR set?
> @@ -110,7 +110,7 @@ LEAF(__kvm_restore_fpu)
>
> LEAF(__kvm_restore_fcsr)
> .set push
> - SET_HARDFLOAT
> + .set hardfloat
> lw t0, VCPU_FCR31(a0)
> /*
> * The ctc1 must stay at this offset in __kvm_restore_fcsr.
>
> --
> 2.39.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 03/14] MIPS: Prefer cc-option for additions to cflags
2023-01-04 19:54 ` [PATCH 03/14] MIPS: Prefer cc-option for additions to cflags Nathan Chancellor
@ 2023-01-09 21:21 ` Nick Desaulniers
2023-01-10 7:42 ` Philippe Mathieu-Daudé
2023-01-10 8:30 ` Thomas Bogendoerfer
2 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 21:21 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
tsbogend, linux-mips
On Wed, Jan 4, 2023 at 11:54 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> A future change will switch as-option to use KBUILD_AFLAGS instead of
> KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause
> issues if the flag being tested requires a flag previously added to
> KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions
> so that the flags are tested properly.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
We don't need the trailing comma in the `call`, but it's not worth a
v2 IMO. Thanks for the patch.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Cc: tsbogend@alpha.franken.de
> Cc: linux-mips@vger.kernel.org
> ---
> arch/mips/Makefile | 2 +-
> arch/mips/loongson2ef/Platform | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index a00a6d94e16f..04e46ec24319 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -143,7 +143,7 @@ cflags-y += -fno-stack-check
> #
> # Avoid this by explicitly disabling that assembler behaviour.
> #
> -cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
> +cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
>
> #
> # CPU-dependent compiler/assembler options for optimization.
> diff --git a/arch/mips/loongson2ef/Platform b/arch/mips/loongson2ef/Platform
> index eebabf9df6ac..c6f7a4b95997 100644
> --- a/arch/mips/loongson2ef/Platform
> +++ b/arch/mips/loongson2ef/Platform
> @@ -25,7 +25,7 @@ cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f
> # binutils does not merge support for the flag then we can revisit & remove
> # this later - for now it ensures vendor toolchains don't cause problems.
> #
> -cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
> +cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
>
> # Enable the workarounds for Loongson2f
> ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
>
> --
> 2.39.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 05/14] powerpc: Remove linker flag from KBUILD_AFLAGS
2023-01-04 19:54 ` Nathan Chancellor
@ 2023-01-09 21:24 ` Nick Desaulniers
-1 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 21:24 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
mpe, npiggin, christophe.leroy, linuxppc-dev
On Wed, Jan 4, 2023 at 11:54 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> points out that KBUILD_AFLAGS contains a linker flag, which will be
> used:
>
> clang: error: -Wl,-a32: 'linker' input unused [-Werror,-Wunused-command-line-argument]
>
> This was likely supposed to be '-Wa,-a$(BITS)'. However, this change is
> unnecessary, as all supported versions of clang and gcc will pass '-a64'
> or '-a32' to GNU as based on the value of '-m'; the behavior of the
> latest stable release of the oldest supported major version of each
> compiler is shown below and each compiler's latest release exhibits the
> same behavior (GCC 12.2.0 and Clang 15.0.6).
>
> $ powerpc64-linux-gcc --version | head -1
> powerpc64-linux-gcc (GCC) 5.5.0
>
> $ powerpc64-linux-gcc -m64 -### -x assembler-with-cpp -c -o /dev/null /dev/null &| grep 'as '
> .../as -a64 -mppc64 -many -mbig -o /dev/null /tmp/cctwuBzZ.s
>
> $ powerpc64-linux-gcc -m32 -### -x assembler-with-cpp -c -o /dev/null /dev/null &| grep 'as '
> .../as -a32 -mppc -many -mbig -o /dev/null /tmp/ccaZP4mF.sg
>
> $ clang --version | head -1
> Ubuntu clang version 11.1.0-++20211011094159+1fdec59bffc1-1~exp1~20211011214622.5
>
> $ clang --target=powerpc64-linux-gnu -fno-integrated-as -m64 -### \
> -x assembler-with-cpp -c -o /dev/null /dev/null &| grep gnu-as
> "/usr/bin/powerpc64-linux-gnu-as" "-a64" "-mppc64" "-many" "-o" "/dev/null" "/tmp/null-80267c.s"
>
> $ clang --target=powerpc64-linux-gnu -fno-integrated-as -m64 -### \
> -x assembler-with-cpp -c -o /dev/null /dev/null &| grep gnu-as
> "/usr/bin/powerpc64-linux-gnu-as" "-a32" "-mppc" "-many" "-o" "/dev/null" "/tmp/null-ab8f8d.s"
>
> Remove this flag altogether to avoid future issues.
>
> Fixes: 1421dc6d4829 ("powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Cc: mpe@ellerman.id.au
> Cc: npiggin@gmail.com
> Cc: christophe.leroy@csgroup.eu
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> arch/powerpc/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index dc4cbf0a5ca9..4fd630efe39d 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -90,7 +90,7 @@ aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
>
> ifeq ($(HAS_BIARCH),y)
> KBUILD_CFLAGS += -m$(BITS)
> -KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS)
> +KBUILD_AFLAGS += -m$(BITS)
> KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
> endif
>
>
> --
> 2.39.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 05/14] powerpc: Remove linker flag from KBUILD_AFLAGS
@ 2023-01-09 21:24 ` Nick Desaulniers
0 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 21:24 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Wed, Jan 4, 2023 at 11:54 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> points out that KBUILD_AFLAGS contains a linker flag, which will be
> used:
>
> clang: error: -Wl,-a32: 'linker' input unused [-Werror,-Wunused-command-line-argument]
>
> This was likely supposed to be '-Wa,-a$(BITS)'. However, this change is
> unnecessary, as all supported versions of clang and gcc will pass '-a64'
> or '-a32' to GNU as based on the value of '-m'; the behavior of the
> latest stable release of the oldest supported major version of each
> compiler is shown below and each compiler's latest release exhibits the
> same behavior (GCC 12.2.0 and Clang 15.0.6).
>
> $ powerpc64-linux-gcc --version | head -1
> powerpc64-linux-gcc (GCC) 5.5.0
>
> $ powerpc64-linux-gcc -m64 -### -x assembler-with-cpp -c -o /dev/null /dev/null &| grep 'as '
> .../as -a64 -mppc64 -many -mbig -o /dev/null /tmp/cctwuBzZ.s
>
> $ powerpc64-linux-gcc -m32 -### -x assembler-with-cpp -c -o /dev/null /dev/null &| grep 'as '
> .../as -a32 -mppc -many -mbig -o /dev/null /tmp/ccaZP4mF.sg
>
> $ clang --version | head -1
> Ubuntu clang version 11.1.0-++20211011094159+1fdec59bffc1-1~exp1~20211011214622.5
>
> $ clang --target=powerpc64-linux-gnu -fno-integrated-as -m64 -### \
> -x assembler-with-cpp -c -o /dev/null /dev/null &| grep gnu-as
> "/usr/bin/powerpc64-linux-gnu-as" "-a64" "-mppc64" "-many" "-o" "/dev/null" "/tmp/null-80267c.s"
>
> $ clang --target=powerpc64-linux-gnu -fno-integrated-as -m64 -### \
> -x assembler-with-cpp -c -o /dev/null /dev/null &| grep gnu-as
> "/usr/bin/powerpc64-linux-gnu-as" "-a32" "-mppc" "-many" "-o" "/dev/null" "/tmp/null-ab8f8d.s"
>
> Remove this flag altogether to avoid future issues.
>
> Fixes: 1421dc6d4829 ("powerpc/kbuild: Use flags variables rather than overriding LD/CC/AS")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Cc: mpe@ellerman.id.au
> Cc: npiggin@gmail.com
> Cc: christophe.leroy@csgroup.eu
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> arch/powerpc/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index dc4cbf0a5ca9..4fd630efe39d 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -90,7 +90,7 @@ aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
>
> ifeq ($(HAS_BIARCH),y)
> KBUILD_CFLAGS += -m$(BITS)
> -KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS)
> +KBUILD_AFLAGS += -m$(BITS)
> KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
> endif
>
>
> --
> 2.39.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-04 19:54 ` Nathan Chancellor
@ 2023-01-09 21:58 ` Nick Desaulniers
-1 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 21:58 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
mpe, npiggin, christophe.leroy, linuxppc-dev
On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns that ASFLAGS 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]
>
> Looking at the GAS sources, '-s' is only useful when targeting Solaris
> and it is ignored for the powerpc target so just drop the flag
> altogether, as it is not needed.
Do you have any more info where you found this? I don't see -s
documented as an assembler flag.
https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
https://sourceware.org/binutils/docs/as/Invoking.html
The patch seems fine to me, but what was this ever supposed to be?
FWICT it predates git history (looking at
arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: mpe@ellerman.id.au
> Cc: npiggin@gmail.com
> Cc: christophe.leroy@csgroup.eu
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> arch/powerpc/kernel/vdso/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> index 6a977b0d8ffc..45c0cc5d34b6 100644
> --- a/arch/powerpc/kernel/vdso/Makefile
> +++ b/arch/powerpc/kernel/vdso/Makefile
> @@ -51,10 +51,10 @@ ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
> ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
>
> CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
> -AS32FLAGS := -D__VDSO32__ -s
> +AS32FLAGS := -D__VDSO32__
>
> CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
> -AS64FLAGS := -D__VDSO64__ -s
> +AS64FLAGS := -D__VDSO64__
>
> targets += vdso32.lds
> CPPFLAGS_vdso32.lds += -P -C -Upowerpc
>
> --
> 2.39.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-09 21:58 ` Nick Desaulniers
0 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 21:58 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns that ASFLAGS 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]
>
> Looking at the GAS sources, '-s' is only useful when targeting Solaris
> and it is ignored for the powerpc target so just drop the flag
> altogether, as it is not needed.
Do you have any more info where you found this? I don't see -s
documented as an assembler flag.
https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
https://sourceware.org/binutils/docs/as/Invoking.html
The patch seems fine to me, but what was this ever supposed to be?
FWICT it predates git history (looking at
arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: mpe@ellerman.id.au
> Cc: npiggin@gmail.com
> Cc: christophe.leroy@csgroup.eu
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> arch/powerpc/kernel/vdso/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> index 6a977b0d8ffc..45c0cc5d34b6 100644
> --- a/arch/powerpc/kernel/vdso/Makefile
> +++ b/arch/powerpc/kernel/vdso/Makefile
> @@ -51,10 +51,10 @@ ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
> ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
>
> CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
> -AS32FLAGS := -D__VDSO32__ -s
> +AS32FLAGS := -D__VDSO32__
>
> CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
> -AS64FLAGS := -D__VDSO64__ -s
> +AS64FLAGS := -D__VDSO64__
>
> targets += vdso32.lds
> CPPFLAGS_vdso32.lds += -P -C -Upowerpc
>
> --
> 2.39.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 07/14] powerpc/vdso: Improve linker flags
2023-01-04 19:54 ` Nathan Chancellor
@ 2023-01-09 22:08 ` Nick Desaulniers
-1 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 22:08 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
mpe, npiggin, christophe.leroy, linuxppc-dev
On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, there
> are several warnings in the PowerPC vDSO:
>
> clang-16: error: -Wl,-soname=linux-vdso32.so.1: 'linker' input unused [-Werror,-Wunused-command-line-argument]
> clang-16: error: -Wl,--hash-style=both: 'linker' input unused [-Werror,-Wunused-command-line-argument]
> clang-16: error: argument unused during compilation: '-shared' [-Werror,-Wunused-command-line-argument]
>
> clang-16: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
> clang-16: error: argument unused during compilation: '-Wa,-maltivec' [-Werror,-Wunused-command-line-argument]
>
> The first group of warnings point out that linker flags were being added
> to all invocations of $(CC), even though they will only be used during
> the final vDSO link. Move those flags to ldflags-y.
>
> The second group of warnings are compiler or assembler flags that will
> be unused during linking. Filter them out from KBUILD_CFLAGS so that
> they are not used during linking.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: mpe@ellerman.id.au
> Cc: npiggin@gmail.com
> Cc: christophe.leroy@csgroup.eu
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> arch/powerpc/kernel/vdso/Makefile | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> index 45c0cc5d34b6..769b62832b38 100644
> --- a/arch/powerpc/kernel/vdso/Makefile
> +++ b/arch/powerpc/kernel/vdso/Makefile
> @@ -47,13 +47,17 @@ KCOV_INSTRUMENT := n
> UBSAN_SANITIZE := n
> KASAN_SANITIZE := n
>
> -ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
> -ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
> -
> -CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
> +ccflags-y := -fno-common -fno-builtin
> +ldflags-y := -Wl,--hash-style=both -nostdlib -shared
> +ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
> +# Filter flags that clang will warn are unused for linking
> +ldflags-y += $(filter-out $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
> +
> +CC32FLAGS := -m32
> +LD32FLAGS := -Wl,-soname=linux-vdso32.so.1
> AS32FLAGS := -D__VDSO32__
>
> -CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
> +LD64FLAGS := -Wl,-soname=linux-vdso64.so.1
> AS64FLAGS := -D__VDSO64__
>
> targets += vdso32.lds
> @@ -92,14 +96,14 @@ include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE
>
> # actual build commands
> quiet_cmd_vdso32ld_and_check = VDSO32L $@
> - cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> + cmd_vdso32ld_and_check = $(VDSOCC) $(ldflags-y) $(CC32FLAGS) $(LD32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> quiet_cmd_vdso32as = VDSO32A $@
> cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
> quiet_cmd_vdso32cc = VDSO32C $@
> cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $<
>
> quiet_cmd_vdso64ld_and_check = VDSO64L $@
> - cmd_vdso64ld_and_check = $(VDSOCC) $(c_flags) $(CC64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> + cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(CC64FLAGS) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
Let's move `-z noexecstack` up into ldflags-y? (you may add my RB with
that modification)
> quiet_cmd_vdso64as = VDSO64A $@
> cmd_vdso64as = $(VDSOCC) $(a_flags) $(CC64FLAGS) $(AS64FLAGS) -c -o $@ $<
>
>
> --
> 2.39.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 07/14] powerpc/vdso: Improve linker flags
@ 2023-01-09 22:08 ` Nick Desaulniers
0 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 22:08 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, there
> are several warnings in the PowerPC vDSO:
>
> clang-16: error: -Wl,-soname=linux-vdso32.so.1: 'linker' input unused [-Werror,-Wunused-command-line-argument]
> clang-16: error: -Wl,--hash-style=both: 'linker' input unused [-Werror,-Wunused-command-line-argument]
> clang-16: error: argument unused during compilation: '-shared' [-Werror,-Wunused-command-line-argument]
>
> clang-16: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
> clang-16: error: argument unused during compilation: '-Wa,-maltivec' [-Werror,-Wunused-command-line-argument]
>
> The first group of warnings point out that linker flags were being added
> to all invocations of $(CC), even though they will only be used during
> the final vDSO link. Move those flags to ldflags-y.
>
> The second group of warnings are compiler or assembler flags that will
> be unused during linking. Filter them out from KBUILD_CFLAGS so that
> they are not used during linking.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: mpe@ellerman.id.au
> Cc: npiggin@gmail.com
> Cc: christophe.leroy@csgroup.eu
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> arch/powerpc/kernel/vdso/Makefile | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> index 45c0cc5d34b6..769b62832b38 100644
> --- a/arch/powerpc/kernel/vdso/Makefile
> +++ b/arch/powerpc/kernel/vdso/Makefile
> @@ -47,13 +47,17 @@ KCOV_INSTRUMENT := n
> UBSAN_SANITIZE := n
> KASAN_SANITIZE := n
>
> -ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
> -ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
> -
> -CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
> +ccflags-y := -fno-common -fno-builtin
> +ldflags-y := -Wl,--hash-style=both -nostdlib -shared
> +ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
> +# Filter flags that clang will warn are unused for linking
> +ldflags-y += $(filter-out $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
> +
> +CC32FLAGS := -m32
> +LD32FLAGS := -Wl,-soname=linux-vdso32.so.1
> AS32FLAGS := -D__VDSO32__
>
> -CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
> +LD64FLAGS := -Wl,-soname=linux-vdso64.so.1
> AS64FLAGS := -D__VDSO64__
>
> targets += vdso32.lds
> @@ -92,14 +96,14 @@ include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE
>
> # actual build commands
> quiet_cmd_vdso32ld_and_check = VDSO32L $@
> - cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> + cmd_vdso32ld_and_check = $(VDSOCC) $(ldflags-y) $(CC32FLAGS) $(LD32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> quiet_cmd_vdso32as = VDSO32A $@
> cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
> quiet_cmd_vdso32cc = VDSO32C $@
> cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $<
>
> quiet_cmd_vdso64ld_and_check = VDSO64L $@
> - cmd_vdso64ld_and_check = $(VDSOCC) $(c_flags) $(CC64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> + cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(CC64FLAGS) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
Let's move `-z noexecstack` up into ldflags-y? (you may add my RB with
that modification)
> quiet_cmd_vdso64as = VDSO64A $@
> cmd_vdso64as = $(VDSOCC) $(a_flags) $(CC64FLAGS) $(AS64FLAGS) -c -o $@ $<
>
>
> --
> 2.39.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 08/14] powerpc/vdso: Remove an unsupported flag from vgettimeofday-32.o with clang
2023-01-04 19:54 ` Nathan Chancellor
@ 2023-01-09 22:12 ` Nick Desaulniers
-1 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 22:12 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
mpe, npiggin, christophe.leroy, linuxppc-dev
On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns:
>
> clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
>
> This flag is supported for 64-bit powerpc but not 32-bit, hence the warning.
> Just remove the flag from vgettimeofday-32.o's CFLAGS when using clang, as has
> been done for other flags previously.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Hmm...so this was added by the top level Makefile doing a cc-option
test. How did the test pass if this was unsupported? That worries me
that perhaps other cc-option tests are passing erroneously for certain
ppc -m32/-m64 configs?
> ---
> Cc: mpe@ellerman.id.au
> Cc: npiggin@gmail.com
> Cc: christophe.leroy@csgroup.eu
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> arch/powerpc/kernel/vdso/Makefile | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> index 769b62832b38..4ee7d36ce752 100644
> --- a/arch/powerpc/kernel/vdso/Makefile
> +++ b/arch/powerpc/kernel/vdso/Makefile
> @@ -16,6 +16,11 @@ ifneq ($(c-gettimeofday-y),)
> CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables
> CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE)
> CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
> + # This flag is supported by clang for 64-bit but not 32-bit so it will cause
> + # an unused command line flag warning for this file.
> + ifdef CONFIG_CC_IS_CLANG
> + CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection
> + endif
> CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y)
> CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
> CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector)
>
> --
> 2.39.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 08/14] powerpc/vdso: Remove an unsupported flag from vgettimeofday-32.o with clang
@ 2023-01-09 22:12 ` Nick Desaulniers
0 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 22:12 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns:
>
> clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
>
> This flag is supported for 64-bit powerpc but not 32-bit, hence the warning.
> Just remove the flag from vgettimeofday-32.o's CFLAGS when using clang, as has
> been done for other flags previously.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Hmm...so this was added by the top level Makefile doing a cc-option
test. How did the test pass if this was unsupported? That worries me
that perhaps other cc-option tests are passing erroneously for certain
ppc -m32/-m64 configs?
> ---
> Cc: mpe@ellerman.id.au
> Cc: npiggin@gmail.com
> Cc: christophe.leroy@csgroup.eu
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> arch/powerpc/kernel/vdso/Makefile | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> index 769b62832b38..4ee7d36ce752 100644
> --- a/arch/powerpc/kernel/vdso/Makefile
> +++ b/arch/powerpc/kernel/vdso/Makefile
> @@ -16,6 +16,11 @@ ifneq ($(c-gettimeofday-y),)
> CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables
> CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE)
> CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
> + # This flag is supported by clang for 64-bit but not 32-bit so it will cause
> + # an unused command line flag warning for this file.
> + ifdef CONFIG_CC_IS_CLANG
> + CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection
> + endif
> CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y)
> CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
> CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector)
>
> --
> 2.39.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-09 21:58 ` Nick Desaulniers
@ 2023-01-09 22:15 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-09 22:15 UTC (permalink / raw)
To: Nick Desaulniers
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
mpe, npiggin, christophe.leroy, linuxppc-dev
On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > warns that ASFLAGS 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]
> >
> > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > and it is ignored for the powerpc target so just drop the flag
> > altogether, as it is not needed.
>
> Do you have any more info where you found this? I don't see -s
> documented as an assembler flag.
> https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> https://sourceware.org/binutils/docs/as/Invoking.html
Sure thing, sorry I did not include it initially. See the section from
line 1284 to 1291 or search for "case 's':":
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gas/config/tc-ppc.c;h=9450fa74de1b61542c9a18babf8c8f621ef904fb;hb=HEAD
> The patch seems fine to me, but what was this ever supposed to be?
> FWICT it predates git history (looking at
> arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
Right, I could not figure it out either, it has been there since the
vDSO was introduced back in 2005 (I was three days away from 10!) and
there is no comment about it so *shrug*:
https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=054eb7153aeb84cc92da84210cf93b0e2a34811b
If someone else's archeological skills are better and can provide more
information, I am happy to include that.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Thanks as always for the review! I'll include this and a note about
where in binutils I found that information for v2.
> >
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > Cc: mpe@ellerman.id.au
> > Cc: npiggin@gmail.com
> > Cc: christophe.leroy@csgroup.eu
> > Cc: linuxppc-dev@lists.ozlabs.org
> > ---
> > arch/powerpc/kernel/vdso/Makefile | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> > index 6a977b0d8ffc..45c0cc5d34b6 100644
> > --- a/arch/powerpc/kernel/vdso/Makefile
> > +++ b/arch/powerpc/kernel/vdso/Makefile
> > @@ -51,10 +51,10 @@ ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
> > ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
> >
> > CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
> > -AS32FLAGS := -D__VDSO32__ -s
> > +AS32FLAGS := -D__VDSO32__
> >
> > CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
> > -AS64FLAGS := -D__VDSO64__ -s
> > +AS64FLAGS := -D__VDSO64__
> >
> > targets += vdso32.lds
> > CPPFLAGS_vdso32.lds += -P -C -Upowerpc
> >
> > --
> > 2.39.0
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-09 22:15 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-09 22:15 UTC (permalink / raw)
To: Nick Desaulniers
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > warns that ASFLAGS 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]
> >
> > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > and it is ignored for the powerpc target so just drop the flag
> > altogether, as it is not needed.
>
> Do you have any more info where you found this? I don't see -s
> documented as an assembler flag.
> https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> https://sourceware.org/binutils/docs/as/Invoking.html
Sure thing, sorry I did not include it initially. See the section from
line 1284 to 1291 or search for "case 's':":
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gas/config/tc-ppc.c;h=9450fa74de1b61542c9a18babf8c8f621ef904fb;hb=HEAD
> The patch seems fine to me, but what was this ever supposed to be?
> FWICT it predates git history (looking at
> arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
Right, I could not figure it out either, it has been there since the
vDSO was introduced back in 2005 (I was three days away from 10!) and
there is no comment about it so *shrug*:
https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=054eb7153aeb84cc92da84210cf93b0e2a34811b
If someone else's archeological skills are better and can provide more
information, I am happy to include that.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Thanks as always for the review! I'll include this and a note about
where in binutils I found that information for v2.
> >
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > Cc: mpe@ellerman.id.au
> > Cc: npiggin@gmail.com
> > Cc: christophe.leroy@csgroup.eu
> > Cc: linuxppc-dev@lists.ozlabs.org
> > ---
> > arch/powerpc/kernel/vdso/Makefile | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> > index 6a977b0d8ffc..45c0cc5d34b6 100644
> > --- a/arch/powerpc/kernel/vdso/Makefile
> > +++ b/arch/powerpc/kernel/vdso/Makefile
> > @@ -51,10 +51,10 @@ ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
> > ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
> >
> > CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
> > -AS32FLAGS := -D__VDSO32__ -s
> > +AS32FLAGS := -D__VDSO32__
> >
> > CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
> > -AS64FLAGS := -D__VDSO64__ -s
> > +AS64FLAGS := -D__VDSO64__
> >
> > targets += vdso32.lds
> > CPPFLAGS_vdso32.lds += -P -C -Upowerpc
> >
> > --
> > 2.39.0
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 13/14] kbuild: Turn a couple more of clang's unused option warnings into errors
2023-01-04 19:54 ` [PATCH 13/14] kbuild: Turn a couple more of clang's unused option warnings into errors Nathan Chancellor
@ 2023-01-09 22:15 ` Nick Desaulniers
0 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 22:15 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot
On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Currently, these warnings are hidden with -Qunused-arguments in
> KBUILD_CPPFLAGS. Once that option is removed, these warnings should be
> turned into hard errors to make unconditionally added but unsupported
> flags for the current compilation mode or target obvious due to a failed
> build; otherwise, the warnings might just be ignored if the build log is
> not checked.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1587
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> scripts/Makefile.clang | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
> index 87285b76adb2..70b354fa1cb4 100644
> --- a/scripts/Makefile.clang
> +++ b/scripts/Makefile.clang
> @@ -36,6 +36,8 @@ endif
> # so they can be implemented or wrapped in cc-option.
> CLANG_FLAGS += -Werror=unknown-warning-option
> CLANG_FLAGS += -Werror=ignored-optimization-argument
> +CLANG_FLAGS += -Werror=option-ignored
> +CLANG_FLAGS += -Werror=unused-command-line-argument
> KBUILD_CFLAGS += $(CLANG_FLAGS)
> KBUILD_AFLAGS += $(CLANG_FLAGS)
> export CLANG_FLAGS
>
> --
> 2.39.0
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 07/14] powerpc/vdso: Improve linker flags
2023-01-09 22:08 ` Nick Desaulniers
@ 2023-01-09 22:15 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-09 22:15 UTC (permalink / raw)
To: Nick Desaulniers
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
mpe, npiggin, christophe.leroy, linuxppc-dev
On Mon, Jan 09, 2023 at 02:08:41PM -0800, Nick Desaulniers wrote:
> On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, there
> > are several warnings in the PowerPC vDSO:
> >
> > clang-16: error: -Wl,-soname=linux-vdso32.so.1: 'linker' input unused [-Werror,-Wunused-command-line-argument]
> > clang-16: error: -Wl,--hash-style=both: 'linker' input unused [-Werror,-Wunused-command-line-argument]
> > clang-16: error: argument unused during compilation: '-shared' [-Werror,-Wunused-command-line-argument]
> >
> > clang-16: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
> > clang-16: error: argument unused during compilation: '-Wa,-maltivec' [-Werror,-Wunused-command-line-argument]
> >
> > The first group of warnings point out that linker flags were being added
> > to all invocations of $(CC), even though they will only be used during
> > the final vDSO link. Move those flags to ldflags-y.
> >
> > The second group of warnings are compiler or assembler flags that will
> > be unused during linking. Filter them out from KBUILD_CFLAGS so that
> > they are not used during linking.
> >
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > Cc: mpe@ellerman.id.au
> > Cc: npiggin@gmail.com
> > Cc: christophe.leroy@csgroup.eu
> > Cc: linuxppc-dev@lists.ozlabs.org
> > ---
> > arch/powerpc/kernel/vdso/Makefile | 18 +++++++++++-------
> > 1 file changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> > index 45c0cc5d34b6..769b62832b38 100644
> > --- a/arch/powerpc/kernel/vdso/Makefile
> > +++ b/arch/powerpc/kernel/vdso/Makefile
> > @@ -47,13 +47,17 @@ KCOV_INSTRUMENT := n
> > UBSAN_SANITIZE := n
> > KASAN_SANITIZE := n
> >
> > -ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
> > -ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
> > -
> > -CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
> > +ccflags-y := -fno-common -fno-builtin
> > +ldflags-y := -Wl,--hash-style=both -nostdlib -shared
> > +ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
> > +# Filter flags that clang will warn are unused for linking
> > +ldflags-y += $(filter-out $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
> > +
> > +CC32FLAGS := -m32
> > +LD32FLAGS := -Wl,-soname=linux-vdso32.so.1
> > AS32FLAGS := -D__VDSO32__
> >
> > -CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
> > +LD64FLAGS := -Wl,-soname=linux-vdso64.so.1
> > AS64FLAGS := -D__VDSO64__
> >
> > targets += vdso32.lds
> > @@ -92,14 +96,14 @@ include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE
> >
> > # actual build commands
> > quiet_cmd_vdso32ld_and_check = VDSO32L $@
> > - cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> > + cmd_vdso32ld_and_check = $(VDSOCC) $(ldflags-y) $(CC32FLAGS) $(LD32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> > quiet_cmd_vdso32as = VDSO32A $@
> > cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
> > quiet_cmd_vdso32cc = VDSO32C $@
> > cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $<
> >
> > quiet_cmd_vdso64ld_and_check = VDSO64L $@
> > - cmd_vdso64ld_and_check = $(VDSOCC) $(c_flags) $(CC64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> > + cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(CC64FLAGS) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
>
> Let's move `-z noexecstack` up into ldflags-y? (you may add my RB with
> that modification)
Ack, done locally, will be included in v2.
> > quiet_cmd_vdso64as = VDSO64A $@
> > cmd_vdso64as = $(VDSOCC) $(a_flags) $(CC64FLAGS) $(AS64FLAGS) -c -o $@ $<
> >
> >
> > --
> > 2.39.0
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 07/14] powerpc/vdso: Improve linker flags
@ 2023-01-09 22:15 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-09 22:15 UTC (permalink / raw)
To: Nick Desaulniers
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 02:08:41PM -0800, Nick Desaulniers wrote:
> On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, there
> > are several warnings in the PowerPC vDSO:
> >
> > clang-16: error: -Wl,-soname=linux-vdso32.so.1: 'linker' input unused [-Werror,-Wunused-command-line-argument]
> > clang-16: error: -Wl,--hash-style=both: 'linker' input unused [-Werror,-Wunused-command-line-argument]
> > clang-16: error: argument unused during compilation: '-shared' [-Werror,-Wunused-command-line-argument]
> >
> > clang-16: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
> > clang-16: error: argument unused during compilation: '-Wa,-maltivec' [-Werror,-Wunused-command-line-argument]
> >
> > The first group of warnings point out that linker flags were being added
> > to all invocations of $(CC), even though they will only be used during
> > the final vDSO link. Move those flags to ldflags-y.
> >
> > The second group of warnings are compiler or assembler flags that will
> > be unused during linking. Filter them out from KBUILD_CFLAGS so that
> > they are not used during linking.
> >
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > Cc: mpe@ellerman.id.au
> > Cc: npiggin@gmail.com
> > Cc: christophe.leroy@csgroup.eu
> > Cc: linuxppc-dev@lists.ozlabs.org
> > ---
> > arch/powerpc/kernel/vdso/Makefile | 18 +++++++++++-------
> > 1 file changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> > index 45c0cc5d34b6..769b62832b38 100644
> > --- a/arch/powerpc/kernel/vdso/Makefile
> > +++ b/arch/powerpc/kernel/vdso/Makefile
> > @@ -47,13 +47,17 @@ KCOV_INSTRUMENT := n
> > UBSAN_SANITIZE := n
> > KASAN_SANITIZE := n
> >
> > -ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
> > -ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
> > -
> > -CC32FLAGS := -Wl,-soname=linux-vdso32.so.1 -m32
> > +ccflags-y := -fno-common -fno-builtin
> > +ldflags-y := -Wl,--hash-style=both -nostdlib -shared
> > +ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
> > +# Filter flags that clang will warn are unused for linking
> > +ldflags-y += $(filter-out $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
> > +
> > +CC32FLAGS := -m32
> > +LD32FLAGS := -Wl,-soname=linux-vdso32.so.1
> > AS32FLAGS := -D__VDSO32__
> >
> > -CC64FLAGS := -Wl,-soname=linux-vdso64.so.1
> > +LD64FLAGS := -Wl,-soname=linux-vdso64.so.1
> > AS64FLAGS := -D__VDSO64__
> >
> > targets += vdso32.lds
> > @@ -92,14 +96,14 @@ include/generated/vdso64-offsets.h: $(obj)/vdso64.so.dbg FORCE
> >
> > # actual build commands
> > quiet_cmd_vdso32ld_and_check = VDSO32L $@
> > - cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> > + cmd_vdso32ld_and_check = $(VDSOCC) $(ldflags-y) $(CC32FLAGS) $(LD32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> > quiet_cmd_vdso32as = VDSO32A $@
> > cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
> > quiet_cmd_vdso32cc = VDSO32C $@
> > cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $<
> >
> > quiet_cmd_vdso64ld_and_check = VDSO64L $@
> > - cmd_vdso64ld_and_check = $(VDSOCC) $(c_flags) $(CC64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
> > + cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(CC64FLAGS) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
>
> Let's move `-z noexecstack` up into ldflags-y? (you may add my RB with
> that modification)
Ack, done locally, will be included in v2.
> > quiet_cmd_vdso64as = VDSO64A $@
> > cmd_vdso64as = $(VDSOCC) $(a_flags) $(CC64FLAGS) $(AS64FLAGS) -c -o $@ $<
> >
> >
> > --
> > 2.39.0
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 14/14] kbuild: Stop using '-Qunused-arguments' with clang
2023-01-04 19:54 ` [PATCH 14/14] kbuild: Stop using '-Qunused-arguments' with clang Nathan Chancellor
@ 2023-01-09 22:17 ` Nick Desaulniers
0 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 22:17 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot
On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> This option masks all unused command line argument warnings, which can
> hide potential issues, such as an architecture Makefile adding an
> unsupported flag to KBUILD_AFLAGS or KBUILD_CFLAGS, which will cause all
> as-option and cc-options to silently fail due to -Werror with no
> indication as to why in the main kernel build.
>
> Remove this flag so that warnings of this nature can be caught early and
> obviously in a build.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Nice job on the series!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Makefile | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index c05b4fb7121e..4bc79d2a42f2 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -878,7 +878,6 @@ KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
> KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
>
> ifdef CONFIG_CC_IS_CLANG
> -KBUILD_CPPFLAGS += -Qunused-arguments
> # The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
> KBUILD_CFLAGS += -Wno-gnu
> else
>
> --
> 2.39.0
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-09 22:15 ` Nathan Chancellor
@ 2023-01-09 22:21 ` Nick Desaulniers
-1 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 22:21 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
mpe, npiggin, christophe.leroy, linuxppc-dev
On Mon, Jan 9, 2023 at 2:15 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > warns that ASFLAGS 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]
> > >
> > > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > > and it is ignored for the powerpc target so just drop the flag
> > > altogether, as it is not needed.
> >
> > Do you have any more info where you found this? I don't see -s
> > documented as an assembler flag.
> > https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> > https://sourceware.org/binutils/docs/as/Invoking.html
>
> Sure thing, sorry I did not include it initially. See the section from
> line 1284 to 1291 or search for "case 's':":
>
> https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gas/config/tc-ppc.c;h=9450fa74de1b61542c9a18babf8c8f621ef904fb;hb=HEAD
>
> > The patch seems fine to me, but what was this ever supposed to be?
> > FWICT it predates git history (looking at
> > arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
>
> Right, I could not figure it out either, it has been there since the
> vDSO was introduced back in 2005 (I was three days away from 10!) and
> there is no comment about it so *shrug*:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=054eb7153aeb84cc92da84210cf93b0e2a34811b
>
> If someone else's archeological skills are better and can provide more
> information, I am happy to include that.
>
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> Thanks as always for the review! I'll include this and a note about
> where in binutils I found that information for v2.
Yeah, I think the comment from binutils sources would be good to add
to a v2 commit message. Thanks!
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-09 22:21 ` Nick Desaulniers
0 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 22:21 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Mon, Jan 9, 2023 at 2:15 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > warns that ASFLAGS 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]
> > >
> > > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > > and it is ignored for the powerpc target so just drop the flag
> > > altogether, as it is not needed.
> >
> > Do you have any more info where you found this? I don't see -s
> > documented as an assembler flag.
> > https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> > https://sourceware.org/binutils/docs/as/Invoking.html
>
> Sure thing, sorry I did not include it initially. See the section from
> line 1284 to 1291 or search for "case 's':":
>
> https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gas/config/tc-ppc.c;h=9450fa74de1b61542c9a18babf8c8f621ef904fb;hb=HEAD
>
> > The patch seems fine to me, but what was this ever supposed to be?
> > FWICT it predates git history (looking at
> > arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
>
> Right, I could not figure it out either, it has been there since the
> vDSO was introduced back in 2005 (I was three days away from 10!) and
> there is no comment about it so *shrug*:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=054eb7153aeb84cc92da84210cf93b0e2a34811b
>
> If someone else's archeological skills are better and can provide more
> information, I am happy to include that.
>
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> Thanks as always for the review! I'll include this and a note about
> where in binutils I found that information for v2.
Yeah, I think the comment from binutils sources would be good to add
to a v2 commit message. Thanks!
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-09 21:58 ` Nick Desaulniers
@ 2023-01-09 22:23 ` Segher Boessenkool
-1 siblings, 0 replies; 76+ messages in thread
From: Segher Boessenkool @ 2023-01-09 22:23 UTC (permalink / raw)
To: Nick Desaulniers
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
Nathan Chancellor, linuxppc-dev, nicolas
Hi! Happy new year all.
On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > warns that ASFLAGS 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]
> >
> > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > and it is ignored for the powerpc target so just drop the flag
> > altogether, as it is not needed.
>
> Do you have any more info where you found this? I don't see -s
> documented as an assembler flag.
> https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> https://sourceware.org/binutils/docs/as/Invoking.html
It is required by POSIX (for the c99 command, anyway). It *also* is
required to be supported when producing object files (so when no linking
is done).
It is a GCC flag, and documented just fine:
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
(Yes, that says it is for linking; but the option is allowed without
error of any kind always).
(ASFLAGS sounds like it is for assembler commands, but it really is
for compiler commands that just happen to get .S input files).
> The patch seems fine to me, but what was this ever supposed to be?
> FWICT it predates git history (looking at
> arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
Yeah, good question. This compiler flag does the moral equivalent of
strip -s (aka --strip-all). Maybe this was needed at some point, or
the symbol or debug info was just annoying (during bringup or similar)?
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Segher
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-09 22:23 ` Segher Boessenkool
0 siblings, 0 replies; 76+ messages in thread
From: Segher Boessenkool @ 2023-01-09 22:23 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Nathan Chancellor, kernel test robot, linux-kbuild, trix,
masahiroy, llvm, npiggin, linuxppc-dev, nicolas
Hi! Happy new year all.
On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > warns that ASFLAGS 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]
> >
> > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > and it is ignored for the powerpc target so just drop the flag
> > altogether, as it is not needed.
>
> Do you have any more info where you found this? I don't see -s
> documented as an assembler flag.
> https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> https://sourceware.org/binutils/docs/as/Invoking.html
It is required by POSIX (for the c99 command, anyway). It *also* is
required to be supported when producing object files (so when no linking
is done).
It is a GCC flag, and documented just fine:
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
(Yes, that says it is for linking; but the option is allowed without
error of any kind always).
(ASFLAGS sounds like it is for assembler commands, but it really is
for compiler commands that just happen to get .S input files).
> The patch seems fine to me, but what was this ever supposed to be?
> FWICT it predates git history (looking at
> arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
Yeah, good question. This compiler flag does the moral equivalent of
strip -s (aka --strip-all). Maybe this was needed at some point, or
the symbol or debug info was just annoying (during bringup or similar)?
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Segher
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-09 22:23 ` Segher Boessenkool
@ 2023-01-09 22:37 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-09 22:37 UTC (permalink / raw)
To: Segher Boessenkool
Cc: Nick Desaulniers, kernel test robot, linux-kbuild, trix,
masahiroy, llvm, npiggin, linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 04:23:37PM -0600, Segher Boessenkool wrote:
> Hi! Happy new year all.
>
> On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > warns that ASFLAGS 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]
> > >
> > > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > > and it is ignored for the powerpc target so just drop the flag
> > > altogether, as it is not needed.
> >
> > Do you have any more info where you found this? I don't see -s
> > documented as an assembler flag.
> > https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> > https://sourceware.org/binutils/docs/as/Invoking.html
>
> It is required by POSIX (for the c99 command, anyway). It *also* is
> required to be supported when producing object files (so when no linking
> is done).
>
> It is a GCC flag, and documented just fine:
> https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
>
> (Yes, that says it is for linking; but the option is allowed without
> error of any kind always).
>
> (ASFLAGS sounds like it is for assembler commands, but it really is
> for compiler commands that just happen to get .S input files).
>
> > The patch seems fine to me, but what was this ever supposed to be?
> > FWICT it predates git history (looking at
> > arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
>
> Yeah, good question. This compiler flag does the moral equivalent of
> strip -s (aka --strip-all). Maybe this was needed at some point, or
> the symbol or debug info was just annoying (during bringup or similar)?
>
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Thank you for the review and extra explanation! I had kind of expanded
on this in the s390 version of this patch [1], I will go ahead and do
the same thing for the powerpc version too.
[1]: https://lore.kernel.org/llvm/20221228-drop-qunused-arguments-v1-9-658cbc8fc592@kernel.org/
Cheers,
Nathan
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-09 22:37 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-09 22:37 UTC (permalink / raw)
To: Segher Boessenkool
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm,
Nick Desaulniers, npiggin, linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 04:23:37PM -0600, Segher Boessenkool wrote:
> Hi! Happy new year all.
>
> On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > warns that ASFLAGS 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]
> > >
> > > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > > and it is ignored for the powerpc target so just drop the flag
> > > altogether, as it is not needed.
> >
> > Do you have any more info where you found this? I don't see -s
> > documented as an assembler flag.
> > https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> > https://sourceware.org/binutils/docs/as/Invoking.html
>
> It is required by POSIX (for the c99 command, anyway). It *also* is
> required to be supported when producing object files (so when no linking
> is done).
>
> It is a GCC flag, and documented just fine:
> https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
>
> (Yes, that says it is for linking; but the option is allowed without
> error of any kind always).
>
> (ASFLAGS sounds like it is for assembler commands, but it really is
> for compiler commands that just happen to get .S input files).
>
> > The patch seems fine to me, but what was this ever supposed to be?
> > FWICT it predates git history (looking at
> > arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
>
> Yeah, good question. This compiler flag does the moral equivalent of
> strip -s (aka --strip-all). Maybe this was needed at some point, or
> the symbol or debug info was just annoying (during bringup or similar)?
>
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Thank you for the review and extra explanation! I had kind of expanded
on this in the s390 version of this patch [1], I will go ahead and do
the same thing for the powerpc version too.
[1]: https://lore.kernel.org/llvm/20221228-drop-qunused-arguments-v1-9-658cbc8fc592@kernel.org/
Cheers,
Nathan
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 08/14] powerpc/vdso: Remove an unsupported flag from vgettimeofday-32.o with clang
2023-01-09 22:12 ` Nick Desaulniers
@ 2023-01-09 22:38 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-09 22:38 UTC (permalink / raw)
To: Nick Desaulniers
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
mpe, npiggin, christophe.leroy, linuxppc-dev
On Mon, Jan 09, 2023 at 02:12:55PM -0800, Nick Desaulniers wrote:
> On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > warns:
> >
> > clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
> >
> > This flag is supported for 64-bit powerpc but not 32-bit, hence the warning.
> > Just remove the flag from vgettimeofday-32.o's CFLAGS when using clang, as has
> > been done for other flags previously.
> >
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>
> Hmm...so this was added by the top level Makefile doing a cc-option
> test. How did the test pass if this was unsupported? That worries me
> that perhaps other cc-option tests are passing erroneously for certain
> ppc -m32/-m64 configs?
Sure, that is a reasonable concern. I should have expanded upon this a
little bit more in the commit message. Is this any better?
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns:
clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
This warning happens because vgettimeofday-32.c gets its base CFLAGS
from the main kernel, which may contain flags that are only supported
on a 64-bit target but not a 32-bit one, which is the case here.
-fstack-clash-protection and its negation are only suppported by the
64-bit powerpc target but that flag is included in an invocation for a
32-bit powerpc target, so clang points out that while the flag is one
that it recognizes, it is not actually used by this compiler job.
To eliminate the warning, remove -fno-stack-clash-protection from
vgettimeofday-32.c's CFLAGS when using clang, as has been done for
other flags previously.
Cheers,
Nathan
> > ---
> > Cc: mpe@ellerman.id.au
> > Cc: npiggin@gmail.com
> > Cc: christophe.leroy@csgroup.eu
> > Cc: linuxppc-dev@lists.ozlabs.org
> > ---
> > arch/powerpc/kernel/vdso/Makefile | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> > index 769b62832b38..4ee7d36ce752 100644
> > --- a/arch/powerpc/kernel/vdso/Makefile
> > +++ b/arch/powerpc/kernel/vdso/Makefile
> > @@ -16,6 +16,11 @@ ifneq ($(c-gettimeofday-y),)
> > CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables
> > CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE)
> > CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
> > + # This flag is supported by clang for 64-bit but not 32-bit so it will cause
> > + # an unused command line flag warning for this file.
> > + ifdef CONFIG_CC_IS_CLANG
> > + CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection
> > + endif
> > CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y)
> > CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
> > CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector)
> >
> > --
> > 2.39.0
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 08/14] powerpc/vdso: Remove an unsupported flag from vgettimeofday-32.o with clang
@ 2023-01-09 22:38 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-09 22:38 UTC (permalink / raw)
To: Nick Desaulniers
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 02:12:55PM -0800, Nick Desaulniers wrote:
> On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > warns:
> >
> > clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
> >
> > This flag is supported for 64-bit powerpc but not 32-bit, hence the warning.
> > Just remove the flag from vgettimeofday-32.o's CFLAGS when using clang, as has
> > been done for other flags previously.
> >
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>
> Hmm...so this was added by the top level Makefile doing a cc-option
> test. How did the test pass if this was unsupported? That worries me
> that perhaps other cc-option tests are passing erroneously for certain
> ppc -m32/-m64 configs?
Sure, that is a reasonable concern. I should have expanded upon this a
little bit more in the commit message. Is this any better?
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns:
clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
This warning happens because vgettimeofday-32.c gets its base CFLAGS
from the main kernel, which may contain flags that are only supported
on a 64-bit target but not a 32-bit one, which is the case here.
-fstack-clash-protection and its negation are only suppported by the
64-bit powerpc target but that flag is included in an invocation for a
32-bit powerpc target, so clang points out that while the flag is one
that it recognizes, it is not actually used by this compiler job.
To eliminate the warning, remove -fno-stack-clash-protection from
vgettimeofday-32.c's CFLAGS when using clang, as has been done for
other flags previously.
Cheers,
Nathan
> > ---
> > Cc: mpe@ellerman.id.au
> > Cc: npiggin@gmail.com
> > Cc: christophe.leroy@csgroup.eu
> > Cc: linuxppc-dev@lists.ozlabs.org
> > ---
> > arch/powerpc/kernel/vdso/Makefile | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> > index 769b62832b38..4ee7d36ce752 100644
> > --- a/arch/powerpc/kernel/vdso/Makefile
> > +++ b/arch/powerpc/kernel/vdso/Makefile
> > @@ -16,6 +16,11 @@ ifneq ($(c-gettimeofday-y),)
> > CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables
> > CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE)
> > CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
> > + # This flag is supported by clang for 64-bit but not 32-bit so it will cause
> > + # an unused command line flag warning for this file.
> > + ifdef CONFIG_CC_IS_CLANG
> > + CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection
> > + endif
> > CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y)
> > CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
> > CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector)
> >
> > --
> > 2.39.0
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-09 22:37 ` Nathan Chancellor
@ 2023-01-09 22:47 ` Segher Boessenkool
-1 siblings, 0 replies; 76+ messages in thread
From: Segher Boessenkool @ 2023-01-09 22:47 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Nick Desaulniers, kernel test robot, linux-kbuild, trix,
masahiroy, llvm, npiggin, linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 03:37:53PM -0700, Nathan Chancellor wrote:
> On Mon, Jan 09, 2023 at 04:23:37PM -0600, Segher Boessenkool wrote:
> > Hi! Happy new year all.
> >
> > On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> > > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > > >
> > > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > > warns that ASFLAGS 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]
> > > >
> > > > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > > > and it is ignored for the powerpc target so just drop the flag
> > > > altogether, as it is not needed.
> > >
> > > Do you have any more info where you found this? I don't see -s
> > > documented as an assembler flag.
> > > https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> > > https://sourceware.org/binutils/docs/as/Invoking.html
> >
> > It is required by POSIX (for the c99 command, anyway). It *also* is
> > required to be supported when producing object files (so when no linking
> > is done).
> >
> > It is a GCC flag, and documented just fine:
> > https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
> >
> > (Yes, that says it is for linking; but the option is allowed without
> > error of any kind always).
> >
> > (ASFLAGS sounds like it is for assembler commands, but it really is
> > for compiler commands that just happen to get .S input files).
> >
> > > The patch seems fine to me, but what was this ever supposed to be?
> > > FWICT it predates git history (looking at
> > > arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
> >
> > Yeah, good question. This compiler flag does the moral equivalent of
> > strip -s (aka --strip-all). Maybe this was needed at some point, or
> > the symbol or debug info was just annoying (during bringup or similar)?
> >
> > > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> > Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
>
> Thank you for the review and extra explanation! I had kind of expanded
> on this in the s390 version of this patch [1], I will go ahead and do
> the same thing for the powerpc version too.
>
> [1]: https://lore.kernel.org/llvm/20221228-drop-qunused-arguments-v1-9-658cbc8fc592@kernel.org/
The underwhelming GCC source code for this is
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.cc;h=d629ca5e424ad3120be13e82b9f38b7bf8f1cdf2;hb=HEAD#l1148
which says that the -s flag is passed through unmodified to the linker
when invoking the linker. See #l603 for the %{s} specs syntax.
This is not a flag to the assembler at all. It is a flag to the
compiler, which passes it on to the linker :-)
> > (ASFLAGS sounds like it is for assembler commands, but it really is
> > for compiler commands that just happen to get .S input files).
Segher
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-09 22:47 ` Segher Boessenkool
0 siblings, 0 replies; 76+ messages in thread
From: Segher Boessenkool @ 2023-01-09 22:47 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm,
Nick Desaulniers, npiggin, linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 03:37:53PM -0700, Nathan Chancellor wrote:
> On Mon, Jan 09, 2023 at 04:23:37PM -0600, Segher Boessenkool wrote:
> > Hi! Happy new year all.
> >
> > On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> > > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > > >
> > > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > > warns that ASFLAGS 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]
> > > >
> > > > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > > > and it is ignored for the powerpc target so just drop the flag
> > > > altogether, as it is not needed.
> > >
> > > Do you have any more info where you found this? I don't see -s
> > > documented as an assembler flag.
> > > https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> > > https://sourceware.org/binutils/docs/as/Invoking.html
> >
> > It is required by POSIX (for the c99 command, anyway). It *also* is
> > required to be supported when producing object files (so when no linking
> > is done).
> >
> > It is a GCC flag, and documented just fine:
> > https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
> >
> > (Yes, that says it is for linking; but the option is allowed without
> > error of any kind always).
> >
> > (ASFLAGS sounds like it is for assembler commands, but it really is
> > for compiler commands that just happen to get .S input files).
> >
> > > The patch seems fine to me, but what was this ever supposed to be?
> > > FWICT it predates git history (looking at
> > > arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
> >
> > Yeah, good question. This compiler flag does the moral equivalent of
> > strip -s (aka --strip-all). Maybe this was needed at some point, or
> > the symbol or debug info was just annoying (during bringup or similar)?
> >
> > > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> > Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
>
> Thank you for the review and extra explanation! I had kind of expanded
> on this in the s390 version of this patch [1], I will go ahead and do
> the same thing for the powerpc version too.
>
> [1]: https://lore.kernel.org/llvm/20221228-drop-qunused-arguments-v1-9-658cbc8fc592@kernel.org/
The underwhelming GCC source code for this is
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.cc;h=d629ca5e424ad3120be13e82b9f38b7bf8f1cdf2;hb=HEAD#l1148
which says that the -s flag is passed through unmodified to the linker
when invoking the linker. See #l603 for the %{s} specs syntax.
This is not a flag to the assembler at all. It is a flag to the
compiler, which passes it on to the linker :-)
> > (ASFLAGS sounds like it is for assembler commands, but it really is
> > for compiler commands that just happen to get .S input files).
Segher
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-09 22:23 ` Segher Boessenkool
(?)
(?)
@ 2023-01-09 23:14 ` Nick Desaulniers
2023-01-10 0:51 ` Nathan Chancellor
-1 siblings, 1 reply; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 23:14 UTC (permalink / raw)
To: Segher Boessenkool, Nathan Chancellor
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Mon, Jan 9, 2023 at 2:29 PM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> Hi! Happy new year all.
HNY Segher! :)
>
> On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > warns that ASFLAGS 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]
> > >
> > > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > > and it is ignored for the powerpc target so just drop the flag
> > > altogether, as it is not needed.
> >
> > Do you have any more info where you found this? I don't see -s
> > documented as an assembler flag.
> > https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> > https://sourceware.org/binutils/docs/as/Invoking.html
>
> It is required by POSIX (for the c99 command, anyway). It *also* is
> required to be supported when producing object files (so when no linking
> is done).
>
> It is a GCC flag, and documented just fine:
> https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
>
> (Yes, that says it is for linking; but the option is allowed without
> error of any kind always).
>
> (ASFLAGS sounds like it is for assembler commands, but it really is
> for compiler commands that just happen to get .S input files).
>
> > The patch seems fine to me, but what was this ever supposed to be?
> > FWICT it predates git history (looking at
> > arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
>
> Yeah, good question. This compiler flag does the moral equivalent of
> strip -s (aka --strip-all). Maybe this was needed at some point, or
> the symbol or debug info was just annoying (during bringup or similar)?
Ah right! Ok then, I think we might keep the patch's diff, but update
the commit message to mention this is a linker flag that's unused
since the compiler is being invoked but not the linker (the compiler
is being used as the driver to assemble a single assembler source
without linking it; linking is then driven by the linker in a separate
make rule).
Then we might want to revisit that s390 patch, too?
https://lore.kernel.org/llvm/20221228-drop-qunused-arguments-v1-9-658cbc8fc592@kernel.org/
>
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
>
>
> Segher
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 08/14] powerpc/vdso: Remove an unsupported flag from vgettimeofday-32.o with clang
2023-01-09 22:38 ` Nathan Chancellor
@ 2023-01-09 23:16 ` Nick Desaulniers
-1 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 23:16 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, nicolas, trix, linux-kbuild, llvm, kernel test robot,
mpe, npiggin, christophe.leroy, linuxppc-dev
On Mon, Jan 9, 2023 at 2:38 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Mon, Jan 09, 2023 at 02:12:55PM -0800, Nick Desaulniers wrote:
> > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > warns:
> > >
> > > clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
> > >
> > > This flag is supported for 64-bit powerpc but not 32-bit, hence the warning.
> > > Just remove the flag from vgettimeofday-32.o's CFLAGS when using clang, as has
> > > been done for other flags previously.
> > >
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> >
> > Hmm...so this was added by the top level Makefile doing a cc-option
> > test. How did the test pass if this was unsupported? That worries me
> > that perhaps other cc-option tests are passing erroneously for certain
> > ppc -m32/-m64 configs?
>
> Sure, that is a reasonable concern. I should have expanded upon this a
> little bit more in the commit message. Is this any better?
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns:
>
> clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
>
> This warning happens because vgettimeofday-32.c gets its base CFLAGS
> from the main kernel, which may contain flags that are only supported
> on a 64-bit target but not a 32-bit one, which is the case here.
> -fstack-clash-protection and its negation are only suppported by the
> 64-bit powerpc target but that flag is included in an invocation for a
> 32-bit powerpc target, so clang points out that while the flag is one
> that it recognizes, it is not actually used by this compiler job.
>
> To eliminate the warning, remove -fno-stack-clash-protection from
> vgettimeofday-32.c's CFLAGS when using clang, as has been done for
> other flags previously.
Ah, ok that makes more sense. Sorry for my confusion, but if you
wouldn't mind adding the additional info in v3 it might help others
(or just me!)
You may add my RB to such a v3 w/ updated commit message.
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 08/14] powerpc/vdso: Remove an unsupported flag from vgettimeofday-32.o with clang
@ 2023-01-09 23:16 ` Nick Desaulniers
0 siblings, 0 replies; 76+ messages in thread
From: Nick Desaulniers @ 2023-01-09 23:16 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Mon, Jan 9, 2023 at 2:38 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Mon, Jan 09, 2023 at 02:12:55PM -0800, Nick Desaulniers wrote:
> > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > warns:
> > >
> > > clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
> > >
> > > This flag is supported for 64-bit powerpc but not 32-bit, hence the warning.
> > > Just remove the flag from vgettimeofday-32.o's CFLAGS when using clang, as has
> > > been done for other flags previously.
> > >
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> >
> > Hmm...so this was added by the top level Makefile doing a cc-option
> > test. How did the test pass if this was unsupported? That worries me
> > that perhaps other cc-option tests are passing erroneously for certain
> > ppc -m32/-m64 configs?
>
> Sure, that is a reasonable concern. I should have expanded upon this a
> little bit more in the commit message. Is this any better?
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns:
>
> clang-16: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
>
> This warning happens because vgettimeofday-32.c gets its base CFLAGS
> from the main kernel, which may contain flags that are only supported
> on a 64-bit target but not a 32-bit one, which is the case here.
> -fstack-clash-protection and its negation are only suppported by the
> 64-bit powerpc target but that flag is included in an invocation for a
> 32-bit powerpc target, so clang points out that while the flag is one
> that it recognizes, it is not actually used by this compiler job.
>
> To eliminate the warning, remove -fno-stack-clash-protection from
> vgettimeofday-32.c's CFLAGS when using clang, as has been done for
> other flags previously.
Ah, ok that makes more sense. Sorry for my confusion, but if you
wouldn't mind adding the additional info in v3 it might help others
(or just me!)
You may add my RB to such a v3 w/ updated commit message.
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
[not found] ` <20230109222337.GM25951__25255.3859770828$1673303520$gmane$org@gate.crashing.org>
@ 2023-01-10 0:22 ` Andreas Schwab
0 siblings, 0 replies; 76+ messages in thread
From: Andreas Schwab @ 2023-01-10 0:22 UTC (permalink / raw)
To: Segher Boessenkool
Cc: Nick Desaulniers, kernel test robot, linux-kbuild, trix,
masahiroy, llvm, npiggin, Nathan Chancellor, linuxppc-dev,
nicolas
On Jan 09 2023, Segher Boessenkool wrote:
> It is required by POSIX (for the c99 command, anyway). It *also* is
> required to be supported when producing object files (so when no linking
> is done).
>
> It is a GCC flag, and documented just fine:
> https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
Most assembler flags are unrelated to the flags passed to the compiler
driver, and -s is no exception. POSIX has nothing to say about the
sub-commands of the compiler anyway.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-10 0:22 ` Andreas Schwab
0 siblings, 0 replies; 76+ messages in thread
From: Andreas Schwab @ 2023-01-10 0:22 UTC (permalink / raw)
To: Segher Boessenkool
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm,
Nick Desaulniers, npiggin, Nathan Chancellor, linuxppc-dev,
nicolas
On Jan 09 2023, Segher Boessenkool wrote:
> It is required by POSIX (for the c99 command, anyway). It *also* is
> required to be supported when producing object files (so when no linking
> is done).
>
> It is a GCC flag, and documented just fine:
> https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
Most assembler flags are unrelated to the flags passed to the compiler
driver, and -s is no exception. POSIX has nothing to say about the
sub-commands of the compiler anyway.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-10 0:22 ` Andreas Schwab
@ 2023-01-10 0:43 ` Segher Boessenkool
-1 siblings, 0 replies; 76+ messages in thread
From: Segher Boessenkool @ 2023-01-10 0:43 UTC (permalink / raw)
To: Andreas Schwab
Cc: Nick Desaulniers, kernel test robot, linux-kbuild, trix,
masahiroy, llvm, npiggin, Nathan Chancellor, linuxppc-dev,
nicolas
On Tue, Jan 10, 2023 at 01:22:38AM +0100, Andreas Schwab wrote:
> On Jan 09 2023, Segher Boessenkool wrote:
>
> > It is required by POSIX (for the c99 command, anyway). It *also* is
> > required to be supported when producing object files (so when no linking
> > is done).
> >
> > It is a GCC flag, and documented just fine:
> > https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
>
> Most assembler flags are unrelated to the flags passed to the compiler
> driver, and -s is no exception. POSIX has nothing to say about the
> sub-commands of the compiler anyway.
But this is not an assembler flag!
quiet_cmd_vdso32as = VDSO32A $@
cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
where
ifdef CROSS32_COMPILE
VDSOCC := $(CROSS32_COMPILE)gcc
else
VDSOCC := $(CC)
endif
The name of the make variable AS32FLAGS is a bit misleading. This
variable does not hold arguments to as, it holds arguments to the
compiler driver, "gcc".
Segher
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-10 0:43 ` Segher Boessenkool
0 siblings, 0 replies; 76+ messages in thread
From: Segher Boessenkool @ 2023-01-10 0:43 UTC (permalink / raw)
To: Andreas Schwab
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm,
Nick Desaulniers, npiggin, Nathan Chancellor, linuxppc-dev,
nicolas
On Tue, Jan 10, 2023 at 01:22:38AM +0100, Andreas Schwab wrote:
> On Jan 09 2023, Segher Boessenkool wrote:
>
> > It is required by POSIX (for the c99 command, anyway). It *also* is
> > required to be supported when producing object files (so when no linking
> > is done).
> >
> > It is a GCC flag, and documented just fine:
> > https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
>
> Most assembler flags are unrelated to the flags passed to the compiler
> driver, and -s is no exception. POSIX has nothing to say about the
> sub-commands of the compiler anyway.
But this is not an assembler flag!
quiet_cmd_vdso32as = VDSO32A $@
cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $<
where
ifdef CROSS32_COMPILE
VDSOCC := $(CROSS32_COMPILE)gcc
else
VDSOCC := $(CC)
endif
The name of the make variable AS32FLAGS is a bit misleading. This
variable does not hold arguments to as, it holds arguments to the
compiler driver, "gcc".
Segher
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-09 23:14 ` Nick Desaulniers
@ 2023-01-10 0:51 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-10 0:51 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Segher Boessenkool, kernel test robot, linux-kbuild, trix,
masahiroy, llvm, npiggin, linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 03:14:33PM -0800, Nick Desaulniers wrote:
> On Mon, Jan 9, 2023 at 2:29 PM Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> >
> > Hi! Happy new year all.
>
> HNY Segher! :)
>
> >
> > On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> > > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > > >
> > > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > > warns that ASFLAGS 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]
> > > >
> > > > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > > > and it is ignored for the powerpc target so just drop the flag
> > > > altogether, as it is not needed.
> > >
> > > Do you have any more info where you found this? I don't see -s
> > > documented as an assembler flag.
> > > https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> > > https://sourceware.org/binutils/docs/as/Invoking.html
> >
> > It is required by POSIX (for the c99 command, anyway). It *also* is
> > required to be supported when producing object files (so when no linking
> > is done).
> >
> > It is a GCC flag, and documented just fine:
> > https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
> >
> > (Yes, that says it is for linking; but the option is allowed without
> > error of any kind always).
> >
> > (ASFLAGS sounds like it is for assembler commands, but it really is
> > for compiler commands that just happen to get .S input files).
> >
> > > The patch seems fine to me, but what was this ever supposed to be?
> > > FWICT it predates git history (looking at
> > > arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
> >
> > Yeah, good question. This compiler flag does the moral equivalent of
> > strip -s (aka --strip-all). Maybe this was needed at some point, or
> > the symbol or debug info was just annoying (during bringup or similar)?
>
> Ah right! Ok then, I think we might keep the patch's diff, but update
> the commit message to mention this is a linker flag that's unused
> since the compiler is being invoked but not the linker (the compiler
> is being used as the driver to assemble a single assembler source
> without linking it; linking is then driven by the linker in a separate
> make rule).
Yes, sorry, I thought that was clear with the "which is a linking phase
option" comment in the commit message but clearly not :)
> Then we might want to revisit that s390 patch, too?
> https://lore.kernel.org/llvm/20221228-drop-qunused-arguments-v1-9-658cbc8fc592@kernel.org/
So for this patch, I have
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns:
clang-16: error: argument unused during compilation: '-s' [-Werror,-Wunused-command-line-argument]
The compiler's '-s' flag is a linking option (it is passed along to the
linker directly), which means it does nothing when the linker is not
invoked by the compiler. The kernel builds all .o files with either '-c'
or '-S', which do not run the linker, so '-s' can be safely dropped from
ASFLAGS.
as a new commit message. Is that sufficient for everyone? If so, I'll
adjust the s390 commit to match, as it is the same exact problem.
Alternatively, if '-s' should actually remain around, we could move it
to ldflags-y, which is added in patch 7. However, I assume that nobody
has noticed that it has not been doing its job for a while, so it should
be safe to remove.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-10 0:51 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-10 0:51 UTC (permalink / raw)
To: Nick Desaulniers
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm, npiggin,
linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 03:14:33PM -0800, Nick Desaulniers wrote:
> On Mon, Jan 9, 2023 at 2:29 PM Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> >
> > Hi! Happy new year all.
>
> HNY Segher! :)
>
> >
> > On Mon, Jan 09, 2023 at 01:58:32PM -0800, Nick Desaulniers wrote:
> > > On Wed, Jan 4, 2023 at 11:55 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > > >
> > > > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > > > warns that ASFLAGS 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]
> > > >
> > > > Looking at the GAS sources, '-s' is only useful when targeting Solaris
> > > > and it is ignored for the powerpc target so just drop the flag
> > > > altogether, as it is not needed.
> > >
> > > Do you have any more info where you found this? I don't see -s
> > > documented as an assembler flag.
> > > https://sourceware.org/binutils/docs/as/PowerPC_002dOpts.html
> > > https://sourceware.org/binutils/docs/as/Invoking.html
> >
> > It is required by POSIX (for the c99 command, anyway). It *also* is
> > required to be supported when producing object files (so when no linking
> > is done).
> >
> > It is a GCC flag, and documented just fine:
> > https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#index-s
> >
> > (Yes, that says it is for linking; but the option is allowed without
> > error of any kind always).
> >
> > (ASFLAGS sounds like it is for assembler commands, but it really is
> > for compiler commands that just happen to get .S input files).
> >
> > > The patch seems fine to me, but what was this ever supposed to be?
> > > FWICT it predates git history (looking at
> > > arch/powerpc/kernel/vdso32/Makefile at fc15351d9d63)
> >
> > Yeah, good question. This compiler flag does the moral equivalent of
> > strip -s (aka --strip-all). Maybe this was needed at some point, or
> > the symbol or debug info was just annoying (during bringup or similar)?
>
> Ah right! Ok then, I think we might keep the patch's diff, but update
> the commit message to mention this is a linker flag that's unused
> since the compiler is being invoked but not the linker (the compiler
> is being used as the driver to assemble a single assembler source
> without linking it; linking is then driven by the linker in a separate
> make rule).
Yes, sorry, I thought that was clear with the "which is a linking phase
option" comment in the commit message but clearly not :)
> Then we might want to revisit that s390 patch, too?
> https://lore.kernel.org/llvm/20221228-drop-qunused-arguments-v1-9-658cbc8fc592@kernel.org/
So for this patch, I have
When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
warns:
clang-16: error: argument unused during compilation: '-s' [-Werror,-Wunused-command-line-argument]
The compiler's '-s' flag is a linking option (it is passed along to the
linker directly), which means it does nothing when the linker is not
invoked by the compiler. The kernel builds all .o files with either '-c'
or '-S', which do not run the linker, so '-s' can be safely dropped from
ASFLAGS.
as a new commit message. Is that sufficient for everyone? If so, I'll
adjust the s390 commit to match, as it is the same exact problem.
Alternatively, if '-s' should actually remain around, we could move it
to ldflags-y, which is added in patch 7. However, I assume that nobody
has noticed that it has not been doing its job for a while, so it should
be safe to remove.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 03/14] MIPS: Prefer cc-option for additions to cflags
2023-01-04 19:54 ` [PATCH 03/14] MIPS: Prefer cc-option for additions to cflags Nathan Chancellor
2023-01-09 21:21 ` Nick Desaulniers
@ 2023-01-10 7:42 ` Philippe Mathieu-Daudé
2023-01-10 8:30 ` Thomas Bogendoerfer
2 siblings, 0 replies; 76+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-10 7:42 UTC (permalink / raw)
To: Nathan Chancellor, masahiroy, ndesaulniers
Cc: nicolas, trix, linux-kbuild, llvm, kernel test robot, tsbogend,
linux-mips
On 4/1/23 20:54, Nathan Chancellor wrote:
> A future change will switch as-option to use KBUILD_AFLAGS instead of
> KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause
> issues if the flag being tested requires a flag previously added to
> KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions
> so that the flags are tested properly.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: tsbogend@alpha.franken.de
> Cc: linux-mips@vger.kernel.org
> ---
> arch/mips/Makefile | 2 +-
> arch/mips/loongson2ef/Platform | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 02/14] MIPS: Always use -Wa,-msoft-float and eliminate GAS_HAS_SET_HARDFLOAT
2023-01-04 19:54 ` [PATCH 02/14] MIPS: Always use -Wa,-msoft-float and eliminate GAS_HAS_SET_HARDFLOAT Nathan Chancellor
2023-01-09 21:18 ` Nick Desaulniers
@ 2023-01-10 7:45 ` Philippe Mathieu-Daudé
2023-01-10 8:30 ` Thomas Bogendoerfer
2 siblings, 0 replies; 76+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-10 7:45 UTC (permalink / raw)
To: Nathan Chancellor, masahiroy, ndesaulniers
Cc: nicolas, trix, linux-kbuild, llvm, kernel test robot, tsbogend,
linux-mips
On 4/1/23 20:54, Nathan Chancellor wrote:
> -Wa,-msoft-float is tested with as-option, which will be a problem for
> clang with an upcoming change to move as-option to use KBUILD_AFLAGS
> instead of KBUILD_CFLAGS due to a lack of '-mno-abicalls' in
> KBUILD_AFLAGS at the point that this check occurs; $(cflags-y) is added
> to KBUILD_AFLAGS towards the end of this file.
>
> clang: error: ignoring '-fno-PIE' option as it cannot be used with implicit usage of -mabicalls and the N64 ABI [-Werror,-Woption-ignored]
>
> This could be resolved by switching to a cc-option check but
> '$(cflags-y)' would need to be added so that '-mno-abicalls' is present
> for the test. However, this check is no longer necessary, as
> -msoft-float is supported by all supported assembler versions (GNU as
> 2.25+ and LLVM 11+). Eliminate GAS_HAS_SET_HARDFLOAT and all of its
> uses, inlining SET_HARDFLOAT where necessary.
>
> Link: https://lore.kernel.org/202209101939.bvk64Fok-lkp@intel.com/
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: tsbogend@alpha.franken.de
> Cc: linux-mips@vger.kernel.org
> ---
> arch/mips/Makefile | 11 +---------
> 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 +++---
> 9 files changed, 40 insertions(+), 75 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 02/14] MIPS: Always use -Wa,-msoft-float and eliminate GAS_HAS_SET_HARDFLOAT
2023-01-04 19:54 ` [PATCH 02/14] MIPS: Always use -Wa,-msoft-float and eliminate GAS_HAS_SET_HARDFLOAT Nathan Chancellor
2023-01-09 21:18 ` Nick Desaulniers
2023-01-10 7:45 ` Philippe Mathieu-Daudé
@ 2023-01-10 8:30 ` Thomas Bogendoerfer
2 siblings, 0 replies; 76+ messages in thread
From: Thomas Bogendoerfer @ 2023-01-10 8:30 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, ndesaulniers, nicolas, trix, linux-kbuild, llvm,
kernel test robot, linux-mips
On Wed, Jan 04, 2023 at 12:54:19PM -0700, Nathan Chancellor wrote:
> -Wa,-msoft-float is tested with as-option, which will be a problem for
> clang with an upcoming change to move as-option to use KBUILD_AFLAGS
> instead of KBUILD_CFLAGS due to a lack of '-mno-abicalls' in
> KBUILD_AFLAGS at the point that this check occurs; $(cflags-y) is added
> to KBUILD_AFLAGS towards the end of this file.
>
> clang: error: ignoring '-fno-PIE' option as it cannot be used with implicit usage of -mabicalls and the N64 ABI [-Werror,-Woption-ignored]
>
> This could be resolved by switching to a cc-option check but
> '$(cflags-y)' would need to be added so that '-mno-abicalls' is present
> for the test. However, this check is no longer necessary, as
> -msoft-float is supported by all supported assembler versions (GNU as
> 2.25+ and LLVM 11+). Eliminate GAS_HAS_SET_HARDFLOAT and all of its
> uses, inlining SET_HARDFLOAT where necessary.
>
> Link: https://lore.kernel.org/202209101939.bvk64Fok-lkp@intel.com/
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: tsbogend@alpha.franken.de
> Cc: linux-mips@vger.kernel.org
> ---
> arch/mips/Makefile | 11 +---------
> 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 +++---
> 9 files changed, 40 insertions(+), 75 deletions(-)
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 03/14] MIPS: Prefer cc-option for additions to cflags
2023-01-04 19:54 ` [PATCH 03/14] MIPS: Prefer cc-option for additions to cflags Nathan Chancellor
2023-01-09 21:21 ` Nick Desaulniers
2023-01-10 7:42 ` Philippe Mathieu-Daudé
@ 2023-01-10 8:30 ` Thomas Bogendoerfer
2 siblings, 0 replies; 76+ messages in thread
From: Thomas Bogendoerfer @ 2023-01-10 8:30 UTC (permalink / raw)
To: Nathan Chancellor
Cc: masahiroy, ndesaulniers, nicolas, trix, linux-kbuild, llvm,
kernel test robot, linux-mips
On Wed, Jan 04, 2023 at 12:54:20PM -0700, Nathan Chancellor wrote:
> A future change will switch as-option to use KBUILD_AFLAGS instead of
> KBUILD_CFLAGS to allow clang to drop -Qunused-arguments, which may cause
> issues if the flag being tested requires a flag previously added to
> KBUILD_CFLAGS but not KBUILD_AFLAGS. Use cc-option for cflags additions
> so that the flags are tested properly.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Cc: tsbogend@alpha.franken.de
> Cc: linux-mips@vger.kernel.org
> ---
> arch/mips/Makefile | 2 +-
> arch/mips/loongson2ef/Platform | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-10 0:51 ` Nathan Chancellor
@ 2023-01-10 11:45 ` Segher Boessenkool
-1 siblings, 0 replies; 76+ messages in thread
From: Segher Boessenkool @ 2023-01-10 11:45 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Nick Desaulniers, kernel test robot, linux-kbuild, trix,
masahiroy, llvm, npiggin, linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 05:51:23PM -0700, Nathan Chancellor wrote:
> So for this patch, I have
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns:
>
> clang-16: error: argument unused during compilation: '-s' [-Werror,-Wunused-command-line-argument]
>
> The compiler's '-s' flag is a linking option (it is passed along to the
> linker directly), which means it does nothing when the linker is not
> invoked by the compiler. The kernel builds all .o files with either '-c'
> or '-S', which do not run the linker, so '-s' can be safely dropped from
> ASFLAGS.
>
> as a new commit message. Is that sufficient for everyone? If so, I'll
> adjust the s390 commit to match, as it is the same exact problem.
Almost? -S doesn't write .o files, it writes a .s file. To go from an
assembler file (.s, or .S if you want to run the C preprocessor on non-C
code for some strange reason, the assembler macro facilities are vastly
superior) to an object file is just -c as well.
> Alternatively, if '-s' should actually remain around, we could move it
> to ldflags-y, which is added in patch 7. However, I assume that nobody
> has noticed that it has not been doing its job for a while, so it should
> be safe to remove.
+1
Segher
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-10 11:45 ` Segher Boessenkool
0 siblings, 0 replies; 76+ messages in thread
From: Segher Boessenkool @ 2023-01-10 11:45 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm,
Nick Desaulniers, npiggin, linuxppc-dev, nicolas
On Mon, Jan 09, 2023 at 05:51:23PM -0700, Nathan Chancellor wrote:
> So for this patch, I have
>
> When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> warns:
>
> clang-16: error: argument unused during compilation: '-s' [-Werror,-Wunused-command-line-argument]
>
> The compiler's '-s' flag is a linking option (it is passed along to the
> linker directly), which means it does nothing when the linker is not
> invoked by the compiler. The kernel builds all .o files with either '-c'
> or '-S', which do not run the linker, so '-s' can be safely dropped from
> ASFLAGS.
>
> as a new commit message. Is that sufficient for everyone? If so, I'll
> adjust the s390 commit to match, as it is the same exact problem.
Almost? -S doesn't write .o files, it writes a .s file. To go from an
assembler file (.s, or .S if you want to run the C preprocessor on non-C
code for some strange reason, the assembler macro facilities are vastly
superior) to an object file is just -c as well.
> Alternatively, if '-s' should actually remain around, we could move it
> to ldflags-y, which is added in patch 7. However, I assume that nobody
> has noticed that it has not been doing its job for a while, so it should
> be safe to remove.
+1
Segher
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
2023-01-10 11:45 ` Segher Boessenkool
@ 2023-01-10 15:02 ` Nathan Chancellor
-1 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-10 15:02 UTC (permalink / raw)
To: Segher Boessenkool
Cc: Nick Desaulniers, kernel test robot, linux-kbuild, trix,
masahiroy, llvm, npiggin, linuxppc-dev, nicolas
On Tue, Jan 10, 2023 at 05:45:23AM -0600, Segher Boessenkool wrote:
> On Mon, Jan 09, 2023 at 05:51:23PM -0700, Nathan Chancellor wrote:
> > So for this patch, I have
> >
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > warns:
> >
> > clang-16: error: argument unused during compilation: '-s' [-Werror,-Wunused-command-line-argument]
> >
> > The compiler's '-s' flag is a linking option (it is passed along to the
> > linker directly), which means it does nothing when the linker is not
> > invoked by the compiler. The kernel builds all .o files with either '-c'
> > or '-S', which do not run the linker, so '-s' can be safely dropped from
> > ASFLAGS.
> >
> > as a new commit message. Is that sufficient for everyone? If so, I'll
> > adjust the s390 commit to match, as it is the same exact problem.
>
> Almost? -S doesn't write .o files, it writes a .s file. To go from an
> assembler file (.s, or .S if you want to run the C preprocessor on non-C
> code for some strange reason, the assembler macro facilities are vastly
> superior) to an object file is just -c as well.
Heh, right, that is what I get for not paying attention and rushing at
the end of my day :) thanks for being pendantic, I will get that ironed
out for v2, which I should have out later today or tomorrow, time
permitting.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 76+ messages in thread
* Re: [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS
@ 2023-01-10 15:02 ` Nathan Chancellor
0 siblings, 0 replies; 76+ messages in thread
From: Nathan Chancellor @ 2023-01-10 15:02 UTC (permalink / raw)
To: Segher Boessenkool
Cc: kernel test robot, linux-kbuild, trix, masahiroy, llvm,
Nick Desaulniers, npiggin, linuxppc-dev, nicolas
On Tue, Jan 10, 2023 at 05:45:23AM -0600, Segher Boessenkool wrote:
> On Mon, Jan 09, 2023 at 05:51:23PM -0700, Nathan Chancellor wrote:
> > So for this patch, I have
> >
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, it
> > warns:
> >
> > clang-16: error: argument unused during compilation: '-s' [-Werror,-Wunused-command-line-argument]
> >
> > The compiler's '-s' flag is a linking option (it is passed along to the
> > linker directly), which means it does nothing when the linker is not
> > invoked by the compiler. The kernel builds all .o files with either '-c'
> > or '-S', which do not run the linker, so '-s' can be safely dropped from
> > ASFLAGS.
> >
> > as a new commit message. Is that sufficient for everyone? If so, I'll
> > adjust the s390 commit to match, as it is the same exact problem.
>
> Almost? -S doesn't write .o files, it writes a .s file. To go from an
> assembler file (.s, or .S if you want to run the C preprocessor on non-C
> code for some strange reason, the assembler macro facilities are vastly
> superior) to an object file is just -c as well.
Heh, right, that is what I get for not paying attention and rushing at
the end of my day :) thanks for being pendantic, I will get that ironed
out for v2, which I should have out later today or tomorrow, time
permitting.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 76+ messages in thread
end of thread, other threads:[~2023-01-10 17:15 UTC | newest]
Thread overview: 76+ 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 ` Nathan Chancellor
2023-01-04 19:54 ` Nathan Chancellor
2023-01-04 19:54 ` Nathan Chancellor
2023-01-04 19:54 ` [PATCH 01/14] x86/boot/compressed: prefer cc-option for CFLAGS additions Nathan Chancellor
2023-01-04 19:54 ` [PATCH 02/14] MIPS: Always use -Wa,-msoft-float and eliminate GAS_HAS_SET_HARDFLOAT Nathan Chancellor
2023-01-09 21:18 ` Nick Desaulniers
2023-01-10 7:45 ` Philippe Mathieu-Daudé
2023-01-10 8:30 ` Thomas Bogendoerfer
2023-01-04 19:54 ` [PATCH 03/14] MIPS: Prefer cc-option for additions to cflags Nathan Chancellor
2023-01-09 21:21 ` Nick Desaulniers
2023-01-10 7:42 ` Philippe Mathieu-Daudé
2023-01-10 8:30 ` Thomas Bogendoerfer
2023-01-04 19:54 ` [PATCH 04/14] kbuild: Update assembler calls to use proper flags and language target Nathan Chancellor
2023-01-04 19:54 ` [PATCH 05/14] powerpc: Remove linker flag from KBUILD_AFLAGS Nathan Chancellor
2023-01-04 19:54 ` Nathan Chancellor
2023-01-09 21:24 ` Nick Desaulniers
2023-01-09 21:24 ` Nick Desaulniers
2023-01-04 19:54 ` [PATCH 06/14] powerpc/vdso: Remove unused '-s' flag from ASFLAGS Nathan Chancellor
2023-01-04 19:54 ` Nathan Chancellor
2023-01-09 21:58 ` Nick Desaulniers
2023-01-09 21:58 ` Nick Desaulniers
2023-01-09 22:15 ` Nathan Chancellor
2023-01-09 22:15 ` Nathan Chancellor
2023-01-09 22:21 ` Nick Desaulniers
2023-01-09 22:21 ` Nick Desaulniers
2023-01-09 22:23 ` Segher Boessenkool
2023-01-09 22:23 ` Segher Boessenkool
2023-01-09 22:37 ` Nathan Chancellor
2023-01-09 22:37 ` Nathan Chancellor
2023-01-09 22:47 ` Segher Boessenkool
2023-01-09 22:47 ` Segher Boessenkool
2023-01-09 23:14 ` Nick Desaulniers
2023-01-10 0:51 ` Nathan Chancellor
2023-01-10 0:51 ` Nathan Chancellor
2023-01-10 11:45 ` Segher Boessenkool
2023-01-10 11:45 ` Segher Boessenkool
2023-01-10 15:02 ` Nathan Chancellor
2023-01-10 15:02 ` Nathan Chancellor
[not found] ` <20230109222337.GM25951__25255.3859770828$1673303520$gmane$org@gate.crashing.org>
2023-01-10 0:22 ` Andreas Schwab
2023-01-10 0:22 ` Andreas Schwab
2023-01-10 0:43 ` Segher Boessenkool
2023-01-10 0:43 ` Segher Boessenkool
2023-01-04 19:54 ` [PATCH 07/14] powerpc/vdso: Improve linker flags Nathan Chancellor
2023-01-04 19:54 ` Nathan Chancellor
2023-01-09 22:08 ` Nick Desaulniers
2023-01-09 22:08 ` Nick Desaulniers
2023-01-09 22:15 ` Nathan Chancellor
2023-01-09 22:15 ` Nathan Chancellor
2023-01-04 19:54 ` [PATCH 08/14] powerpc/vdso: Remove an unsupported flag from vgettimeofday-32.o with clang Nathan Chancellor
2023-01-04 19:54 ` Nathan Chancellor
2023-01-09 22:12 ` Nick Desaulniers
2023-01-09 22:12 ` Nick Desaulniers
2023-01-09 22:38 ` Nathan Chancellor
2023-01-09 22:38 ` Nathan Chancellor
2023-01-09 23:16 ` Nick Desaulniers
2023-01-09 23:16 ` Nick Desaulniers
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-04 19:54 ` [PATCH 12/14] drm/amd/display: Do not add '-mhard-float' to dml_ccflags for clang Nathan Chancellor
2023-01-04 19:54 ` Nathan Chancellor
2023-01-04 19:54 ` Nathan Chancellor
2023-01-05 14:21 ` Alex Deucher
2023-01-05 14:21 ` Alex Deucher
2023-01-04 19:54 ` [PATCH 13/14] kbuild: Turn a couple more of clang's unused option warnings into errors Nathan Chancellor
2023-01-09 22:15 ` Nick Desaulniers
2023-01-04 19:54 ` [PATCH 14/14] kbuild: Stop using '-Qunused-arguments' with clang Nathan Chancellor
2023-01-09 22:17 ` Nick Desaulniers
2023-01-05 8:00 ` [PATCH 00/14] Remove clang's -Qunused-arguments from KBUILD_CPPFLAGS Heiko Carstens
2023-01-05 8:00 ` Heiko Carstens
2023-01-05 8:00 ` Heiko Carstens
2023-01-05 8:00 ` Heiko Carstens
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.