Skip to content

Commit

Permalink
ANDROID: Makefile: set -Qunused-arguments sooner
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
nickdesaulniers authored and MocaRafee committed Nov 8, 2024
1 parent 787c29c commit 0801feb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ KBUILD_AFLAGS += $(CLANG_FLAGS)
ifeq ($(ld-name),lld)
KBUILD_CFLAGS += -fuse-ld=lld
endif
KBUILD_CPPFLAGS += -Qunused-arguments
export CLANG_FLAGS
endif

Expand Down Expand Up @@ -735,7 +736,6 @@ ifdef CONFIG_KCOV
endif

ifeq ($(cc-name),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, duplicate-decl-specifier)
Expand Down

0 comments on commit 0801feb

Please sign in to comment.