Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp527257ybb; Wed, 8 Apr 2020 04:56:20 -0700 (PDT) X-Google-Smtp-Source: APiQypLdl+KFY4g7lZ/gqPXoOUewoPDdGcydhiM10FTqmnbG1/BEOq52Q4lsT8w/FhjTQxmJjMVG X-Received: by 2002:aca:38c6:: with SMTP id f189mr1405953oia.145.1586346980516; Wed, 08 Apr 2020 04:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586346980; cv=none; d=google.com; s=arc-20160816; b=gfWgWAmBOI70gOb88DN4LNU5BqCchoY6KGqV+iiPH/Rvcu397vtmy1unxlwJWeNAYO 8pwgplv7btpGeEsckgnRDGPyLaRk0o4fMsquI/8z+2dNd+YcS4M73sQzGBj4c/23AGrt kwG0jkDK2jLuBsHPGJtIpc6xpXRBVNZl4gn23GM0EgGfjjcNgZQn43fUYTE+rfUOMBDA 51il7oE2tyxWBFLOLtZNeubFqJEhvlQV1JhCo2zm5HouYTrLz/9RAfSkMsUmvrYGJzsB wMj10ByX/MF8Zo3Gm2VC6FoUFUoPq0tNV3A0m4J3AY/ybf99u7rT5JBbEjecYGecpWWY 4Ang== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:dkim-signature; bh=hFUWuQvfH3+RvUKxsWJsL4BSP/idRCjudICth1NHT3s=; b=Ybigoi8Y0DCyaGY2WSZhPG+Qp8v2KOIaLICFGZUoOesdg0G88FHEUo+PjJN/jdOukZ j6GMVopf2NUge8LA15aFhjxM95xz1N2pnI9K/S3IIGkomXGxhNEc8KHCnxvLFy12LxgY xBzRyicMazKP1f9GCuskvbv7EnlgFsnHihXqOF4Ca1UZeNm2BzjRow0tyVQ+gteVJLMd asLvFT93TzdKP2auPq+lWbSF/k276A8YE8nCUR3TNzKTCFRtswk46p70kM13osH6Aoc+ zKnIK9W3M8ZBsEBdBTnIW09v5JfDwLCADcDCTFTCsFhP41tZKNxi8AFKGYuRIw/j0Uyo L91g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AqIGPXCI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f82si1946280oia.58.2020.04.08.04.56.07; Wed, 08 Apr 2020 04:56:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AqIGPXCI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727835AbgDHKWr (ORCPT + 99 others); Wed, 8 Apr 2020 06:22:47 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54122 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgDHKWr (ORCPT ); Wed, 8 Apr 2020 06:22:47 -0400 Received: by mail-wm1-f66.google.com with SMTP id d77so4588913wmd.3; Wed, 08 Apr 2020 03:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=hFUWuQvfH3+RvUKxsWJsL4BSP/idRCjudICth1NHT3s=; b=AqIGPXCIgW1/5FB/ZbeAyzB79NjkwCut6ixK0yfS3fcsN1Y/9ngitz5v2e0tfZUv/T kM8SraoVcdy8x92oySI6CM8Fvgk1Y5fLQGBM9S3HLIrIKXjHv+EdYQHO2/4MpIZP6wh2 UtkZKpV4YoEMzOPBJa3LtVF8C02RtZCKe/sjL3J8qJwficoCs4BuYBgw7TsiByXgWgMc XfjmYXaPuQ4rx1UE0QtYdntllX/OhMNtz/yELqxEwUls+j6I4M3UHnUWeeXBeCsnacGr /9vTX6xDhx0ItfsRCdpAVxyvthh627L+6rxT8/PCzRoRPRXEDUBcZl2EmWMvM+1u1q2o du1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=hFUWuQvfH3+RvUKxsWJsL4BSP/idRCjudICth1NHT3s=; b=IYfLycAZC3WTCsbb8g8y06jd3MsFVXk5T/IjbjMde0RdN3CU+uw7UfVvW9mGTAFrwH 9phF8VzvavuL5+zeRxUoXy9wl8J1ZxO3f2Ecbc2cbDwwRBRMBliH5HnpGVWgZmpUwzd9 uTFoeIhhkyC17rLVyRqFh8sZU/U2VCE+s75Ji0Y10xJaCnzbDpyiCWx4M+kKtSG2ySda jt3uMOfb2lMQsz+NVExK80s+nB6lq4WFphjPkGf2gf11f3rtIEu0RaSKYq02+GvnyRTZ 2/CmOfaCpOllvagcovIkfqrV30qDG+S6ULThGupjtJVEjJ7jjI8DInryo2H5A3tb03l1 0GZQ== X-Gm-Message-State: AGi0Pub5XphOhsGANMf8RbOBv8ajtvbZUmKAqYeFtKRkWTHcTVILtCGk WFyiU9eyhS2QOLiaDmTf94h0GFk3/c3y6dWM910= X-Received: by 2002:a7b:cb86:: with SMTP id m6mr3740892wmi.64.1586341365114; Wed, 08 Apr 2020 03:22:45 -0700 (PDT) MIME-Version: 1.0 References: <202004020117.6E434C035@keescook> In-Reply-To: <202004020117.6E434C035@keescook> Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Wed, 8 Apr 2020 12:22:33 +0200 Message-ID: Subject: Re: [PATCH] kbuild: mkcompile_h: Include $LD version in /proc/version To: Kees Cook Cc: Masahiro Yamada , Michal Marek , Thomas Gleixner , linux-kbuild@vger.kernel.org, Clang-Built-Linux ML , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 2, 2020 at 10:18 AM Kees Cook 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 -