linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sedat Dilek <sedat.dilek@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kbuild@vger.kernel.org,
	Clang-Built-Linux ML <clang-built-linux@googlegroups.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kbuild: mkcompile_h: Include $LD version in /proc/version
Date: Wed, 8 Apr 2020 12:22:33 +0200	[thread overview]
Message-ID: <CA+icZUU_5St7Z31_vSb_57YSm=u9NCKW=MJ2gZUGXnQ8Wx9Mbg@mail.gmail.com> (raw)
In-Reply-To: <202004020117.6E434C035@keescook>

On Thu, Apr 2, 2020 at 10:18 AM Kees Cook <keescook@chromium.org> wrote:
>
> When doing Clang builds of the kernel, it is possible to link with
> either ld.bfd (binutils) or ld.lld (LLVM), but it is not possible to
> discover this from a running kernel. Add the "$LD -v" output to
> /proc/version.
>

What about also having the linker and its version in the generated
linux-config file?

$ git diff
diff --git a/Kconfig b/Kconfig
index e10b3ee084d4..98fd210786e5 100644
--- a/Kconfig
+++ b/Kconfig
@@ -5,7 +5,7 @@
 #
 mainmenu "Linux/$(ARCH) $(KERNELVERSION) Kernel Configuration"

-comment "Compiler: $(CC_VERSION_TEXT)"
+comment "Compiler: $(CC_VERSION_TEXT) Linker: $(LD_VERSION_TEXT)"

 source "scripts/Kconfig.include"

diff --git a/Makefile b/Makefile
index 91b90ec1737c..42d6834b2255 100644
--- a/Makefile
+++ b/Makefile
@@ -553,6 +553,9 @@ endif
 # and from include/config/auto.conf.cmd to detect the compiler upgrade.
 CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1)

+# LD_VERSION_TEXT is referenced from Kconfig (so it needs export).
+LD_VERSION_TEXT = $(shell $(LD) --version 2>/dev/null | head -n 1)
+
 ifdef config-build
 # ===========================================================================
 # *config targets only - make sure prerequisites are updated, and descend
@@ -562,7 +565,7 @@ ifdef config-build
 # KBUILD_DEFCONFIG may point out an alternative default configuration
 # used for 'make defconfig'
 include arch/$(SRCARCH)/Makefile
-export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT
+export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT LD_VERSION_TEXT

 config: outputmakefile scripts_basic FORCE
        $(Q)$(MAKE) $(build)=scripts/kconfig $@

This generates here:

--- /boot/config-5.6.0-3-amd64-clang    2020-04-01 13:18:13.000000000 +0200
+++ .config     2020-04-08 12:16:43.477674201 +0200
@@ -1,10 +1,10 @@
 #
 # Automatically generated file; DO NOT EDIT.
-# Linux/x86 5.6.0 Kernel Configuration
+# Linux/x86 5.6.3 Kernel Configuration
 #

 #
-# Compiler: clang version 10.0.0-1
+# Compiler: clang version 10.0.0-2  Linker: LLD 10.0.0 (compatible
with GNU linkers)

- Sedat -

      parent reply	other threads:[~2020-04-08 10:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-02  8:18 [PATCH] kbuild: mkcompile_h: Include $LD version in /proc/version Kees Cook
2020-04-02 14:24 ` Sedat Dilek
2020-04-05 11:23   ` Sedat Dilek
2020-04-05 13:55     ` Masahiro Yamada
2020-04-06 10:35       ` Sedat Dilek
2020-04-06 15:53         ` Kees Cook
2020-04-06 17:13           ` Sedat Dilek
2020-04-02 17:00 ` Masahiro Yamada
2020-04-02 17:33   ` Kees Cook
2020-04-02 18:22   ` Nick Desaulniers
2020-04-02 18:31     ` Kees Cook
2020-04-04  4:51       ` Fangrui Song
2020-04-04  4:02 ` Nathan Chancellor
2020-04-08 10:22 ` Sedat Dilek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+icZUU_5St7Z31_vSb_57YSm=u9NCKW=MJ2gZUGXnQ8Wx9Mbg@mail.gmail.com' \
    --to=sedat.dilek@gmail.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=keescook@chromium.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).