Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Kees Cook <keescook@chromium.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Fangrui Song <maskray@google.com>
Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

authored by

Kees Cook and committed by
Masahiro Yamada
4dcc9a88 60969f02

+6 -2
+1 -1
init/Makefile
··· 35 35 @$($(quiet)chk_compile.h) 36 36 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ 37 37 "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" \ 38 - "$(CONFIG_PREEMPT_RT)" "$(CC) $(KBUILD_CFLAGS)" 38 + "$(CONFIG_PREEMPT_RT)" "$(CC) $(KBUILD_CFLAGS)" "$(LD)"
+5 -1
scripts/mkcompile_h
··· 7 7 PREEMPT=$4 8 8 PREEMPT_RT=$5 9 9 CC=$6 10 + LD=$7 10 11 11 12 vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; } 12 13 ··· 62 61 printf '#define LINUX_COMPILE_BY "%s"\n' "$LINUX_COMPILE_BY" 63 62 echo \#define LINUX_COMPILE_HOST \"$LINUX_COMPILE_HOST\" 64 63 65 - echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\" 64 + CC_VERSION=$($CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//') 65 + LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \ 66 + | sed 's/[[:space:]]*$//') 67 + printf '#define LINUX_COMPILER "%s"\n' "$CC_VERSION, $LD_VERSION" 66 68 } > .tmpcompile 67 69 68 70 # Only replace the real compile.h if the new one is different,