Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4831f7ad authored by Kees Cook's avatar Kees Cook Committed by Alistair Delva
Browse files

FROMGIT: kbuild: mkcompile_h: Include $LD version in /proc/version



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: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Tested-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Reviewed-by: default avatarFangrui Song <maskray@google.com>
Reviewed-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
Tested-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>

Bug: 153484457
(cherry picked from commit 6f04f056df3c
 https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git


 for-next)
Change-Id: Ifa5a98fe159392862e8d07a733c0f141fa9c7715
Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
parent bb9227c9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)" "$(CC) $(KBUILD_CFLAGS)" "$(LD)"
+5 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ SMP=$3
PREEMPT=$4
PREEMPT_RT=$5
CC=$6
LD=$7

vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; }

@@ -74,7 +75,10 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
  echo \#define LINUX_COMPILE_BY \"`echo $LINUX_COMPILE_BY | $UTS_TRUNCATE`\"
  echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\"

  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,