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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 10 Dec 2020 15:07:53 -0800
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Andrew Delgadillo <adelg@...gle.com>
Cc:     Shuah Khan <shuah@...nel.org>,
        Nathan Chancellor <natechancellor@...il.com>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH] selftests: propagate CC to selftest submakes

On Thu, Dec 3, 2020 at 2:10 PM Andrew Delgadillo <adelg@...gle.com> wrote:
>
> 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>

Hi Andrew, thanks for the patch. Can you walk me through how to build
the selftests?

Documentation/dev-tools/kselftest.rst says:
$ make -C tools/testing/selftests

And if I do:
$ make CC=clang defconfig
$ make CC=clang -C tools/testing/selftests -j

I observe a spew of errors.  If I apply your patch and rerun the
above, I see what looks like the same spew of errors.  Am I "holding
it wrong" or could the docs use a refresh?

> ---
>  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
>


-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ