Makefile: lto: Pass -warn-stack-size only on LLD < 13.0.0
authorTor Vic <torvic9@mailbox.org>
Sun, 13 Jun 2021 13:07:49 +0000 (13:07 +0000)
committerKees Cook <keescook@chromium.org>
Mon, 14 Jun 2021 21:52:38 +0000 (14:52 -0700)
commit0236526d76b87c1dc2cbe3eb31ae29be5b0ca151
treed057614c0f076d0ca5ada2a62587ab46d18b9541
parent2398ce80152aae33b9501ef54452e09e8e8d4262
Makefile: lto: Pass -warn-stack-size only on LLD < 13.0.0

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>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/7631bab7-a8ab-f884-ab54-f4198976125c@mailbox.org
Makefile