lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201203221005.2813159-1-adelg@google.com>
Date:   Thu,  3 Dec 2020 22:10:05 +0000
From:   Andrew Delgadillo <adelg@...gle.com>
To:     Shuah Khan <shuah@...nel.org>
Cc:     Nathan Chancellor <natechancellor@...il.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
        clang-built-linux@...glegroups.com,
        Andrew Delgadillo <adelg@...gle.com>
Subject: [PATCH] selftests: propagate CC to selftest submakes

lib.mk defaults to gcc when CC is not set. When building selftests
as part of a kernel compilation, MAKEFLAGS is cleared to allow implicit
build rules to be used. This has the side-effect of clearing the CC
variable, which will cause selftests to be built with gcc regardless of
if we are using gcc or clang. To remedy this, propagate the CC variable
when clearing makeflags to ensure the correct compiler is used.

Signed-off-by: Andrew Delgadillo <adelg@...gle.com>
---
 tools/testing/selftests/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index d9c283503159..a4dd6d7e8276 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -90,10 +90,12 @@ FORCE_TARGETS ?=
 
 # Clear LDFLAGS and MAKEFLAGS when implicit rules are missing.  This provides
 # implicit rules to sub-test Makefiles which avoids build failures in test
-# Makefile that don't have explicit build rules.
+# Makefile that don't have explicit build rules. Since lib.mk defaults to
+# using gcc for compilation when the CC variable is not set, we propagate the
+# CC variable so if clang is being used, selftests will build with clang.
 ifeq (,$(LINK.c))
 override LDFLAGS =
-override MAKEFLAGS =
+override MAKEFLAGS = CC=$(CC)
 endif
 
 # Append kselftest to KBUILD_OUTPUT and O to avoid cluttering
-- 
2.29.2.576.ga3fc446d84-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ