Skip to content

Commit a412682

Browse files
committed
Merge tag 'kbuild-fixes-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada: - Fix UML build with clang-18 and newer - Avoid using the alias attribute in host programs - Replace tabs with spaces when followed by conditionals for future GNU Make versions - Fix rpm-pkg for the systemd-provided kernel-install tool - Fix the undefined behavior in Kconfig for a 'int' symbol used in a conditional * tag 'kbuild-fixes-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kconfig: initialize sym->curr.tri to 'no' for all symbol types again kbuild: rpm-pkg: simplify installkernel %post kbuild: Replace tabs with spaces when followed by conditionals modpost: avoid using the alias attribute kbuild: fix W= flags in the help message modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS um: Fix adding '-no-pie' for clang kbuild: defconf: use SRCARCH to find merged configs
2 parents cfdf0c0 + bfef491 commit a412682

File tree

10 files changed

+41
-50
lines changed

10 files changed

+41
-50
lines changed

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,15 @@ may-sync-config := 1
294294
single-build :=
295295

296296
ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
297-
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
297+
ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
298298
need-config :=
299-
endif
299+
endif
300300
endif
301301

302302
ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
303-
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
303+
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
304304
may-sync-config :=
305-
endif
305+
endif
306306
endif
307307

308308
need-compiler := $(may-sync-config)
@@ -323,9 +323,9 @@ endif
323323
# We cannot build single targets and the others at the same time
324324
ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
325325
single-build := 1
326-
ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
326+
ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
327327
mixed-build := 1
328-
endif
328+
endif
329329
endif
330330

331331
# For "make -j clean all", "make -j mrproper defconfig all", etc.
@@ -1666,7 +1666,7 @@ help:
16661666
@echo ' (sparse by default)'
16671667
@echo ' make C=2 [targets] Force check of all c source with $$CHECK'
16681668
@echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
1669-
@echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where'
1669+
@echo ' make W=n [targets] Enable extra build checks, n=1,2,3,c,e where'
16701670
@echo ' 1: warnings which may be relevant and do not occur too often'
16711671
@echo ' 2: warnings which occur quite often but may still be relevant'
16721672
@echo ' 3: more obscure warnings, can most likely be ignored'

arch/m68k/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
KBUILD_DEFCONFIG := multi_defconfig
1616

1717
ifdef cross_compiling
18-
ifeq ($(CROSS_COMPILE),)
18+
ifeq ($(CROSS_COMPILE),)
1919
CROSS_COMPILE := $(call cc-cross-prefix, \
2020
m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
21-
endif
21+
endif
2222
endif
2323

2424
#

arch/parisc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ export CROSS32CC
5050

5151
# Set default cross compiler for kernel build
5252
ifdef cross_compiling
53-
ifeq ($(CROSS_COMPILE),)
53+
ifeq ($(CROSS_COMPILE),)
5454
CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
5555
CROSS_COMPILE := $(call cc-cross-prefix, \
5656
$(foreach a,$(CC_ARCHES), \
5757
$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
58-
endif
58+
endif
5959
endif
6060

6161
ifdef CONFIG_DYNAMIC_FTRACE

arch/um/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ archprepare:
115115
$(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
116116

117117
LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
118-
LINK-$(CONFIG_LD_SCRIPT_DYN) += $(call cc-option, -no-pie)
118+
ifdef CONFIG_LD_SCRIPT_DYN
119+
LINK-$(call gcc-min-version, 60100)$(CONFIG_CC_IS_CLANG) += -no-pie
120+
endif
119121
LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib
120122

121123
CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \

arch/x86/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ ifeq ($(CONFIG_X86_32),y)
112112
# temporary until string.h is fixed
113113
KBUILD_CFLAGS += -ffreestanding
114114

115-
ifeq ($(CONFIG_STACKPROTECTOR),y)
116-
ifeq ($(CONFIG_SMP),y)
115+
ifeq ($(CONFIG_STACKPROTECTOR),y)
116+
ifeq ($(CONFIG_SMP),y)
117117
KBUILD_CFLAGS += -mstack-protector-guard-reg=fs -mstack-protector-guard-symbol=__stack_chk_guard
118-
else
118+
else
119119
KBUILD_CFLAGS += -mstack-protector-guard=global
120-
endif
121-
endif
120+
endif
121+
endif
122122
else
123123
BITS := 64
124124
UTS_MACHINE := x86_64

scripts/Makefile.defconf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
# Input config fragments without '.config' suffix
1010
define merge_into_defconfig
1111
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
12-
-m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
13-
$(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
12+
-m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
13+
$(foreach config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
1414
+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
1515
endef
1616

@@ -23,7 +23,7 @@ endef
2323
# Input config fragments without '.config' suffix
2424
define merge_into_defconfig_override
2525
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
26-
-Q -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
27-
$(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
26+
-Q -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
27+
$(foreach config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
2828
+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
2929
endef

scripts/kconfig/symbol.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ void sym_calc_value(struct symbol *sym)
345345

346346
oldval = sym->curr;
347347

348+
newval.tri = no;
349+
348350
switch (sym->type) {
349351
case S_INT:
350352
newval.val = "0";
@@ -357,7 +359,7 @@ void sym_calc_value(struct symbol *sym)
357359
break;
358360
case S_BOOLEAN:
359361
case S_TRISTATE:
360-
newval = symbol_no.curr;
362+
newval.val = "n";
361363
break;
362364
default:
363365
sym->curr.val = sym->name;

scripts/mod/modpost.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ void modpost_log(enum loglevel loglevel, const char *fmt, ...)
7070
break;
7171
case LOG_ERROR:
7272
fprintf(stderr, "ERROR: ");
73-
break;
74-
case LOG_FATAL:
75-
fprintf(stderr, "FATAL: ");
73+
error_occurred = true;
7674
break;
7775
default: /* invalid loglevel, ignore */
7876
break;
@@ -83,16 +81,8 @@ void modpost_log(enum loglevel loglevel, const char *fmt, ...)
8381
va_start(arglist, fmt);
8482
vfprintf(stderr, fmt, arglist);
8583
va_end(arglist);
86-
87-
if (loglevel == LOG_FATAL)
88-
exit(1);
89-
if (loglevel == LOG_ERROR)
90-
error_occurred = true;
9184
}
9285

93-
void __attribute__((alias("modpost_log")))
94-
modpost_log_noret(enum loglevel loglevel, const char *fmt, ...);
95-
9686
static inline bool strends(const char *str, const char *postfix)
9787
{
9888
if (strlen(str) < strlen(postfix))
@@ -806,7 +796,8 @@ static void check_section(const char *modname, struct elf_info *elf,
806796

807797
#define DATA_SECTIONS ".data", ".data.rel"
808798
#define TEXT_SECTIONS ".text", ".text.*", ".sched.text", \
809-
".kprobes.text", ".cpuidle.text", ".noinstr.text"
799+
".kprobes.text", ".cpuidle.text", ".noinstr.text", \
800+
".ltext", ".ltext.*"
810801
#define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \
811802
".fixup", ".entry.text", ".exception.text", \
812803
".coldtext", ".softirqentry.text"

scripts/mod/modpost.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,11 @@ void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym);
194194
enum loglevel {
195195
LOG_WARN,
196196
LOG_ERROR,
197-
LOG_FATAL
198197
};
199198

200199
void __attribute__((format(printf, 2, 3)))
201200
modpost_log(enum loglevel loglevel, const char *fmt, ...);
202201

203-
void __attribute__((format(printf, 2, 3), noreturn))
204-
modpost_log_noret(enum loglevel loglevel, const char *fmt, ...);
205-
206202
/*
207203
* warn - show the given message, then let modpost continue running, still
208204
* allowing modpost to exit successfully. This should be used when
@@ -218,4 +214,4 @@ modpost_log_noret(enum loglevel loglevel, const char *fmt, ...);
218214
*/
219215
#define warn(fmt, args...) modpost_log(LOG_WARN, fmt, ##args)
220216
#define error(fmt, args...) modpost_log(LOG_ERROR, fmt, ##args)
221-
#define fatal(fmt, args...) modpost_log_noret(LOG_FATAL, fmt, ##args)
217+
#define fatal(fmt, args...) do { error(fmt, ##args); exit(1); } while (1)

scripts/package/kernel.spec

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ patch -p1 < %{SOURCE2}
5555
%{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release}
5656

5757
%install
58-
mkdir -p %{buildroot}/boot
59-
cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEASE}
58+
mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE}
59+
cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz
6060
%{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install
6161
%{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
62-
cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE}
63-
cp .config %{buildroot}/boot/config-%{KERNELRELEASE}
62+
cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}
63+
cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config
6464
ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
6565
%if %{with_devel}
6666
%{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
@@ -70,13 +70,14 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
7070
rm -rf %{buildroot}
7171

7272
%post
73-
if [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{KERNELRELEASE} -a -r /boot/System.map-%{KERNELRELEASE} ]; then
74-
cp /boot/vmlinuz-%{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm
75-
cp /boot/System.map-%{KERNELRELEASE} /boot/.System.map-%{KERNELRELEASE}-rpm
76-
rm -f /boot/vmlinuz-%{KERNELRELEASE} /boot/System.map-%{KERNELRELEASE}
77-
/sbin/installkernel %{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
78-
rm -f /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
73+
if [ -x /usr/bin/kernel-install ]; then
74+
/usr/bin/kernel-install add %{KERNELRELEASE} /lib/modules/%{KERNELRELEASE}/vmlinuz
7975
fi
76+
for file in vmlinuz System.map config; do
77+
if ! cmp --silent "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"; then
78+
cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"
79+
fi
80+
done
8081

8182
%preun
8283
if [ -x /sbin/new-kernel-pkg ]; then
@@ -94,7 +95,6 @@ fi
9495
%defattr (-, root, root)
9596
/lib/modules/%{KERNELRELEASE}
9697
%exclude /lib/modules/%{KERNELRELEASE}/build
97-
/boot/*
9898

9999
%files headers
100100
%defattr (-, root, root)

0 commit comments

Comments
 (0)