Patch "selftests: default to host arch for LLVM builds" has been added to the 6.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    selftests: default to host arch for LLVM builds

to the 6.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     selftests-default-to-host-arch-for-llvm-builds.patch
and it can be found in the queue-6.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 88fbcd62dde816e2862e5481074d2dcf2025e480
Author: Valentin Obst <kernel@xxxxxxxxxxxxxxx>
Date:   Fri Mar 29 11:49:43 2024 +0100

    selftests: default to host arch for LLVM builds
    
    [ Upstream commit d4e6fbd245c48b272cc591d1c5e7c07aedd7f071 ]
    
    Align the behavior for gcc and clang builds by interpreting unset
    `ARCH` and `CROSS_COMPILE` variables in `LLVM` builds as a sign that the
    user wants to build for the host architecture.
    
    This patch preserves the properties that setting the `ARCH` variable to an
    unknown value will trigger an error that complains about insufficient
    information, and that a set `CROSS_COMPILE` variable will override the
    target triple that is determined based on presence/absence of `ARCH`.
    
    When compiling with clang, i.e., `LLVM` is set, an unset `ARCH` variable in
    combination with an unset `CROSS_COMPILE` variable, i.e., compiling for
    the host architecture, leads to compilation failures since `lib.mk` can
    not determine the clang target triple. In this case, the following error
    message is displayed for each subsystem that does not set `ARCH` in its
    own Makefile before including `lib.mk` (lines wrapped at 75 chrs):
    
      make[1]: Entering directory '/mnt/build/linux/tools/testing/selftests/
       sysctl'
      ../lib.mk:33: *** Specify CROSS_COMPILE or add '--target=' option to
       lib.mk.  Stop.
      make[1]: Leaving directory '/mnt/build/linux/tools/testing/selftests/
       sysctl'
    
    In the same scenario a gcc build would default to the host architecture,
    i.e., it would use plain `gcc`.
    
    Fixes: 795285ef2425 ("selftests: Fix clang cross compilation")
    Reviewed-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Valentin Obst <kernel@xxxxxxxxxxxxxxx>
    Reviewed-by: John Hubbard <jhubbard@xxxxxxxxxx>
    Signed-off-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index da2cade3bab0e..8ae203d8ed7fa 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -7,6 +7,8 @@ else ifneq ($(filter -%,$(LLVM)),)
 LLVM_SUFFIX := $(LLVM)
 endif
 
+CLANG := $(LLVM_PREFIX)clang$(LLVM_SUFFIX)
+
 CLANG_TARGET_FLAGS_arm          := arm-linux-gnueabi
 CLANG_TARGET_FLAGS_arm64        := aarch64-linux-gnu
 CLANG_TARGET_FLAGS_hexagon      := hexagon-linux-musl
@@ -18,7 +20,13 @@ CLANG_TARGET_FLAGS_riscv        := riscv64-linux-gnu
 CLANG_TARGET_FLAGS_s390         := s390x-linux-gnu
 CLANG_TARGET_FLAGS_x86          := x86_64-linux-gnu
 CLANG_TARGET_FLAGS_x86_64       := x86_64-linux-gnu
-CLANG_TARGET_FLAGS              := $(CLANG_TARGET_FLAGS_$(ARCH))
+
+# Default to host architecture if ARCH is not explicitly given.
+ifeq ($(ARCH),)
+CLANG_TARGET_FLAGS := $(shell $(CLANG) -print-target-triple)
+else
+CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(ARCH))
+endif
 
 ifeq ($(CROSS_COMPILE),)
 ifeq ($(CLANG_TARGET_FLAGS),)
@@ -30,7 +38,7 @@ else
 CLANG_FLAGS     += --target=$(notdir $(CROSS_COMPILE:%-=%))
 endif # CROSS_COMPILE
 
-CC := $(LLVM_PREFIX)clang$(LLVM_SUFFIX) $(CLANG_FLAGS) -fintegrated-as
+CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as
 else
 CC := $(CROSS_COMPILE)gcc
 endif # LLVM




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux