linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/vdso: Filter clang's auto var init zero enabler when linking
@ 2023-01-24 16:19 Nathan Chancellor
  2023-01-26  4:23 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2023-01-24 16:19 UTC (permalink / raw)
  To: masahiroy
  Cc: ndesaulniers, nicolas, mpe, npiggin, christophe.leroy, trix,
	linux-kbuild, linux-kernel, linuxppc-dev, llvm,
	Nathan Chancellor

After commit 7bbf02b875b5 ("kbuild: Stop using '-Qunused-arguments' with
clang"), the PowerPC vDSO shows the following error with clang-13 and
older when CONFIG_INIT_STACK_ALL_ZERO is enabled:

  clang: error: argument unused during compilation: '-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang' [-Werror,-Wunused-command-line-argument]

clang-14 added a change to make sure this flag never triggers
-Wunused-command-line-argument, so it is fixed with newer releases. For
older releases that the kernel still supports building with, just filter
out this flag, as has been done for other flags.

Fixes: b174f4c26aa3 ("powerpc/vdso: Improve linker flags")
Fixes: 7bbf02b875b5 ("kbuild: Stop using '-Qunused-arguments' with clang")
Link: https://github.com/llvm/llvm-project/commit/ca6d5813d17598cd180995fb3bdfca00f364475f
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
This should be the last flag that needs to be filtered (famous last
words...) but if any more come up, we should really just explore
switching the PowerPC vDSO to linking with $(LD) like every other part
of the kernel; for now, I hope this is fine.

Cheers,
Nathan
---
 Makefile                          | 4 +++-
 arch/powerpc/kernel/vdso/Makefile | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index cf30a8b6463e..0406f37fd7a2 100644
--- a/Makefile
+++ b/Makefile
@@ -912,7 +912,9 @@ ifdef CONFIG_INIT_STACK_ALL_ZERO
 KBUILD_CFLAGS	+= -ftrivial-auto-var-init=zero
 ifdef CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER
 # https://github.com/llvm/llvm-project/issues/44842
-KBUILD_CFLAGS	+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+CC_AUTO_VAR_INIT_ZERO_ENABLER := -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
+export CC_AUTO_VAR_INIT_ZERO_ENABLER
+KBUILD_CFLAGS	+= $(CC_AUTO_VAR_INIT_ZERO_ENABLER)
 endif
 endif
 
diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index 7e69e87fbf74..d2a1dc0956d5 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -56,7 +56,7 @@ ccflags-y := -fno-common -fno-builtin
 ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack
 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))
+ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS))
 
 CC32FLAGS := -m32
 LD32FLAGS := -Wl,-soname=linux-vdso32.so.1

---
base-commit: a778c9dd138b4f4410779705b444d58ce6f8fc44
change-id: 20230123-qunused-argument-auto-var-init-8ae79ddfd34f

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/vdso: Filter clang's auto var init zero enabler when linking
  2023-01-24 16:19 [PATCH] powerpc/vdso: Filter clang's auto var init zero enabler when linking Nathan Chancellor
@ 2023-01-26  4:23 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2023-01-26  4:23 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: ndesaulniers, nicolas, mpe, npiggin, christophe.leroy, trix,
	linux-kbuild, linux-kernel, linuxppc-dev, llvm

On Wed, Jan 25, 2023 at 1:20 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> After commit 7bbf02b875b5 ("kbuild: Stop using '-Qunused-arguments' with
> clang"), the PowerPC vDSO shows the following error with clang-13 and
> older when CONFIG_INIT_STACK_ALL_ZERO is enabled:
>
>   clang: error: argument unused during compilation: '-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang' [-Werror,-Wunused-command-line-argument]
>
> clang-14 added a change to make sure this flag never triggers
> -Wunused-command-line-argument, so it is fixed with newer releases. For
> older releases that the kernel still supports building with, just filter
> out this flag, as has been done for other flags.
>
> Fixes: b174f4c26aa3 ("powerpc/vdso: Improve linker flags")
> Fixes: 7bbf02b875b5 ("kbuild: Stop using '-Qunused-arguments' with clang")
> Link: https://github.com/llvm/llvm-project/commit/ca6d5813d17598cd180995fb3bdfca00f364475f
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> This should be the last flag that needs to be filtered (famous last
> words...) but if any more come up, we should really just explore
> switching the PowerPC vDSO to linking with $(LD) like every other part
> of the kernel; for now, I hope this is fine.
>
> Cheers,
> Nathan


Applied to linux-kbuild. Thanks.

Since I rebased the branch, the tags have been updated
accordingly.





    powerpc/vdso: Filter clang's auto var init zero enabler when linking

    After commit 8d9acfce3332 ("kbuild: Stop using '-Qunused-arguments' with
    clang"), the PowerPC vDSO shows the following error with clang-13 and
    older when CONFIG_INIT_STACK_ALL_ZERO is enabled:

      clang: error: argument unused during compilation:
'-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang'
[-Werror,-Wunused-command-line-argument]

    clang-14 added a change to make sure this flag never triggers
    -Wunused-command-line-argument, so it is fixed with newer releases. For
    older releases that the kernel still supports building with, just filter
    out this flag, as has been done for other flags.

    Fixes: f0a42fbab447 ("powerpc/vdso: Improve linker flags")
    Fixes: 8d9acfce3332 ("kbuild: Stop using '-Qunused-arguments' with clang")
    Link: https://github.com/llvm/llvm-project/commit/ca6d5813d17598cd180995fb3bdfca00f364475f
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-26  4:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 16:19 [PATCH] powerpc/vdso: Filter clang's auto var init zero enabler when linking Nathan Chancellor
2023-01-26  4:23 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).