Skip to content

Commit 5c5e048

Browse files
committed
Merge tag 'kbuild-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - Implement the binary search in modpost for faster symbol lookup - Respect HOSTCC when linking host programs written in Rust - Change the binrpm-pkg target to generate kernel-devel RPM package - Fix endianness issues for tee and ishtp MODULE_DEVICE_TABLE - Unify vdso_install rules - Remove unused __memexit* annotations - Eliminate stale whitelisting for __devinit/__devexit from modpost - Enable dummy-tools to handle the -fpatchable-function-entry flag - Add 'userldlibs' syntax * tag 'kbuild-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (30 commits) kbuild: support 'userldlibs' syntax kbuild: dummy-tools: pretend we understand -fpatchable-function-entry kbuild: Correct missing architecture-specific hyphens modpost: squash ALL_{INIT,EXIT}_TEXT_SECTIONS to ALL_TEXT_SECTIONS modpost: merge sectioncheck table entries regarding init/exit sections modpost: use ALL_INIT_SECTIONS for the section check from DATA_SECTIONS modpost: disallow the combination of EXPORT_SYMBOL and __meminit* modpost: remove EXIT_SECTIONS macro modpost: remove MEM_INIT_SECTIONS macro modpost: remove more symbol patterns from the section check whitelist modpost: disallow *driver to reference .meminit* sections linux/init: remove __memexit* annotations modpost: remove ALL_EXIT_DATA_SECTIONS macro kbuild: simplify cmd_ld_multi_m kbuild: avoid too many execution of scripts/pahole-flags.sh kbuild: remove ARCH_POSTLINK from module builds kbuild: unify no-compiler-targets and no-sync-config-targets kbuild: unify vdso_install rules docs: kbuild: add INSTALL_DTBS_PATH UML: remove unused cmd_vdso_install ...
2 parents 3062a98 + 5f56cb0 commit 5c5e048

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+443
-469
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ modules.order
7474
#
7575
# RPM spec file (make rpm-pkg)
7676
#
77-
/kernel.spec
7877
/rpmbuild/
7978

8079
#

Documentation/kbuild/kbuild.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ The output directory is often set using "O=..." on the commandline.
243243

244244
The value can be overridden in which case the default value is ignored.
245245

246+
INSTALL_DTBS_PATH
247+
-----------------
248+
INSTALL_DTBS_PATH specifies where to install device tree blobs for
249+
relocations required by build roots. This is not defined in the
250+
makefile but the argument can be passed to make if needed.
251+
246252
KBUILD_ABS_SRCTREE
247253
--------------------------------------------------
248254
Kbuild uses a relative path to point to the tree when possible. For instance,

Documentation/kbuild/makefiles.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,10 @@ Example::
937937
# net/bpfilter/Makefile
938938
bpfilter_umh-userldflags += -static
939939

940+
To specify libraries linked to a userspace program, you can use
941+
``<executable>-userldlibs``. The ``userldlibs`` syntax specifies libraries
942+
linked to all userspace programs created in the current Makefile.
943+
940944
When linking bpfilter_umh, it will be passed the extra option -static.
941945

942946
From command line, :ref:`USERCFLAGS and USERLDFLAGS <userkbuildflags>` will also be used.
@@ -1623,6 +1627,13 @@ INSTALL_MOD_STRIP
16231627
INSTALL_MOD_STRIP value will be used as the option(s) to the strip
16241628
command.
16251629

1630+
INSTALL_DTBS_PATH
1631+
This variable specifies a prefix for relocations required by build
1632+
roots. It defines a place for installing the device tree blobs. Like
1633+
INSTALL_MOD_PATH, it isn't defined in the Makefile, but can be passed
1634+
by the user if desired. Otherwise it defaults to the kernel install
1635+
path.
1636+
16261637
Makefile language
16271638
=================
16281639

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3781,7 +3781,7 @@ F: net/sched/act_bpf.c
37813781
F: net/sched/cls_bpf.c
37823782
F: samples/bpf/
37833783
F: scripts/bpf_doc.py
3784-
F: scripts/pahole-flags.sh
3784+
F: scripts/Makefile.btf
37853785
F: scripts/pahole-version.sh
37863786
F: tools/bpf/
37873787
F: tools/lib/bpf/

Makefile

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -277,18 +277,13 @@ no-dot-config-targets := $(clean-targets) \
277277
$(version_h) headers headers_% archheaders archscripts \
278278
%asm-generic kernelversion %src-pkg dt_binding_check \
279279
outputmakefile rustavailable rustfmt rustfmtcheck
280-
# Installation targets should not require compiler. Unfortunately, vdso_install
281-
# is an exception where build artifacts may be updated. This must be fixed.
282-
no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
283-
headers_install modules_install modules_sign kernelrelease image_name
284280
no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \
285281
image_name
286282
single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes %/
287283

288284
config-build :=
289285
mixed-build :=
290286
need-config := 1
291-
need-compiler := 1
292287
may-sync-config := 1
293288
single-build :=
294289

@@ -298,18 +293,14 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
298293
endif
299294
endif
300295

301-
ifneq ($(filter $(no-compiler-targets), $(MAKECMDGOALS)),)
302-
ifeq ($(filter-out $(no-compiler-targets), $(MAKECMDGOALS)),)
303-
need-compiler :=
304-
endif
305-
endif
306-
307296
ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
308297
ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
309298
may-sync-config :=
310299
endif
311300
endif
312301

302+
need-compiler := $(may-sync-config)
303+
313304
ifneq ($(KBUILD_EXTMOD),)
314305
may-sync-config :=
315306
endif
@@ -522,8 +513,6 @@ LZ4 = lz4c
522513
XZ = xz
523514
ZSTD = zstd
524515

525-
PAHOLE_FLAGS = $(shell PAHOLE=$(PAHOLE) $(srctree)/scripts/pahole-flags.sh)
526-
527516
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
528517
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
529518
NOSTDINC_FLAGS :=
@@ -614,7 +603,6 @@ export KBUILD_RUSTFLAGS RUSTFLAGS_KERNEL RUSTFLAGS_MODULE
614603
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
615604
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_RUSTFLAGS_MODULE KBUILD_LDFLAGS_MODULE
616605
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL KBUILD_RUSTFLAGS_KERNEL
617-
export PAHOLE_FLAGS
618606

619607
# Files to ignore in find ... statements
620608

@@ -684,7 +672,7 @@ ifdef config-build
684672
# *config targets only - make sure prerequisites are updated, and descend
685673
# in scripts/kconfig to make the *config target
686674

687-
# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
675+
# Read arch-specific Makefile to set KBUILD_DEFCONFIG as needed.
688676
# KBUILD_DEFCONFIG may point out an alternative default configuration
689677
# used for 'make defconfig'
690678
include $(srctree)/arch/$(SRCARCH)/Makefile
@@ -698,7 +686,7 @@ config: outputmakefile scripts_basic FORCE
698686

699687
else #!config-build
700688
# ===========================================================================
701-
# Build targets only - this includes vmlinux, arch specific targets, clean
689+
# Build targets only - this includes vmlinux, arch-specific targets, clean
702690
# targets and others. In general all targets except *config targets.
703691

704692
# If building an external module we do not care about the all: rule
@@ -1011,6 +999,7 @@ KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
1011999
# include additional Makefiles when needed
10121000
include-y := scripts/Makefile.extrawarn
10131001
include-$(CONFIG_DEBUG_INFO) += scripts/Makefile.debug
1002+
include-$(CONFIG_DEBUG_INFO_BTF)+= scripts/Makefile.btf
10141003
include-$(CONFIG_KASAN) += scripts/Makefile.kasan
10151004
include-$(CONFIG_KCSAN) += scripts/Makefile.kcsan
10161005
include-$(CONFIG_KMSAN) += scripts/Makefile.kmsan
@@ -1317,6 +1306,14 @@ scripts_unifdef: scripts_basic
13171306
quiet_cmd_install = INSTALL $(INSTALL_PATH)
13181307
cmd_install = unset sub_make_done; $(srctree)/scripts/install.sh
13191308

1309+
# ---------------------------------------------------------------------------
1310+
# vDSO install
1311+
1312+
PHONY += vdso_install
1313+
vdso_install: export INSTALL_FILES = $(vdso-install-y)
1314+
vdso_install:
1315+
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vdsoinst
1316+
13201317
# ---------------------------------------------------------------------------
13211318
# Tools
13221319

@@ -1486,7 +1483,7 @@ MRPROPER_FILES += include/config include/generated \
14861483
certs/signing_key.pem \
14871484
certs/x509.genkey \
14881485
vmlinux-gdb.py \
1489-
kernel.spec rpmbuild \
1486+
rpmbuild \
14901487
rust/libmacros.so
14911488

14921489
# clean - Delete most, but leave enough to build external modules
@@ -1560,6 +1557,7 @@ help:
15601557
@echo '* vmlinux - Build the bare kernel'
15611558
@echo '* modules - Build all modules'
15621559
@echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
1560+
@echo ' vdso_install - Install unstripped vdso to INSTALL_MOD_PATH (default: /)'
15631561
@echo ' dir/ - Build all files in dir and below'
15641562
@echo ' dir/file.[ois] - Build specified target only'
15651563
@echo ' dir/file.ll - Build the LLVM assembly file'
@@ -1637,9 +1635,9 @@ help:
16371635
@echo 'Documentation targets:'
16381636
@$(MAKE) -f $(srctree)/Documentation/Makefile dochelp
16391637
@echo ''
1640-
@echo 'Architecture specific targets ($(SRCARCH)):'
1638+
@echo 'Architecture-specific targets ($(SRCARCH)):'
16411639
@$(or $(archhelp),\
1642-
echo ' No architecture specific help defined for $(SRCARCH)')
1640+
echo ' No architecture-specific help defined for $(SRCARCH)')
16431641
@echo ''
16441642
@$(if $(boards), \
16451643
$(foreach b, $(boards), \
@@ -1681,7 +1679,7 @@ help-boards: $(help-board-dirs)
16811679
boards-per-dir = $(sort $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig)))
16821680

16831681
$(help-board-dirs): help-%:
1684-
@echo 'Architecture specific targets ($(SRCARCH) $*):'
1682+
@echo 'Architecture-specific targets ($(SRCARCH) $*):'
16851683
@$(if $(boards-per-dir), \
16861684
$(foreach b, $(boards-per-dir), \
16871685
printf " %-24s - Build for %s\\n" $*/$(b) $(subst _defconfig,,$(b));) \

arch/arm/Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,7 @@ $(INSTALL_TARGETS): KBUILD_IMAGE = $(boot)/$(patsubst %install,%Image,$@)
304304
$(INSTALL_TARGETS):
305305
$(call cmd,install)
306306

307-
PHONY += vdso_install
308-
vdso_install:
309-
ifeq ($(CONFIG_VDSO),y)
310-
$(Q)$(MAKE) $(build)=arch/arm/vdso $@
311-
endif
307+
vdso-install-$(CONFIG_VDSO) += arch/arm/vdso/vdso.so.dbg
312308

313309
# My testing targets (bypasses dependencies)
314310
bp:; $(Q)$(MAKE) $(build)=$(boot) $(boot)/bootpImage
@@ -331,7 +327,6 @@ define archhelp
331327
echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or'
332328
echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
333329
echo ' install to $$(INSTALL_PATH) and run lilo'
334-
echo ' vdso_install - Install unstripped vdso.so to $$(INSTALL_MOD_PATH)/vdso'
335330
echo
336331
echo ' multi_v7_lpae_defconfig - multi_v7_defconfig with CONFIG_ARM_LPAE enabled'
337332
endef

arch/arm/vdso/Makefile

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,3 @@ quiet_cmd_vdsold_and_vdso_check = LD $@
6363

6464
quiet_cmd_vdsomunge = MUNGE $@
6565
cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
66-
67-
#
68-
# Install the unstripped copy of vdso.so.dbg. If our toolchain
69-
# supports build-id, install .build-id links as well.
70-
#
71-
# Cribbed from arch/x86/vdso/Makefile.
72-
#
73-
quiet_cmd_vdso_install = INSTALL $<
74-
define cmd_vdso_install
75-
cp $< "$(MODLIB)/vdso/vdso.so"; \
76-
if readelf -n $< | grep -q 'Build ID'; then \
77-
buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \
78-
first=`echo $$buildid | cut -b-2`; \
79-
last=`echo $$buildid | cut -b3-`; \
80-
mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \
81-
ln -sf "../../vdso.so" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \
82-
fi
83-
endef
84-
85-
$(MODLIB)/vdso: FORCE
86-
@mkdir -p $(MODLIB)/vdso
87-
88-
PHONY += vdso_install
89-
vdso_install: $(obj)/vdso.so.dbg $(MODLIB)/vdso
90-
$(call cmd,vdso_install)

arch/arm64/Makefile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,6 @@ install: KBUILD_IMAGE := $(boot)/Image
169169
install zinstall:
170170
$(call cmd,install)
171171

172-
PHONY += vdso_install
173-
vdso_install:
174-
$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
175-
$(if $(CONFIG_COMPAT_VDSO), \
176-
$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@)
177-
178172
archprepare:
179173
$(Q)$(MAKE) $(build)=arch/arm64/tools kapi
180174
ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
@@ -205,6 +199,9 @@ ifdef CONFIG_COMPAT_VDSO
205199
endif
206200
endif
207201

202+
vdso-install-y += arch/arm64/kernel/vdso/vdso.so.dbg
203+
vdso-install-$(CONFIG_COMPAT_VDSO) += arch/arm64/kernel/vdso32/vdso.so.dbg:vdso32.so
204+
208205
include $(srctree)/scripts/Makefile.defconf
209206

210207
PHONY += virtconfig

arch/arm64/kernel/vdso/Makefile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,3 @@ include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
7878
# Actual build commands
7979
quiet_cmd_vdsold_and_vdso_check = LD $@
8080
cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)
81-
82-
# Install commands for the unstripped file
83-
quiet_cmd_vdso_install = INSTALL $@
84-
cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
85-
86-
vdso.so: $(obj)/vdso.so.dbg
87-
@mkdir -p $(MODLIB)/vdso
88-
$(call cmd,vdso_install)
89-
90-
vdso_install: vdso.so

arch/arm64/kernel/vdso32/Makefile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,3 @@ gen-vdsosym := $(srctree)/$(src)/../vdso/gen_vdso_offsets.sh
172172
quiet_cmd_vdsosym = VDSOSYM $@
173173
# The AArch64 nm should be able to read an AArch32 binary
174174
cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
175-
176-
# Install commands for the unstripped file
177-
quiet_cmd_vdso_install = INSTALL32 $@
178-
cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/vdso32.so
179-
180-
vdso.so: $(obj)/vdso.so.dbg
181-
@mkdir -p $(MODLIB)/vdso
182-
$(call cmd,vdso_install)
183-
184-
vdso_install: vdso.so

0 commit comments

Comments
 (0)