]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/x86: avoid -no-pie warnings from clang during compilation
authorJohn Hubbard <jhubbard@nvidia.com>
Thu, 4 Jul 2024 07:24:29 +0000 (00:24 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 11 Jul 2024 17:23:55 +0000 (11:23 -0600)
When building with clang, via:

    make LLVM=1 -C tools/testing/selftests

...clang warns that -no-pie is "unused during compilation".

This occurs because clang only wants to see -no-pie during linking.
Here, we don't have a separate linking stage, so a compiler warning is
unavoidable without (wastefully) restructuring the Makefile.

Avoid the warning by simply disabling that warning, for clang builds.

Acked-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/x86/Makefile

index d0bb32bd55385044a65d151e00daebca77fc7535..5c8757a259984cb97b48c22f1ad191d73d2a81e6 100644 (file)
@@ -40,6 +40,13 @@ CFLAGS := -O2 -g -std=gnu99 -pthread -Wall $(KHDR_INCLUDES)
 # call32_from_64 in thunks.S uses absolute addresses.
 ifeq ($(CAN_BUILD_WITH_NOPIE),1)
 CFLAGS += -no-pie
+
+ifneq ($(LLVM),)
+# clang only wants to see -no-pie during linking. Here, we don't have a separate
+# linking stage, so a compiler warning is unavoidable without (wastefully)
+# restructuring the Makefile. Avoid this by simply disabling that warning.
+CFLAGS += -Wno-unused-command-line-argument
+endif
 endif
 
 define gen-target-rule-32