* [PATCH 1/1] Makefile: Pass -warn-stack-size only on LLD < 13.0.0
@ 2021-06-13 13:07 Tor Vic
2021-06-14 20:51 ` Nathan Chancellor
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tor Vic @ 2021-06-13 13:07 UTC (permalink / raw
To: linux-kernel@vger.kernel.org, masahiroy, Nathan Chancellor,
ndesaulniers@google.com, keescook
Cc: clang-built-linux@googlegroups.com, linux-kbuild
Since LLVM commit fc018eb, the '-warn-stack-size' flag has been dropped
[1], leading to the following error message when building with Clang-13
and LLD-13:
ld.lld: error: -plugin-opt=-: ld.lld: Unknown command line argument
'-warn-stack-size=2048'. Try: 'ld.lld --help'
ld.lld: Did you mean '--asan-stack=2048'?
In the same way as with commit 2398ce80152a ("x86, lto: Pass
-stack-alignment only on LLD < 13.0.0") , make '-warn-stack-size'
conditional on LLD < 13.0.0.
[1] https://reviews.llvm.org/D103928
Fixes: 24845dcb170e ("Makefile: LTO: have linker check -Wframe-larger-than")
Cc: stable@vger.kernel.org
Link: https://github.com/ClangBuiltLinux/linux/issues/1377
Signed-off-by: Tor Vic <torvic9@mailbox.org>
---
Makefile | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 144d4f8b7eb3..51a1b6b2c2ab 100644
--- a/Makefile
+++ b/Makefile
@@ -929,11 +929,14 @@ CC_FLAGS_LTO += -fvisibility=hidden
# Limit inlining across translation units to reduce binary size
KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
-# Check for frame size exceeding threshold during prolog/epilog insertion.
+# Check for frame size exceeding threshold during prolog/epilog insertion
+# when using lld < 13.0.0.
ifneq ($(CONFIG_FRAME_WARN),0)
+ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN)
endif
endif
+endif
ifdef CONFIG_LTO
KBUILD_CFLAGS += -fno-lto $(CC_FLAGS_LTO)
--
2.32.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Makefile: Pass -warn-stack-size only on LLD < 13.0.0
2021-06-13 13:07 [PATCH 1/1] Makefile: Pass -warn-stack-size only on LLD < 13.0.0 Tor Vic
@ 2021-06-14 20:51 ` Nathan Chancellor
2021-06-14 20:54 ` Nick Desaulniers
2021-06-14 21:49 ` Kees Cook
2 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2021-06-14 20:51 UTC (permalink / raw
To: Tor Vic, linux-kernel@vger.kernel.org, masahiroy,
ndesaulniers@google.com, keescook
Cc: clang-built-linux@googlegroups.com, linux-kbuild
On 6/13/2021 6:07 AM, 'Tor Vic' via Clang Built Linux wrote:
> Since LLVM commit fc018eb, the '-warn-stack-size' flag has been dropped
> [1], leading to the following error message when building with Clang-13
> and LLD-13:
>
> ld.lld: error: -plugin-opt=-: ld.lld: Unknown command line argument
> '-warn-stack-size=2048'. Try: 'ld.lld --help'
> ld.lld: Did you mean '--asan-stack=2048'?
>
> In the same way as with commit 2398ce80152a ("x86, lto: Pass
> -stack-alignment only on LLD < 13.0.0") , make '-warn-stack-size'
> conditional on LLD < 13.0.0.
>
> [1] https://reviews.llvm.org/D103928
>
> Fixes: 24845dcb170e ("Makefile: LTO: have linker check -Wframe-larger-than")
> Cc: stable@vger.kernel.org
> Link: https://github.com/ClangBuiltLinux/linux/issues/1377
> Signed-off-by: Tor Vic <torvic9@mailbox.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
The commit that this fixes went into 5.13-rc4 and our CI builds are
currently failing without this so it would be nice if it could go into
5.13 but I understand it is getting late in the cycle and there has
already been a fixes pull request with a similar fix.
Cheers,
Nathan
> ---
> Makefile | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 144d4f8b7eb3..51a1b6b2c2ab 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -929,11 +929,14 @@ CC_FLAGS_LTO += -fvisibility=hidden
> # Limit inlining across translation units to reduce binary size
> KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
>
> -# Check for frame size exceeding threshold during prolog/epilog insertion.
> +# Check for frame size exceeding threshold during prolog/epilog insertion
> +# when using lld < 13.0.0.
> ifneq ($(CONFIG_FRAME_WARN),0)
> +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
> KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN)
> endif
> endif
> +endif
>
> ifdef CONFIG_LTO
> KBUILD_CFLAGS += -fno-lto $(CC_FLAGS_LTO)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Makefile: Pass -warn-stack-size only on LLD < 13.0.0
2021-06-13 13:07 [PATCH 1/1] Makefile: Pass -warn-stack-size only on LLD < 13.0.0 Tor Vic
2021-06-14 20:51 ` Nathan Chancellor
@ 2021-06-14 20:54 ` Nick Desaulniers
2021-06-14 21:49 ` Kees Cook
2 siblings, 0 replies; 4+ messages in thread
From: Nick Desaulniers @ 2021-06-14 20:54 UTC (permalink / raw
To: Tor Vic
Cc: linux-kernel@vger.kernel.org, Masahiro Yamada, Nathan Chancellor,
Kees Cook, clang-built-linux@googlegroups.com,
Linux Kbuild mailing list
On Sun, Jun 13, 2021 at 6:07 AM Tor Vic <torvic9@mailbox.org> wrote:
>
> Since LLVM commit fc018eb, the '-warn-stack-size' flag has been dropped
> [1], leading to the following error message when building with Clang-13
> and LLD-13:
>
> ld.lld: error: -plugin-opt=-: ld.lld: Unknown command line argument
> '-warn-stack-size=2048'. Try: 'ld.lld --help'
> ld.lld: Did you mean '--asan-stack=2048'?
>
> In the same way as with commit 2398ce80152a ("x86, lto: Pass
> -stack-alignment only on LLD < 13.0.0") , make '-warn-stack-size'
> conditional on LLD < 13.0.0.
>
> [1] https://reviews.llvm.org/D103928
>
> Fixes: 24845dcb170e ("Makefile: LTO: have linker check -Wframe-larger-than")
> Cc: stable@vger.kernel.org
> Link: https://github.com/ClangBuiltLinux/linux/issues/1377
> Signed-off-by: Tor Vic <torvic9@mailbox.org>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Makefile | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 144d4f8b7eb3..51a1b6b2c2ab 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -929,11 +929,14 @@ CC_FLAGS_LTO += -fvisibility=hidden
> # Limit inlining across translation units to reduce binary size
> KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
>
> -# Check for frame size exceeding threshold during prolog/epilog insertion.
> +# Check for frame size exceeding threshold during prolog/epilog insertion
> +# when using lld < 13.0.0.
> ifneq ($(CONFIG_FRAME_WARN),0)
> +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
> KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN)
> endif
> endif
> +endif
>
> ifdef CONFIG_LTO
> KBUILD_CFLAGS += -fno-lto $(CC_FLAGS_LTO)
> --
> 2.32.0
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Makefile: Pass -warn-stack-size only on LLD < 13.0.0
2021-06-13 13:07 [PATCH 1/1] Makefile: Pass -warn-stack-size only on LLD < 13.0.0 Tor Vic
2021-06-14 20:51 ` Nathan Chancellor
2021-06-14 20:54 ` Nick Desaulniers
@ 2021-06-14 21:49 ` Kees Cook
2 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2021-06-14 21:49 UTC (permalink / raw
To: Tor Vic
Cc: linux-kernel@vger.kernel.org, masahiroy, Nathan Chancellor,
ndesaulniers@google.com, clang-built-linux@googlegroups.com,
linux-kbuild
On Sun, Jun 13, 2021 at 01:07:49PM +0000, Tor Vic wrote:
> Since LLVM commit fc018eb, the '-warn-stack-size' flag has been dropped
> [1], leading to the following error message when building with Clang-13
> and LLD-13:
>
> ld.lld: error: -plugin-opt=-: ld.lld: Unknown command line argument
> '-warn-stack-size=2048'. Try: 'ld.lld --help'
> ld.lld: Did you mean '--asan-stack=2048'?
>
> In the same way as with commit 2398ce80152a ("x86, lto: Pass
> -stack-alignment only on LLD < 13.0.0") , make '-warn-stack-size'
> conditional on LLD < 13.0.0.
>
> [1] https://reviews.llvm.org/D103928
Is there a way Clang can just warn instead of breaking the kernel build
when it moves these kinds of options around? That would make things must
less disruptive to the CI, etc. :)
-Kees
> Fixes: 24845dcb170e ("Makefile: LTO: have linker check -Wframe-larger-than")
> Cc: stable@vger.kernel.org
> Link: https://github.com/ClangBuiltLinux/linux/issues/1377
> Signed-off-by: Tor Vic <torvic9@mailbox.org>
> ---
> Makefile | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 144d4f8b7eb3..51a1b6b2c2ab 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -929,11 +929,14 @@ CC_FLAGS_LTO += -fvisibility=hidden
> # Limit inlining across translation units to reduce binary size
> KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
>
> -# Check for frame size exceeding threshold during prolog/epilog insertion.
> +# Check for frame size exceeding threshold during prolog/epilog insertion
> +# when using lld < 13.0.0.
> ifneq ($(CONFIG_FRAME_WARN),0)
> +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
> KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN)
> endif
> endif
> +endif
>
> ifdef CONFIG_LTO
> KBUILD_CFLAGS += -fno-lto $(CC_FLAGS_LTO)
> --
> 2.32.0
--
Kees Cook
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-14 21:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-13 13:07 [PATCH 1/1] Makefile: Pass -warn-stack-size only on LLD < 13.0.0 Tor Vic
2021-06-14 20:51 ` Nathan Chancellor
2021-06-14 20:54 ` Nick Desaulniers
2021-06-14 21:49 ` Kees Cook
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.