Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1789186ybb; Thu, 2 Apr 2020 07:25:12 -0700 (PDT) X-Google-Smtp-Source: APiQypJpP4eVEOYx7CxIsTAR3+3wK+jW2DEYG21Nu9vq+nG5BzD5LOfBiEzPpRoSZWYipgtjYcwk X-Received: by 2002:a9d:3405:: with SMTP id v5mr2656500otb.131.1585837512696; Thu, 02 Apr 2020 07:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585837512; cv=none; d=google.com; s=arc-20160816; b=HoRgnyy7HHwKndFzPvr9suJ0hUR/OZDmBYyjwxg0Alzp1BKUNmnpZy8PqldzaOCCdq iE3h9qpE/D2XTiXjwk824ORZ2nIXp7DchPgwgHcyhogKphvuTPBdoJsLOIoI8HvgVwSU 6mrDQHdmxXcyNaZGZbzj86SxIYNvdR5TzGmgy3UkPGv55jlsx+IytEyliPD4A2gEPqSa upPj8qgGZI/4QUTvYUOIktUyvlelBtoAuyBx8wjDwhSHB8+LSBDb2NL4XKa7+0x/7HaG hnpBRtNFhvTHR8R0jHtFiaK3KfsTPtr/H7vmOMz6GhdkcwBJWu0gagbfU6Tii5n3tg/o hggQ== 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=n3PDnctBOZZXWd2LbmIwxNVKZxM3wgowDyh1vzhpv5A=; b=hI4uGWQJL3uC/eeZrDmwUql8UqWLXS1qlWOqrLFiZyoha+Qik916JWC0ffFOtFjmRs V+vK031do65BNP6lUXpAbIOEWlf5sgPFAhLi600mNDsSYXORkjSs+I4505eiDyMB7H1/ JDXKBFMzq2zUPF3hVkpsNiZi6Z+ORYkBa3obcrZsr1okyekKnhdLbb3hfXIGBbUui4Zw 88YlUNS7VQwS49q6tYyzqvSlZXO59hBo0dwVZ7bkjo0Lml504pTp0gcFT1iSg1YNVkc1 jIIbn37WdUPqMlvg+QzDGR2quKsULD7/YlebfbXc43+O++JCbpbHG3E9Hv1yK3sTfhW+ WWhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DNJyYXWg; 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 e20si2389849oti.137.2020.04.02.07.24.59; Thu, 02 Apr 2020 07:25:12 -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=DNJyYXWg; 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 S1732679AbgDBOYc (ORCPT + 99 others); Thu, 2 Apr 2020 10:24:32 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:50571 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729275AbgDBOYb (ORCPT ); Thu, 2 Apr 2020 10:24:31 -0400 Received: by mail-wm1-f65.google.com with SMTP id t128so3620098wma.0; Thu, 02 Apr 2020 07:24:30 -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=n3PDnctBOZZXWd2LbmIwxNVKZxM3wgowDyh1vzhpv5A=; b=DNJyYXWg7yUdzW8pIUDDFIiyrkbhbOckIO6REVwXspjhoeCVg3srHfqGEHFzeo0Q7M Fgwv/O+XO2zwhGiq5khGVY9sRsAt6Roi+eqFweXFTKwvNlKvYtZNxdYCb3j5U/kJ+q8R 02I9d52piEPczGyjfsG+4klfsXnEA6cyg0gkNQ0D2/C4VAenTEZSDnMYv6akCYNVPR8o eVkfzB1Q+1dfxTLY79MaFr9eRRH8eeqQ2+x89bVSJ0X2ugYXsepKpi+2DuIvHB5HfMsz GijCm8E+RY4JRVudpKwL49c16q/6HCaFfPwck3ZrWj5hHpaSZ5Te5C2+DrwwBILMIgcK wyPw== 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=n3PDnctBOZZXWd2LbmIwxNVKZxM3wgowDyh1vzhpv5A=; b=i39LLYjVmKhTO+/C8G+RbqnFYHb86Eh/EJ1cTvuVW2FeiUnEsXalM50XO88p6YeK3G AqxSIZKsKniPO1T5SuDdH4/WuH3SbiC75IaOzKmqn85DKbyzH2MewANDydFyvJiTFmkA dDqIjpjyBUqm8KH16Y1f30Kw7Gvg7JlGkyyed95ddTO7FLKEcf0wrwa0SxfLYiXsBwcS KLPoRkS0lZ8R9F+OdC8Tx3AAsW+cl0QpQY4F/TUCAGkiRB5qczSG0vmlFqzpsPVd6D/x H/nnZtwKKD+bjTMtN5mlLgDNDnbrStmMGHya4BKNHSGbfeKTc8gTh3YQixOgW+oeCbn+ 1j9A== X-Gm-Message-State: AGi0Pua+XPk1Ik5Z3J4mHQRsiZCzXDMYuvU2eC0bD4WuJXWgQvWIMAZO sOrcXsgECUMjKs7l5USNB4PpWkEzLIHoqQDpctM= X-Received: by 2002:a7b:c850:: with SMTP id c16mr3895360wml.163.1585837469897; Thu, 02 Apr 2020 07:24:29 -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: Thu, 2 Apr 2020 16:24:36 +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. > > Signed-off-by: Kees Cook Hi Kees, this patch is really really a good one! I use Clang and LLD to build my Linux-kernels. For archiving important informations of my latest build I did: cd linux readelf -p .comment vmlinux > ../archives/readelf-p-comment_vmlinux.txt ...or... readelf -p .comment arch/x86/boot/compressed/vmlinux > ../archives/readelf-p-comment_vmlinux-compressed.txt The output looks like: String dump of section '.comment': [ 0] Linker: LLD 10.0.0 [ 14] clang version 10.0.0-1 With my next linux-kernel build I will include this one. Feel free to add any appropriate credits. Thanks. Regards, - Sedat - > --- > init/Makefile | 2 +- > scripts/mkcompile_h | 8 ++++++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/init/Makefile b/init/Makefile > index 6246a06364d0..82c15bdb42d7 100644 > --- a/init/Makefile > +++ b/init/Makefile > @@ -35,4 +35,4 @@ include/generated/compile.h: FORCE > @$($(quiet)chk_compile.h) > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ > "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" \ > - "$(CONFIG_PREEMPT_RT)" "$(CC) $(KBUILD_CFLAGS)" > + "$(CONFIG_PREEMPT_RT)" "$(LD)" "$(CC) $(KBUILD_CFLAGS)" > diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h > index 3a5a4b210c86..f98c07709370 100755 > --- a/scripts/mkcompile_h > +++ b/scripts/mkcompile_h > @@ -6,7 +6,8 @@ ARCH=$2 > SMP=$3 > PREEMPT=$4 > PREEMPT_RT=$5 > -CC=$6 > +LD=$6 > +CC=$7 > > vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; } > > @@ -72,7 +73,10 @@ UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)" > printf '#define LINUX_COMPILE_BY "%s"\n' "$LINUX_COMPILE_BY" > echo \#define LINUX_COMPILE_HOST \"$LINUX_COMPILE_HOST\" > > - echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\" > + CC_VERSION=$($CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//') > + LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \ > + | sed 's/[[:space:]]*$//') > + printf '#define LINUX_COMPILER "%s"\n' "$CC_VERSION, $LD_VERSION" > } > .tmpcompile > > # Only replace the real compile.h if the new one is different, > -- > 2.20.1 > > > -- > Kees Cook > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/202004020117.6E434C035%40keescook.