Skip to content

Commit 2f62996

Browse files
committed
Merge tag 'kbuild-fixes-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada: - Fix bugs in checkkconfigsymbols.py - Fix missing sys import in gen_compile_commands.py - Fix missing FORCE warning for ARCH=sh builds - Fix -Wignored-optimization-argument warnings for Clang builds - Turn -Wignored-optimization-argument into an error in order to stop building instead of sprinkling warnings * tag 'kbuild-fixes-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kbuild: Add -Werror=ignored-optimization-argument to CLANG_FLAGS x86/build: Do not add -falign flags unconditionally for clang kbuild: Fix comment typo in scripts/Makefile.modpost sh: Add missing FORCE prerequisites in Makefile gen_compile_commands: fix missing 'sys' package checkkconfigsymbols.py: Remove skipping of help lines in parse_kconfig_file checkkconfigsymbols.py: Forbid passing 'HEAD' to --commit
2 parents d94f395 + 0664684 commit 2f62996

File tree

6 files changed

+27
-20
lines changed

6 files changed

+27
-20
lines changed

arch/sh/boot/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,30 +80,30 @@ $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
8080
$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
8181
$(call if_changed,lzo)
8282

83-
$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2
83+
$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 FORCE
8484
$(call if_changed,uimage,bzip2)
8585

86-
$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz
86+
$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
8787
$(call if_changed,uimage,gzip)
8888

89-
$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma
89+
$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE
9090
$(call if_changed,uimage,lzma)
9191

92-
$(obj)/uImage.xz: $(obj)/vmlinux.bin.xz
92+
$(obj)/uImage.xz: $(obj)/vmlinux.bin.xz FORCE
9393
$(call if_changed,uimage,xz)
9494

95-
$(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo
95+
$(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE
9696
$(call if_changed,uimage,lzo)
9797

98-
$(obj)/uImage.bin: $(obj)/vmlinux.bin
98+
$(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
9999
$(call if_changed,uimage,none)
100100

101101
OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec
102-
$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux
102+
$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux FORCE
103103
$(call if_changed,objcopy)
104104

105105
OBJCOPYFLAGS_uImage.srec := -I binary -O srec
106-
$(obj)/uImage.srec: $(obj)/uImage
106+
$(obj)/uImage.srec: $(obj)/uImage FORCE
107107
$(call if_changed,objcopy)
108108

109109
$(obj)/uImage: $(obj)/uImage.$(suffix-y)

arch/x86/Makefile_32.cpu

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
tune = $(call cc-option,-mtune=$(1),$(2))
66

7+
ifdef CONFIG_CC_IS_CLANG
8+
align := -falign-functions=0 $(call cc-option,-falign-jumps=0) $(call cc-option,-falign-loops=0)
9+
else
10+
align := -falign-functions=0 -falign-jumps=0 -falign-loops=0
11+
endif
12+
713
cflags-$(CONFIG_M486SX) += -march=i486
814
cflags-$(CONFIG_M486) += -march=i486
915
cflags-$(CONFIG_M586) += -march=i586
@@ -19,11 +25,11 @@ cflags-$(CONFIG_MK6) += -march=k6
1925
# They make zero difference whatsosever to performance at this time.
2026
cflags-$(CONFIG_MK7) += -march=athlon
2127
cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,-march=athlon)
22-
cflags-$(CONFIG_MCRUSOE) += -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0
23-
cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) -falign-functions=0 -falign-jumps=0 -falign-loops=0
28+
cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align)
29+
cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) $(align)
2430
cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586)
2531
cflags-$(CONFIG_MWINCHIP3D) += $(call cc-option,-march=winchip2,-march=i586)
26-
cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) -falign-functions=0 -falign-jumps=0 -falign-loops=0
32+
cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) $(align)
2733
cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686)
2834
cflags-$(CONFIG_MVIAC7) += -march=i686
2935
cflags-$(CONFIG_MCORE2) += -march=i686 $(call tune,core2)

scripts/Makefile.clang

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
2929
else
3030
CLANG_FLAGS += -fintegrated-as
3131
endif
32+
# By default, clang only warns when it encounters an unknown warning flag or
33+
# certain optimization flags it knows it has not implemented.
34+
# Make it behave more like gcc by erroring when these flags are encountered
35+
# so they can be implemented or wrapped in cc-option.
3236
CLANG_FLAGS += -Werror=unknown-warning-option
37+
CLANG_FLAGS += -Werror=ignored-optimization-argument
3338
KBUILD_CFLAGS += $(CLANG_FLAGS)
3439
KBUILD_AFLAGS += $(CLANG_FLAGS)
3540
export CLANG_FLAGS

scripts/Makefile.modpost

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Stage 2 is handled by this file and does the following
1414
# 1) Find all modules listed in modules.order
1515
# 2) modpost is then used to
16-
# 3) create one <module>.mod.c file pr. module
16+
# 3) create one <module>.mod.c file per module
1717
# 4) create one Module.symvers file with CRC for all exported symbols
1818

1919
# Step 3 is used to place certain information in the module's ELF

scripts/checkkconfigsymbols.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
REGEX_KCONFIG_DEF = re.compile(DEF)
3535
REGEX_KCONFIG_EXPR = re.compile(EXPR)
3636
REGEX_KCONFIG_STMT = re.compile(STMT)
37-
REGEX_KCONFIG_HELP = re.compile(r"^\s+help\s*$")
3837
REGEX_FILTER_SYMBOLS = re.compile(r"[A-Za-z0-9]$")
3938
REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+")
4039
REGEX_QUOTES = re.compile("(\"(.*?)\")")
@@ -102,6 +101,9 @@ def parse_options():
102101
"continue.")
103102

104103
if args.commit:
104+
if args.commit.startswith('HEAD'):
105+
sys.exit("The --commit option can't use the HEAD ref")
106+
105107
args.find = False
106108

107109
if args.ignore:
@@ -432,7 +434,6 @@ def parse_kconfig_file(kfile):
432434
lines = []
433435
defined = []
434436
references = []
435-
skip = False
436437

437438
if not os.path.exists(kfile):
438439
return defined, references
@@ -448,12 +449,6 @@ def parse_kconfig_file(kfile):
448449
if REGEX_KCONFIG_DEF.match(line):
449450
symbol_def = REGEX_KCONFIG_DEF.findall(line)
450451
defined.append(symbol_def[0])
451-
skip = False
452-
elif REGEX_KCONFIG_HELP.match(line):
453-
skip = True
454-
elif skip:
455-
# ignore content of help messages
456-
pass
457452
elif REGEX_KCONFIG_STMT.match(line):
458453
line = REGEX_QUOTES.sub("", line)
459454
symbols = get_symbols_in_line(line)

scripts/clang-tools/gen_compile_commands.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import os
1414
import re
1515
import subprocess
16+
import sys
1617

1718
_DEFAULT_OUTPUT = 'compile_commands.json'
1819
_DEFAULT_LOG_LEVEL = 'WARNING'

0 commit comments

Comments
 (0)