-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
need -Qunused-arguments with -fuse-lld for cc-option tests #366
Comments
Turns out this fixes #357. I think that the diff --git a/Makefile b/Makefile
index 28728a394362..cfaef110bb33 100644
--- a/Makefile
+++ b/Makefile
@@ -509,6 +509,7 @@ endif
KBUILD_CFLAGS += $(CLANG_FLAGS)
KBUILD_AFLAGS += $(CLANG_FLAGS)
export CLANG_FLAGS
+KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
endif
RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
@@ -703,7 +704,6 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong
KBUILD_CFLAGS += $(stackp-flags-y)
ifdef CONFIG_CC_IS_CLANG
-KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) |
Does |
It should, as I believe it has been there since Clang support was first added.
Yeah, I was thinking the same thing. I assume there was good reason for wrapping it initially (maybe an older version of Clang doesn't support it?) but given that I wouldn't recommend anything less than clang 7 right now, I think we'd be fine to unwrap it. |
Oh, I remembered now why I didn't move |
Just hit this again internally when trying to build KASAN builds. |
Isn't this Clang specific, so do it unconditionally and pass to both
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Makefile#n502 |
Or like this:
|
I agree that we can probably drop |
Agreed. |
See this one how import KBUILD_CPPFLAGS are: "ftrace: Build with CPPFLAGS to get -Qunused-arguments" [1] https://git.kernel.org/linus/5a4630aadb9a9525474e9ac92965829f990cb5c4 |
I will include it in the next revision I send. Sorry for a quiet week; performance review season at work right now. |
I was able to use LLD as linker: KConfig (will try with enabled later):
Patchset:
Plus this diff:
Attached patch inspired by #366. |
Will follow up with #342 |
This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld={bfd,gold,lld,<absolute path to linker>}. This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the linker. Select the linker via absolute path from $PATH via `which`. This allows you to build with: $ make LD=ld.lld $ make LD=ld.lld-8 $ make LD=/path/to/ld.lld Add -Qunused-arguments to KBUILD_CPPFLAGS when using LLD, as otherwise Clang likes to complain about -fuse-lld= being unused when compiling but not linking (-c) such as when cc-option is used. Link: ClangBuiltLinux/linux#342 Link: ClangBuiltLinux/linux#366 Link: ClangBuiltLinux/linux#357 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld={bfd,gold,lld,<absolute path to linker>}. This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the linker. Select the linker via absolute path from $PATH via `which`. This allows you to build with: $ make LD=ld.lld $ make LD=ld.lld-8 $ make LD=/path/to/ld.lld Add -Qunused-arguments to KBUILD_CPPFLAGS when using LLD, as otherwise Clang likes to complain about -fuse-lld= being unused when compiling but not linking (-c) such as when cc-option is used. Link: ClangBuiltLinux/linux#342 Link: ClangBuiltLinux/linux#366 Link: ClangBuiltLinux/linux#357 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld={bfd,gold,lld,<absolute path to linker>}. This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the linker. Select the linker via absolute path from $PATH via `which`. This allows you to build with: $ make LD=ld.lld $ make LD=ld.lld-8 $ make LD=/path/to/ld.lld Add -Qunused-arguments to KBUILD_CPPFLAGS when using LLD, as otherwise Clang likes to complain about -fuse-lld= being unused when compiling but not linking (-c) such as when cc-option is used. Link: ClangBuiltLinux/linux#342 Link: ClangBuiltLinux/linux#366 Link: ClangBuiltLinux/linux#357 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld={bfd,gold,lld,<absolute path to linker>}. This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the linker. Select the linker via absolute path from $PATH via `which`. This allows you to build with: $ make LD=ld.lld $ make LD=ld.lld-8 $ make LD=/path/to/ld.lld Add -Qunused-arguments to KBUILD_CPPFLAGS when using LLD, as otherwise Clang likes to complain about -fuse-lld= being unused when compiling but not linking (-c) such as when cc-option is used. Link: ClangBuiltLinux/linux#342 Link: ClangBuiltLinux/linux#366 Link: ClangBuiltLinux/linux#357 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com> Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org> Signed-off-by: Twisted <36546624+TwistedPrime@users.noreply.github.com> Signed-off-by: MadeOfGreat <ravenklawasd@gmail.com> Signed-off-by: GhostMaster69-dev <rathore6375@gmail.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld={bfd,gold,lld,<absolute path to linker>}. This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the linker. Select the linker via absolute path from $PATH via `which`. This allows you to build with: $ make LD=ld.lld $ make LD=ld.lld-8 $ make LD=/path/to/ld.lld Add -Qunused-arguments to KBUILD_CPPFLAGS when using LLD, as otherwise Clang likes to complain about -fuse-lld= being unused when compiling but not linking (-c) such as when cc-option is used. Link: ClangBuiltLinux/linux#342 Link: ClangBuiltLinux/linux#366 Link: ClangBuiltLinux/linux#357 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx> Signed-off-by: Little-W <1405481963@qq.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com> Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org> Signed-off-by: Twisted <36546624+TwistedPrime@users.noreply.github.com> Signed-off-by: MadeOfGreat <ravenklawasd@gmail.com> Signed-off-by: GhostMaster69-dev <rathore6375@gmail.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Divyanshu-Modi <divyan.m05@gmail.com> Signed-off-by: Kunmun <kunmun.devroms@gmail.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld={bfd,gold,lld,<absolute path to linker>}. This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the linker. Select the linker via absolute path from $PATH via `which`. This allows you to build with: $ make LD=ld.lld $ make LD=ld.lld-8 $ make LD=/path/to/ld.lld Add -Qunused-arguments to KBUILD_CPPFLAGS when using LLD, as otherwise Clang likes to complain about -fuse-lld= being unused when compiling but not linking (-c) such as when cc-option is used. Link: ClangBuiltLinux/linux#342 Link: ClangBuiltLinux/linux#366 Link: ClangBuiltLinux/linux#357 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx> Signed-off-by: Little-W <1405481963@qq.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com> Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld={bfd,gold,lld,<absolute path to linker>}. This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the linker. Select the linker via absolute path from $PATH via `which`. This allows you to build with: $ make LD=ld.lld $ make LD=ld.lld-8 $ make LD=/path/to/ld.lld Add -Qunused-arguments to KBUILD_CPPFLAGS when using LLD, as otherwise Clang likes to complain about -fuse-lld= being unused when compiling but not linking (-c) such as when cc-option is used. Link: ClangBuiltLinux/linux#342 Link: ClangBuiltLinux/linux#366 Link: ClangBuiltLinux/linux#357 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Carlos Ayrton Lopez Arroyo <15030201@itcelaya.edu.mx> Signed-off-by: Little-W <1405481963@qq.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com> Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org> Signed-off-by: Twisted <36546624+TwistedPrime@users.noreply.github.com> Signed-off-by: MadeOfGreat <ravenklawasd@gmail.com> Signed-off-by: GhostMaster69-dev <rathore6375@gmail.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Rve <rve27github@gmail.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Rve <rve27github@gmail.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Kneba <abenkenary3@gmail.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Kneba <abenkenary3@gmail.com>
kbuild: Allow forcing the alternative LLD linker via Kconfig LLD is a relatively new linker from the LLVM Project that aims to be a faster and more modern alternative to the GNU gold and bfd linkers from binutils: https://lld.llvm.org/ I've also found that it offers more insightful diagnostics when something goes wrong, e.g. when there are undefined references. It does also appear to speed up the overall build time by 4-10s as compared to ld.bfd. These new config options will only allow fully-working configurations: - gold/lld when Clang LTO is enabled - bfd/lld otherwise Signed-off-by: Danny Lin <danny@kdrag0n.dev> Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com> Signed-off-by: Yaroslav Furman <yaro330@gmail.com> BACKPORT: FROMLIST: Makefile: lld: set -O2 linker flag when linking w… …ith LLD For arm64: 0.34% size improvement with lld -O2 over lld for vmlinux. 3.3% size improvement with lld -O2 over lld for Image.lz4-dtb. Link: ClangBuiltLinux/linux#343 Suggested-by: Rui Ueyama <ruiu@google.com> Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Tested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> (am from https://patchwork.kernel.org/patch/10806729/) Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com> Signed-off-by: Yaroslav Furman <yaro330@gmail.com> BACKPORT: FROMLIST: Makefile: lld: tell clang to use lld This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld={bfd,gold,lld,<absolute path to linker>}. This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the BACKPORT: FROMLIST: Makefile: lld: tell clang to use lld This is needed because clang doesn't select which linker to use based on $LD but rather -fuse-ld={bfd,gold,lld,<absolute path to linker>}. This is problematic especially for cc-ldoption, which checks for linker flag support via invoking the compiler, rather than the linker. Select the linker via absolute path from $PATH via `which`. This allows you to build with: $ make LD=ld.lld $ make LD=ld.lld-8 $ make LD=/path/to/ld.lld Add -Qunused-arguments to KBUILD_CPPFLAGS sooner, as otherwise Clang likes to complain about -fuse-lld= being unused when compiling but not linking (-c) such as when cc-option is used. There's no need to guard with cc-option. Link: ClangBuiltLinux/linux#342 Link: ClangBuiltLinux/linux#366 Link: ClangBuiltLinux/linux#357 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Nathan Chancellor <natechancellor@gmail Signed-off-by: Divyanshu-Modi <divyan.m05@gmail.com> Signed-off-by: Kunmun <kunmun.devroms@gmail.com>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com> Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com> Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com> Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com> Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com> Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org>
The recently added support for -fuse-ld=lld is problematic for kbuild in that cc-option tests that add -Werror -c -fuse-ld=lld, as -c implies that no linker is invoked, and thus -fuse-ld=lld is an unused flag. Therefor, -Qunused-arguments needs to be set sooner in the Makefile, otherwise cc-option will fail when building with: $ make LD=ld.lld Also, -Qunused-arguments has been supported by Clang for a long time; there's no need to wrap it in cc-option. Bug: 63740206 Bug: 124794189 Change-Id: I90fb78fab1197db781ede09327783f616e5fbfaf Link: ClangBuiltLinux/linux#366 Suggested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com> Signed-off-by: Raphiel Rollerscaperers <rapherion@raphielgang.org> Signed-off-by: Twisted <36546624+TwistedPrime@users.noreply.github.com> Signed-off-by: MadeOfGreat <ravenklawasd@gmail.com> Signed-off-by: CloudedQuartz <ravenklawasd@gmail.com> Signed-off-by: Dakkshesh <dakkshesh5@gmail.com>
When trying LLD with x86, I was seeing:
Looks like
__cc-option
adds-Werror
which breaks thecc-option
for theRETPOLINE_CFLAGS
. ex:The text was updated successfully, but these errors were encountered: