Skip to content

Commit 2df7660

Browse files
committed
Merge tag 'kbuild-fixes-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada: - Fix CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y compile error for the combination of Clang >= 14 and GAS <= 2.35. - Drop vmlinux.bz2 from the rpm package as it just annoyingly increased the package size. - Fix modpost error under build environments using musl. - Make *.ll files keep value names for easier debugging - Fix single directory build - Prevent RISC-V from selecting the broken DWARF5 support when Clang and GAS are used together. * tag 'kbuild-fixes-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5 kbuild: fix single directory build kbuild: add -fno-discard-value-names to cmd_cc_ll_c scripts/clang-tools: Convert clang-tidy args to list modpost: put modpost options before argument kbuild: Stop including vmlinux.bz2 in the rpm's Kconfig.debug: add toolchain checks for DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT Kconfig.debug: simplify the dependency of DEBUG_INFO_DWARF4/5
2 parents 2fcd8f1 + 0a6de78 commit 2df7660

File tree

6 files changed

+18
-11
lines changed

6 files changed

+18
-11
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,6 +1979,8 @@ endif
19791979

19801980
single-goals := $(addprefix $(build-dir)/, $(single-no-ko))
19811981

1982+
KBUILD_MODULES := 1
1983+
19821984
endif
19831985

19841986
# Preset locale variables to speed up the build process. Limit locale

lib/Kconfig.debug

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ config DEBUG_INFO
231231
in the "Debug information" choice below, indicating that debug
232232
information will be generated for build targets.
233233

234+
# Clang is known to generate .{s,u}leb128 with symbol deltas with DWARF5, which
235+
# some targets may not support: https://sourceware.org/bugzilla/show_bug.cgi?id=27215
236+
config AS_HAS_NON_CONST_LEB128
237+
def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:)
238+
234239
choice
235240
prompt "Debug information"
236241
depends on DEBUG_KERNEL
@@ -253,6 +258,7 @@ config DEBUG_INFO_NONE
253258
config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
254259
bool "Rely on the toolchain's implicit default DWARF version"
255260
select DEBUG_INFO
261+
depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128)
256262
help
257263
The implicit default version of DWARF debug info produced by a
258264
toolchain changes over time.
@@ -264,7 +270,7 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
264270
config DEBUG_INFO_DWARF4
265271
bool "Generate DWARF Version 4 debuginfo"
266272
select DEBUG_INFO
267-
depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
273+
depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
268274
help
269275
Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2
270276
if using clang without clang's integrated assembler, and gdb 7.0+.
@@ -276,7 +282,7 @@ config DEBUG_INFO_DWARF4
276282
config DEBUG_INFO_DWARF5
277283
bool "Generate DWARF Version 5 debuginfo"
278284
select DEBUG_INFO
279-
depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
285+
depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128)
280286
help
281287
Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc
282288
5.0+ accepts the -gdwarf-5 flag but only had partial support for some

scripts/Makefile.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ $(obj)/%.symtypes : $(src)/%.c FORCE
140140
# LLVM assembly
141141
# Generate .ll files from .c
142142
quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@
143-
cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $<
143+
cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -fno-discard-value-names -o $@ $<
144144

145145
$(obj)/%.ll: $(src)/%.c FORCE
146146
$(call if_changed_dep,cc_ll_c)

scripts/Makefile.modpost

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ quiet_cmd_modpost = MODPOST $@
119119
echo >&2 "WARNING: $(missing-input) is missing."; \
120120
echo >&2 " Modules may not have dependencies or modversions."; \
121121
echo >&2 " You may get many unresolved symbol warnings.";) \
122-
sed 's/ko$$/o/' $(or $(modorder-if-needed), /dev/null) | $(MODPOST) $(modpost-args) $(vmlinux.o-if-present) -T -
122+
sed 's/ko$$/o/' $(or $(modorder-if-needed), /dev/null) | $(MODPOST) $(modpost-args) -T - $(vmlinux.o-if-present)
123123

124124
targets += $(output-symdump)
125125
$(output-symdump): $(modorder-if-needed) $(vmlinux.o-if-present) $(moudle.symvers-if-present) $(MODPOST) FORCE

scripts/clang-tools/run-clang-tools.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ def init(l, a):
4545

4646
def run_analysis(entry):
4747
# Disable all checks, then re-enable the ones we want
48-
checks = "-checks=-*,"
48+
checks = []
49+
checks.append("-checks=-*")
4950
if args.type == "clang-tidy":
50-
checks += "linuxkernel-*"
51+
checks.append("linuxkernel-*")
5152
else:
52-
checks += "clang-analyzer-*"
53-
checks += ",-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling"
54-
p = subprocess.run(["clang-tidy", "-p", args.path, checks, entry["file"]],
53+
checks.append("clang-analyzer-*")
54+
checks.append("-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling")
55+
p = subprocess.run(["clang-tidy", "-p", args.path, ",".join(checks), entry["file"]],
5556
stdout=subprocess.PIPE,
5657
stderr=subprocess.STDOUT,
5758
cwd=entry["directory"])

scripts/package/mkspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ $M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
9797
$MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
9898
cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
9999
cp .config %{buildroot}/boot/config-$KERNELRELEASE
100-
bzip2 -9 --keep vmlinux
101-
mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
102100
$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
103101
$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
104102
$S$M mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE

0 commit comments

Comments
 (0)