Skip to content

Commit e83bad7

Browse files
committed
Merge tag 'kbuild-fixes-v5.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada: - avoid 'make image_name' invoking syncconfig - fix a couple of bugs in scripts/dummy-tools - fix LLD_VENDOR and locale issues in scripts/ld-version.sh - rebuild GCC plugins when the compiler is upgraded - allow LTO to be enabled with KASAN_HW_TAGS - allow LTO to be enabled without LLVM=1 * tag 'kbuild-fixes-v5.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kbuild: fix ld-version.sh to not be affected by locale kbuild: remove meaningless parameter to $(call if_changed_rule,dtc) kbuild: remove LLVM=1 test from HAS_LTO_CLANG kbuild: remove unneeded -O option to dtc kbuild: dummy-tools: adjust to scripts/cc-version.sh kbuild: Allow LTO to be selected with KASAN_HW_TAGS kbuild: dummy-tools: support MPROFILE_KERNEL checks for ppc kbuild: rebuild GCC plugins when the compiler is upgraded kbuild: Fix ld-version.sh script if LLD was built with LLD_VENDOR kbuild: dummy-tools: fix inverted tests for gcc kbuild: add image_name to no-sync-config-targets
2 parents f296bfd + bcbcf50 commit e83bad7

9 files changed

Lines changed: 55 additions & 21 deletions

File tree

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ no-dot-config-targets := $(clean-targets) \
264264
$(version_h) headers headers_% archheaders archscripts \
265265
%asm-generic kernelversion %src-pkg dt_binding_check \
266266
outputmakefile
267-
no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease
267+
no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
268+
image_name
268269
single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
269270

270271
config-build :=
@@ -478,6 +479,7 @@ USERINCLUDE := \
478479
-I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \
479480
-I$(srctree)/include/uapi \
480481
-I$(objtree)/include/generated/uapi \
482+
-include $(srctree)/include/linux/compiler-version.h \
481483
-include $(srctree)/include/linux/kconfig.h
482484

483485
# Use LINUXINCLUDE when you must reference the include/ directory.

arch/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,13 +632,12 @@ config HAS_LTO_CLANG
632632
def_bool y
633633
# Clang >= 11: https://github.com/ClangBuiltLinux/linux/issues/510
634634
depends on CC_IS_CLANG && CLANG_VERSION >= 110000 && LD_IS_LLD
635-
depends on $(success,test $(LLVM) -eq 1)
636635
depends on $(success,test $(LLVM_IAS) -eq 1)
637636
depends on $(success,$(NM) --help | head -n 1 | grep -qi llvm)
638637
depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm)
639638
depends on ARCH_SUPPORTS_LTO_CLANG
640639
depends on !FTRACE_MCOUNT_USE_RECORDMCOUNT
641-
depends on !KASAN
640+
depends on !KASAN || KASAN_HW_TAGS
642641
depends on !GCOV_KERNEL
643642
help
644643
The compiler and Kconfig options support building with Clang's

include/linux/compiler-version.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+
#ifdef __LINUX_COMPILER_VERSION_H
4+
#error "Please do not include <linux/compiler-version.h>. This is done by the build system."
5+
#endif
6+
#define __LINUX_COMPILER_VERSION_H
7+
8+
/*
9+
* This header exists to force full rebuild when the compiler is upgraded.
10+
*
11+
* When fixdep scans this, it will find this string "CONFIG_CC_VERSION_TEXT"
12+
* and add dependency on include/config/cc/version/text.h, which is touched
13+
* by Kconfig when the version string from the compiler changes.
14+
*/

include/linux/kconfig.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#ifndef __LINUX_KCONFIG_H
33
#define __LINUX_KCONFIG_H
44

5-
/* CONFIG_CC_VERSION_TEXT (Do not delete this comment. See help in Kconfig) */
6-
75
#include <generated/autoconf.h>
86

97
#ifdef CONFIG_CPU_BIG_ENDIAN

init/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ config CC_VERSION_TEXT
2020
When the compiler is updated, Kconfig will be invoked.
2121

2222
- Ensure full rebuild when the compiler is updated
23-
include/linux/kconfig.h contains this option in the comment line so
24-
fixdep adds include/config/cc/version/text.h into the auto-generated
25-
dependency. When the compiler is updated, syncconfig will touch it
26-
and then every file will be rebuilt.
23+
include/linux/compiler-version.h contains this option in the comment
24+
line so fixdep adds include/config/cc/version/text.h into the
25+
auto-generated dependency. When the compiler is updated, syncconfig
26+
will touch it and then every file will be rebuilt.
2727

2828
config CC_IS_GCC
2929
def_bool $(success,test "$(cc-name)" = GCC)

scripts/Makefile.lib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE
327327

328328
quiet_cmd_dtc = DTC $@
329329
cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
330-
$(DTC) -O $(patsubst .%,%,$(suffix $@)) -o $@ -b 0 \
330+
$(DTC) -o $@ -b 0 \
331331
$(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
332332
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
333333
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
@@ -352,7 +352,7 @@ define rule_dtc
352352
endef
353353

354354
$(obj)/%.dt.yaml: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
355-
$(call if_changed_rule,dtc,yaml)
355+
$(call if_changed_rule,dtc)
356356

357357
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
358358

scripts/dummy-tools/gcc

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ if arg_contain --version "$@"; then
5757
fi
5858

5959
if arg_contain -E "$@"; then
60-
# For scripts/gcc-version.sh; This emulates GCC 20.0.0
60+
# For scripts/cc-version.sh; This emulates GCC 20.0.0
6161
if arg_contain - "$@"; then
62-
sed 's/^__GNUC__$/20/; s/^__GNUC_MINOR__$/0/; s/^__GNUC_PATCHLEVEL__$/0/'
62+
sed -n '/^GCC/{s/__GNUC__/20/; s/__GNUC_MINOR__/0/; s/__GNUC_PATCHLEVEL__/0/; p;}'
6363
exit 0
6464
else
6565
echo "no input files" >&2
@@ -73,6 +73,15 @@ if arg_contain -S "$@"; then
7373
echo "%gs"
7474
exit 0
7575
fi
76+
77+
# For arch/powerpc/tools/gcc-check-mprofile-kernel.sh
78+
if arg_contain -m64 "$@" && arg_contain -mlittle-endian "$@" &&
79+
arg_contain -mprofile-kernel "$@"; then
80+
if ! test -t 0 && ! grep -q notrace; then
81+
echo "_mcount"
82+
fi
83+
exit 0
84+
fi
7685
fi
7786

7887
# To set GCC_PLUGINS
@@ -85,3 +94,8 @@ if arg_contain -print-file-name=plugin "$@"; then
8594
echo $plugin_dir
8695
exit 0
8796
fi
97+
98+
# inverted return value
99+
if arg_contain -D__SIZEOF_INT128__=0 "$@"; then
100+
exit 1
101+
fi

scripts/gcc-plugins/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ always-y += $(GCC_PLUGIN)
2222
GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin)
2323

2424
plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \
25+
-include $(srctree)/include/linux/compiler-version.h \
2526
-I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \
2627
-fno-rtti -fno-exceptions -fasynchronous-unwind-tables \
2728
-ggdb -Wno-narrowing -Wno-unused-variable \

scripts/ld-version.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ orig_args="$@"
2929
# Get the first line of the --version output.
3030
IFS='
3131
'
32-
set -- $("$@" --version)
32+
set -- $(LC_ALL=C "$@" --version)
3333

3434
# Split the line on spaces.
3535
IFS=' '
@@ -44,14 +44,20 @@ if [ "$1" = GNU -a "$2" = ld ]; then
4444
elif [ "$1" = GNU -a "$2" = gold ]; then
4545
echo "gold linker is not supported as it is not capable of linking the kernel proper." >&2
4646
exit 1
47-
elif [ "$1" = LLD ]; then
48-
version=$2
49-
min_version=$lld_min_version
50-
name=LLD
51-
disp_name=LLD
5247
else
53-
echo "$orig_args: unknown linker" >&2
54-
exit 1
48+
while [ $# -gt 1 -a "$1" != "LLD" ]; do
49+
shift
50+
done
51+
52+
if [ "$1" = LLD ]; then
53+
version=$2
54+
min_version=$lld_min_version
55+
name=LLD
56+
disp_name=LLD
57+
else
58+
echo "$orig_args: unknown linker" >&2
59+
exit 1
60+
fi
5561
fi
5662

5763
# Some distributions append a package release number, as in 2.34-4.fc32

0 commit comments

Comments
 (0)