Kbuild updates for v5.6 (2nd)

- fix randconfig to generate a sane .config
 
  - rename hostprogs-y / always to hostprogs / always-y, which are
    more natual syntax.
 
  - optimize scripts/kallsyms
 
  - fix yes2modconfig and mod2yesconfig
 
  - make multiple directory targets ('make foo/ bar/') work
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAl47NfMVHG1hc2FoaXJv
 eUBrZXJuZWwub3JnAAoJED2LAQed4NsGRGwP/3AHO8P0wGEeFKs3ziSMjs2W7/Pj
 lN08Kuxm0u3LnyEEcHVUveoi+xBYqvrw0RsGgYf5S8q0Mpep7MPqbfkDUxV/0Zkj
 QP2CsvOTbjdBjH7q3ojkwLcDl0Pxu9mg3eZMRXZ2WQeNXuMRw6Bicoh7ElvB1Bv/
 HC+j30i2Me3cf/riQGSAsstvlXyIR8RaerR8PfRGESTysiiN76+JcHTatJHhOJL9
 O6XKkzo8/CXMYKKVF4Ae4NP+WFg6E96/pAPx0Rf47RbPX9UG35L9rkzTDnk70Ms6
 OhKiu3hXsRX7mkqApuoTqjge4+iiQcKZxYmMXU1vGlIRzjwg19/4YFP6pDSCcnIu
 kKb8KN4o4N41N7MFS3OLZWwISA8Vw6RbtwDZ3AghDWb7EHb9oNW42mGfcAPr1+wZ
 /KH6RHTzaz+5q2MgyMY1NhADFrhIT9CvDM+UJECgbokblnw7PHAnPmbsuVak9ZOH
 u9ojO1HpTTuIYO6N6v4K5zQBZF1N+RvkmBnhHd8j6SksppsCoC/G62QxgXhF2YK3
 FQMpATCpuyengLxWAmPEjsyyPOlrrdu9UxqNsXVy5ol40+7zpxuHwKcQKCa9urJR
 rcpbIwLaBcLhHU4BmvBxUk5aZxxGV2F0O0gXTOAbT2xhd6BipZSMhUmN49SErhQm
 NC/coUmQX7McxMXh
 =sv4U
 -----END PGP SIGNATURE-----

Merge tag 'kbuild-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull more Kbuild updates from Masahiro Yamada:

 - fix randconfig to generate a sane .config

 - rename hostprogs-y / always to hostprogs / always-y, which are more
   natual syntax.

 - optimize scripts/kallsyms

 - fix yes2modconfig and mod2yesconfig

 - make multiple directory targets ('make foo/ bar/') work

* tag 'kbuild-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: make multiple directory targets work
  kconfig: Invalidate all symbols after changing to y or m.
  kallsyms: fix type of kallsyms_token_table[]
  scripts/kallsyms: change table to store (strcut sym_entry *)
  scripts/kallsyms: rename local variables in read_symbol()
  kbuild: rename hostprogs-y/always to hostprogs/always-y
  kbuild: fix the document to use extra-y for vmlinux.lds
  kconfig: fix broken dependency in randconfig-generated .config
This commit is contained in:
Linus Torvalds 2020-02-09 16:05:50 -08:00
commit 89a47dd1af
53 changed files with 252 additions and 261 deletions

View File

@ -28,7 +28,6 @@ This document describes the Linux kernel Makefiles.
--- 4.3 Using C++ for host programs --- 4.3 Using C++ for host programs
--- 4.4 Controlling compiler options for host programs --- 4.4 Controlling compiler options for host programs
--- 4.5 When host programs are actually built --- 4.5 When host programs are actually built
--- 4.6 Using hostprogs-$(CONFIG_FOO)
=== 5 Kbuild clean infrastructure === 5 Kbuild clean infrastructure
@ -595,11 +594,11 @@ compilation stage.
Two steps are required in order to use a host executable. Two steps are required in order to use a host executable.
The first step is to tell kbuild that a host program exists. This is The first step is to tell kbuild that a host program exists. This is
done utilising the variable hostprogs-y. done utilising the variable "hostprogs".
The second step is to add an explicit dependency to the executable. The second step is to add an explicit dependency to the executable.
This can be done in two ways. Either add the dependency in a rule, This can be done in two ways. Either add the dependency in a rule,
or utilise the variable $(always). or utilise the variable "always-y".
Both possibilities are described in the following. Both possibilities are described in the following.
4.1 Simple Host Program 4.1 Simple Host Program
@ -612,7 +611,7 @@ Both possibilities are described in the following.
Example:: Example::
hostprogs-y := bin2hex hostprogs := bin2hex
Kbuild assumes in the above example that bin2hex is made from a single Kbuild assumes in the above example that bin2hex is made from a single
c-source file named bin2hex.c located in the same directory as c-source file named bin2hex.c located in the same directory as
@ -630,7 +629,7 @@ Both possibilities are described in the following.
Example:: Example::
#scripts/lxdialog/Makefile #scripts/lxdialog/Makefile
hostprogs-y := lxdialog hostprogs := lxdialog
lxdialog-objs := checklist.o lxdialog.o lxdialog-objs := checklist.o lxdialog.o
Objects with extension .o are compiled from the corresponding .c Objects with extension .o are compiled from the corresponding .c
@ -650,7 +649,7 @@ Both possibilities are described in the following.
Example:: Example::
#scripts/kconfig/Makefile #scripts/kconfig/Makefile
hostprogs-y := qconf hostprogs := qconf
qconf-cxxobjs := qconf.o qconf-cxxobjs := qconf.o
In the example above the executable is composed of the C++ file In the example above the executable is composed of the C++ file
@ -662,7 +661,7 @@ Both possibilities are described in the following.
Example:: Example::
#scripts/kconfig/Makefile #scripts/kconfig/Makefile
hostprogs-y := qconf hostprogs := qconf
qconf-cxxobjs := qconf.o qconf-cxxobjs := qconf.o
qconf-objs := check.o qconf-objs := check.o
@ -710,7 +709,7 @@ Both possibilities are described in the following.
Example:: Example::
#drivers/pci/Makefile #drivers/pci/Makefile
hostprogs-y := gen-devlist hostprogs := gen-devlist
$(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist $(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist
( cd $(obj); ./gen-devlist ) < $< ( cd $(obj); ./gen-devlist ) < $<
@ -718,47 +717,31 @@ Both possibilities are described in the following.
$(obj)/gen-devlist is updated. Note that references to $(obj)/gen-devlist is updated. Note that references to
the host programs in special rules must be prefixed with $(obj). the host programs in special rules must be prefixed with $(obj).
(2) Use $(always) (2) Use always-y
When there is no suitable special rule, and the host program When there is no suitable special rule, and the host program
shall be built when a makefile is entered, the $(always) shall be built when a makefile is entered, the always-y
variable shall be used. variable shall be used.
Example:: Example::
#scripts/lxdialog/Makefile #scripts/lxdialog/Makefile
hostprogs-y := lxdialog hostprogs := lxdialog
always := $(hostprogs-y) always-y := $(hostprogs)
This will tell kbuild to build lxdialog even if not referenced in This will tell kbuild to build lxdialog even if not referenced in
any rule. any rule.
4.6 Using hostprogs-$(CONFIG_FOO)
---------------------------------
A typical pattern in a Kbuild file looks like this:
Example::
#scripts/Makefile
hostprogs-$(CONFIG_KALLSYMS) += kallsyms
Kbuild knows about both 'y' for built-in and 'm' for module.
So if a config symbol evaluates to 'm', kbuild will still build
the binary. In other words, Kbuild handles hostprogs-m exactly
like hostprogs-y. But only hostprogs-y is recommended to be used
when no CONFIG symbols are involved.
5 Kbuild clean infrastructure 5 Kbuild clean infrastructure
============================= =============================
"make clean" deletes most generated files in the obj tree where the kernel "make clean" deletes most generated files in the obj tree where the kernel
is compiled. This includes generated files such as host programs. is compiled. This includes generated files such as host programs.
Kbuild knows targets listed in $(hostprogs-y), $(hostprogs-m), $(always), Kbuild knows targets listed in $(hostprogs), $(always-y), $(always-m),
$(extra-y) and $(targets). They are all deleted during "make clean". $(always-), $(extra-y), $(extra-) and $(targets). They are all deleted
Files matching the patterns "*.[oas]", "*.ko", plus some additional files during "make clean". Files matching the patterns "*.[oas]", "*.ko", plus
generated by kbuild are deleted all over the kernel src tree when some additional files generated by kbuild are deleted all over the kernel
"make clean" is executed. source tree when "make clean" is executed.
Additional files or directories can be specified in kbuild makefiles by use of Additional files or directories can be specified in kbuild makefiles by use of
$(clean-files). $(clean-files).
@ -1269,12 +1252,12 @@ When kbuild executes, the following steps are followed (roughly):
Example:: Example::
#arch/x86/kernel/Makefile #arch/x86/kernel/Makefile
always := vmlinux.lds extra-y := vmlinux.lds
#Makefile #Makefile
export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
The assignment to $(always) is used to tell kbuild to build the The assignment to extra-y is used to tell kbuild to build the
target vmlinux.lds. target vmlinux.lds.
The assignment to $(CPPFLAGS_vmlinux.lds) tells kbuild to use the The assignment to $(CPPFLAGS_vmlinux.lds) tells kbuild to use the
specified options when building the target vmlinux.lds. specified options when building the target vmlinux.lds.

8
Kbuild
View File

@ -7,7 +7,7 @@
bounds-file := include/generated/bounds.h bounds-file := include/generated/bounds.h
always := $(bounds-file) always-y := $(bounds-file)
targets := kernel/bounds.s targets := kernel/bounds.s
$(bounds-file): kernel/bounds.s FORCE $(bounds-file): kernel/bounds.s FORCE
@ -28,7 +28,7 @@ $(timeconst-file): kernel/time/timeconst.bc FORCE
offsets-file := include/generated/asm-offsets.h offsets-file := include/generated/asm-offsets.h
always += $(offsets-file) always-y += $(offsets-file)
targets += arch/$(SRCARCH)/kernel/asm-offsets.s targets += arch/$(SRCARCH)/kernel/asm-offsets.s
arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file) arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file)
@ -39,7 +39,7 @@ $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
##### #####
# Check for missing system calls # Check for missing system calls
always += missing-syscalls always-y += missing-syscalls
quiet_cmd_syscalls = CALL $< quiet_cmd_syscalls = CALL $<
cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags) cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
@ -50,7 +50,7 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
##### #####
# Check atomic headers are up-to-date # Check atomic headers are up-to-date
always += old-atomics always-y += old-atomics
quiet_cmd_atomics = CALL $< quiet_cmd_atomics = CALL $<
cmd_atomics = $(CONFIG_SHELL) $< cmd_atomics = $(CONFIG_SHELL) $<

View File

@ -1679,7 +1679,7 @@ PHONY += descend $(build-dirs)
descend: $(build-dirs) descend: $(build-dirs)
$(build-dirs): prepare $(build-dirs): prepare
$(Q)$(MAKE) $(build)=$@ \ $(Q)$(MAKE) $(build)=$@ \
single-build=$(if $(filter-out $@/, $(single-no-ko)),1) \ single-build=$(if $(filter-out $@/, $(filter $@/%, $(single-no-ko))),1) \
need-builtin=1 need-modorder=1 need-builtin=1 need-modorder=1
clean-dirs := $(addprefix _clean_, $(clean-dirs)) clean-dirs := $(addprefix _clean_, $(clean-dirs))

View File

@ -8,7 +8,7 @@
# Copyright (C) 1994 by Linus Torvalds # Copyright (C) 1994 by Linus Torvalds
# #
hostprogs-y := tools/mkbb tools/objstrip hostprogs := tools/mkbb tools/objstrip
targets := vmlinux.gz vmlinux \ targets := vmlinux.gz vmlinux \
vmlinux.nh tools/lxboot tools/bootlx tools/bootph \ vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
tools/bootpzh bootloader bootpheader bootpzheader tools/bootpzh bootloader bootpheader bootpzheader

View File

@ -5,7 +5,7 @@
ARCH_REL_TYPE_ABS := R_ARM_JUMP_SLOT|R_ARM_GLOB_DAT|R_ARM_ABS32 ARCH_REL_TYPE_ABS := R_ARM_JUMP_SLOT|R_ARM_GLOB_DAT|R_ARM_ABS32
include $(srctree)/lib/vdso/Makefile include $(srctree)/lib/vdso/Makefile
hostprogs-y := vdsomunge hostprogs := vdsomunge
obj-vdso := vgettimeofday.o datapage.o note.o obj-vdso := vgettimeofday.o datapage.o note.o

View File

@ -115,9 +115,9 @@ VDSO_LDFLAGS += $(call cc32-ldoption,-fuse-ld=bfd)
# Borrow vdsomunge.c from the arm vDSO # Borrow vdsomunge.c from the arm vDSO
# We have to use a relative path because scripts/Makefile.host prefixes # We have to use a relative path because scripts/Makefile.host prefixes
# $(hostprogs-y) with $(obj) # $(hostprogs) with $(obj)
munge := ../../../arm/vdso/vdsomunge munge := ../../../arm/vdso/vdsomunge
hostprogs-y := $(munge) hostprogs := $(munge)
c-obj-vdso := note.o c-obj-vdso := note.o
c-obj-vdso-gettimeofday := vgettimeofday.o c-obj-vdso-gettimeofday := vgettimeofday.o

View File

@ -21,7 +21,7 @@ endif
drop-sections := .reginfo .mdebug .comment .note .pdr .options .MIPS.options drop-sections := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
strip-flags := $(addprefix --remove-section=,$(drop-sections)) strip-flags := $(addprefix --remove-section=,$(drop-sections))
hostprogs-y := elf2ecoff hostprogs := elf2ecoff
suffix-y := bin suffix-y := bin
suffix-$(CONFIG_KERNEL_BZIP2) := bz2 suffix-$(CONFIG_KERNEL_BZIP2) := bz2

View File

@ -84,7 +84,7 @@ $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
HOSTCFLAGS_calc_vmlinuz_load_addr.o += $(LINUXINCLUDE) HOSTCFLAGS_calc_vmlinuz_load_addr.o += $(LINUXINCLUDE)
# Calculate the load address of the compressed kernel image # Calculate the load address of the compressed kernel image
hostprogs-y := calc_vmlinuz_load_addr hostprogs := calc_vmlinuz_load_addr
ifneq ($(zload-y),) ifneq ($(zload-y),)
VMLINUZ_LOAD_ADDRESS := $(zload-y) VMLINUZ_LOAD_ADDRESS := $(zload-y)
@ -112,7 +112,7 @@ ifdef CONFIG_MACH_DECSTATION
endif endif
# elf2ecoff can only handle 32bit image # elf2ecoff can only handle 32bit image
hostprogs-y += ../elf2ecoff hostprogs += ../elf2ecoff
ifdef CONFIG_32BIT ifdef CONFIG_32BIT
VMLINUZ = vmlinuz VMLINUZ = vmlinuz

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
hostprogs-y += relocs hostprogs += relocs
relocs-objs += relocs_32.o relocs-objs += relocs_32.o
relocs-objs += relocs_64.o relocs-objs += relocs_64.o
relocs-objs += relocs_main.o relocs-objs += relocs_main.o

View File

@ -1,10 +1,10 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
hostprogs-y := elf-entry hostprogs := elf-entry
PHONY += elf-entry PHONY += elf-entry
elf-entry: $(obj)/elf-entry elf-entry: $(obj)/elf-entry
@: @:
hostprogs-$(CONFIG_CPU_LOONGSON3_WORKAROUNDS) += loongson3-llsc-check hostprogs += loongson3-llsc-check
PHONY += loongson3-llsc-check PHONY += loongson3-llsc-check
loongson3-llsc-check: $(obj)/loongson3-llsc-check loongson3-llsc-check: $(obj)/loongson3-llsc-check
@: @:

View File

@ -100,7 +100,7 @@ $(obj)/%.so.raw: OBJCOPYFLAGS := -S
$(obj)/%.so.raw: $(obj)/%.so.dbg.raw FORCE $(obj)/%.so.raw: $(obj)/%.so.dbg.raw FORCE
$(call if_changed,objcopy) $(call if_changed,objcopy)
hostprogs-y := genvdso hostprogs := genvdso
quiet_cmd_genvdso = GENVDSO $@ quiet_cmd_genvdso = GENVDSO $@
define cmd_genvdso define cmd_genvdso

View File

@ -224,7 +224,7 @@ $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
$(obj)/wrapper.a: $(obj-wlib) FORCE $(obj)/wrapper.a: $(obj-wlib) FORCE
$(call if_changed,bootar) $(call if_changed,bootar)
hostprogs-y := addnote hack-coff mktree hostprogs := addnote hack-coff mktree
targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
@ -464,7 +464,7 @@ WRAPPER_BINDIR := /usr/sbin
INSTALL := install INSTALL := install
extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y)) extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y)) hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs))
wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts)) dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))

View File

@ -10,8 +10,8 @@ PHONY += kapi
kapi: $(kapi-hdrs-y) kapi: $(kapi-hdrs-y)
hostprogs-y += gen_facilities hostprogs += gen_facilities
hostprogs-y += gen_opcode_table hostprogs += gen_opcode_table
HOSTCFLAGS_gen_facilities.o += $(LINUXINCLUDE) HOSTCFLAGS_gen_facilities.o += $(LINUXINCLUDE)

View File

@ -7,7 +7,7 @@
ROOT_IMG := /usr/src/root.img ROOT_IMG := /usr/src/root.img
ELFTOAOUT := elftoaout ELFTOAOUT := elftoaout
hostprogs-y := piggyback hostprogs := piggyback
targets := tftpboot.img image zImage vmlinux.aout targets := tftpboot.img image zImage vmlinux.aout
clean-files := System.map clean-files := System.map

View File

@ -41,7 +41,7 @@ $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
$(call if_changed,vdso) $(call if_changed,vdso)
HOST_EXTRACFLAGS += -I$(srctree)/tools/include HOST_EXTRACFLAGS += -I$(srctree)/tools/include
hostprogs-y += vdso2c hostprogs += vdso2c
quiet_cmd_vdso2c = VDSO2C $@ quiet_cmd_vdso2c = VDSO2C $@
cmd_vdso2c = $(obj)/vdso2c $< $(<:%.dbg=%) $@ cmd_vdso2c = $(obj)/vdso2c $< $(<:%.dbg=%) $@

View File

@ -45,8 +45,8 @@ setup-y += video-vesa.o
setup-y += video-bios.o setup-y += video-bios.o
targets += $(setup-y) targets += $(setup-y)
hostprogs-y := tools/build hostprogs := tools/build
hostprogs-$(CONFIG_X86_FEATURE_NAMES) += mkcpustr hostprogs += mkcpustr
HOST_EXTRACFLAGS += -I$(srctree)/tools/include \ HOST_EXTRACFLAGS += -I$(srctree)/tools/include \
-include include/generated/autoconf.h \ -include include/generated/autoconf.h \

View File

@ -58,7 +58,7 @@ KBUILD_LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \
endif endif
LDFLAGS_vmlinux := -T LDFLAGS_vmlinux := -T
hostprogs-y := mkpiggy hostprogs := mkpiggy
HOST_EXTRACFLAGS += -I$(srctree)/tools/include HOST_EXTRACFLAGS += -I$(srctree)/tools/include
sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p' sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p'

View File

@ -59,7 +59,7 @@ $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
$(call if_changed,vdso_and_check) $(call if_changed,vdso_and_check)
HOST_EXTRACFLAGS += -I$(srctree)/tools/include -I$(srctree)/include/uapi -I$(srctree)/arch/$(SUBARCH)/include/uapi HOST_EXTRACFLAGS += -I$(srctree)/tools/include -I$(srctree)/include/uapi -I$(srctree)/arch/$(SUBARCH)/include/uapi
hostprogs-y += vdso2c hostprogs += vdso2c
quiet_cmd_vdso2c = VDSO2C $@ quiet_cmd_vdso2c = VDSO2C $@
cmd_vdso2c = $(obj)/vdso2c $< $(<:%.dbg=%) $@ cmd_vdso2c = $(obj)/vdso2c $< $(<:%.dbg=%) $@

View File

@ -12,7 +12,7 @@ OBJECT_FILES_NON_STANDARD := y
# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in. # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
KCOV_INSTRUMENT := n KCOV_INSTRUMENT := n
always := realmode.bin realmode.relocs always-y := realmode.bin realmode.relocs
wakeup-objs := wakeup_asm.o wakemain.o video-mode.o wakeup-objs := wakeup_asm.o wakemain.o video-mode.o
wakeup-objs += copy.o bioscall.o regs.o wakeup-objs += copy.o bioscall.o regs.o

View File

@ -26,7 +26,7 @@ posttest: $(obj)/insn_decoder_test vmlinux $(obj)/insn_sanity
$(call cmd,posttest) $(call cmd,posttest)
$(call cmd,sanitytest) $(call cmd,sanitytest)
hostprogs-y += insn_decoder_test insn_sanity hostprogs += insn_decoder_test insn_sanity
# -I needed for generated C source and C source which in the kernel tree. # -I needed for generated C source and C source which in the kernel tree.
HOSTCFLAGS_insn_decoder_test.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/ HOSTCFLAGS_insn_decoder_test.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/
@ -39,7 +39,7 @@ $(obj)/insn_decoder_test.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/l
$(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c $(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
HOST_EXTRACFLAGS += -I$(srctree)/tools/include HOST_EXTRACFLAGS += -I$(srctree)/tools/include
hostprogs-y += relocs hostprogs += relocs
relocs-objs := relocs_32.o relocs_64.o relocs_common.o relocs-objs := relocs_32.o relocs_64.o relocs_common.o
PHONY += relocs PHONY += relocs
relocs: $(obj)/relocs relocs: $(obj)/relocs

View File

@ -5,7 +5,7 @@
ccflags-y := -Idrivers/gpu/drm/amd/include ccflags-y := -Idrivers/gpu/drm/amd/include
hostprogs-y := mkregtable hostprogs := mkregtable
clean-files := rn50_reg_safe.h r100_reg_safe.h r200_reg_safe.h rv515_reg_safe.h r300_reg_safe.h r420_reg_safe.h rs600_reg_safe.h r600_reg_safe.h evergreen_reg_safe.h cayman_reg_safe.h clean-files := rn50_reg_safe.h r100_reg_safe.h r200_reg_safe.h rv515_reg_safe.h r300_reg_safe.h r420_reg_safe.h rs600_reg_safe.h r600_reg_safe.h evergreen_reg_safe.h cayman_reg_safe.h
quiet_cmd_mkregtable = MKREGTABLE $@ quiet_cmd_mkregtable = MKREGTABLE $@

View File

@ -12,7 +12,7 @@ obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o
# Files generated that shall be removed upon make clean # Files generated that shall be removed upon make clean
clean-files := consolemap_deftbl.c defkeymap.c clean-files := consolemap_deftbl.c defkeymap.c
hostprogs-y += conmakehash hostprogs += conmakehash
quiet_cmd_conmk = CONMK $@ quiet_cmd_conmk = CONMK $@
cmd_conmk = $(obj)/conmakehash $< > $@ cmd_conmk = $(obj)/conmakehash $< > $@

View File

@ -18,7 +18,7 @@ obj-$(CONFIG_SPU_BASE) += logo_spe_clut224.o
# How to generate logo's # How to generate logo's
hostprogs-y := pnmtologo hostprogs := pnmtologo
# Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..." # Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."
quiet_cmd_logo = LOGO $@ quiet_cmd_logo = LOGO $@

View File

@ -7,7 +7,7 @@ obj-$(CONFIG_ZORRO) += zorro.o zorro-driver.o zorro-sysfs.o
obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_PROC_FS) += proc.o
obj-$(CONFIG_ZORRO_NAMES) += names.o obj-$(CONFIG_ZORRO_NAMES) += names.o
hostprogs-y := gen-devlist hostprogs := gen-devlist
# Files generated that shall be removed upon make clean # Files generated that shall be removed upon make clean
clean-files := devlist.h clean-files := devlist.h

View File

@ -35,4 +35,4 @@ $(obj)/utf8data.h: $(src)/utf8data.h_shipped FORCE
endif endif
targets += utf8data.h targets += utf8data.h
hostprogs-y += mkutf8data hostprogs += mkutf8data

View File

@ -44,7 +44,7 @@ __attribute__((weak, section(".rodata")));
extern const unsigned long kallsyms_relative_base extern const unsigned long kallsyms_relative_base
__attribute__((weak, section(".rodata"))); __attribute__((weak, section(".rodata")));
extern const u8 kallsyms_token_table[] __weak; extern const char kallsyms_token_table[] __weak;
extern const u16 kallsyms_token_index[] __weak; extern const u16 kallsyms_token_index[] __weak;
extern const unsigned int kallsyms_markers[] __weak; extern const unsigned int kallsyms_markers[] __weak;
@ -58,7 +58,8 @@ static unsigned int kallsyms_expand_symbol(unsigned int off,
char *result, size_t maxlen) char *result, size_t maxlen)
{ {
int len, skipped_first = 0; int len, skipped_first = 0;
const u8 *tptr, *data; const char *tptr;
const u8 *data;
/* Get the compressed symbol length from the first symbol byte. */ /* Get the compressed symbol length from the first symbol byte. */
data = &kallsyms_names[off]; data = &kallsyms_names[off];

View File

@ -241,8 +241,8 @@ obj-$(CONFIG_ASN1) += asn1_decoder.o
obj-$(CONFIG_FONT_SUPPORT) += fonts/ obj-$(CONFIG_FONT_SUPPORT) += fonts/
hostprogs-y := gen_crc32table hostprogs := gen_crc32table
hostprogs-y += gen_crc64table hostprogs += gen_crc64table
clean-files := crc32table.h clean-files := crc32table.h
clean-files += crc64table.h clean-files += crc64table.h

View File

@ -10,7 +10,7 @@ raid6_pq-$(CONFIG_ALTIVEC) += altivec1.o altivec2.o altivec4.o altivec8.o \
raid6_pq-$(CONFIG_KERNEL_MODE_NEON) += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o raid6_pq-$(CONFIG_KERNEL_MODE_NEON) += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o
hostprogs-y += mktables hostprogs += mktables
ifeq ($(CONFIG_ALTIVEC),y) ifeq ($(CONFIG_ALTIVEC),y)
altivec_flags := -maltivec $(call cc-option,-mabi=altivec) altivec_flags := -maltivec $(call cc-option,-mabi=altivec)

View File

@ -3,7 +3,7 @@
# Makefile for the Linux BPFILTER layer. # Makefile for the Linux BPFILTER layer.
# #
hostprogs-y := bpfilter_umh hostprogs := bpfilter_umh
bpfilter_umh-objs := main.o bpfilter_umh-objs := main.o
KBUILD_HOSTCFLAGS += -I $(srctree)/tools/include/ -I $(srctree)/tools/include/uapi KBUILD_HOSTCFLAGS += -I $(srctree)/tools/include/ -I $(srctree)/tools/include/uapi
HOSTCC := $(CC) HOSTCC := $(CC)

View File

@ -111,65 +111,65 @@ ibumad-objs := bpf_load.o ibumad_user.o $(TRACE_HELPERS)
hbm-objs := bpf_load.o hbm.o $(CGROUP_HELPERS) hbm-objs := bpf_load.o hbm.o $(CGROUP_HELPERS)
# Tell kbuild to always build the programs # Tell kbuild to always build the programs
always := $(tprogs-y) always-y := $(tprogs-y)
always += sockex1_kern.o always-y += sockex1_kern.o
always += sockex2_kern.o always-y += sockex2_kern.o
always += sockex3_kern.o always-y += sockex3_kern.o
always += tracex1_kern.o always-y += tracex1_kern.o
always += tracex2_kern.o always-y += tracex2_kern.o
always += tracex3_kern.o always-y += tracex3_kern.o
always += tracex4_kern.o always-y += tracex4_kern.o
always += tracex5_kern.o always-y += tracex5_kern.o
always += tracex6_kern.o always-y += tracex6_kern.o
always += tracex7_kern.o always-y += tracex7_kern.o
always += sock_flags_kern.o always-y += sock_flags_kern.o
always += test_probe_write_user_kern.o always-y += test_probe_write_user_kern.o
always += trace_output_kern.o always-y += trace_output_kern.o
always += tcbpf1_kern.o always-y += tcbpf1_kern.o
always += tc_l2_redirect_kern.o always-y += tc_l2_redirect_kern.o
always += lathist_kern.o always-y += lathist_kern.o
always += offwaketime_kern.o always-y += offwaketime_kern.o
always += spintest_kern.o always-y += spintest_kern.o
always += map_perf_test_kern.o always-y += map_perf_test_kern.o
always += test_overhead_tp_kern.o always-y += test_overhead_tp_kern.o
always += test_overhead_raw_tp_kern.o always-y += test_overhead_raw_tp_kern.o
always += test_overhead_kprobe_kern.o always-y += test_overhead_kprobe_kern.o
always += parse_varlen.o parse_simple.o parse_ldabs.o always-y += parse_varlen.o parse_simple.o parse_ldabs.o
always += test_cgrp2_tc_kern.o always-y += test_cgrp2_tc_kern.o
always += xdp1_kern.o always-y += xdp1_kern.o
always += xdp2_kern.o always-y += xdp2_kern.o
always += xdp_router_ipv4_kern.o always-y += xdp_router_ipv4_kern.o
always += test_current_task_under_cgroup_kern.o always-y += test_current_task_under_cgroup_kern.o
always += trace_event_kern.o always-y += trace_event_kern.o
always += sampleip_kern.o always-y += sampleip_kern.o
always += lwt_len_hist_kern.o always-y += lwt_len_hist_kern.o
always += xdp_tx_iptunnel_kern.o always-y += xdp_tx_iptunnel_kern.o
always += test_map_in_map_kern.o always-y += test_map_in_map_kern.o
always += tcp_synrto_kern.o always-y += tcp_synrto_kern.o
always += tcp_rwnd_kern.o always-y += tcp_rwnd_kern.o
always += tcp_bufs_kern.o always-y += tcp_bufs_kern.o
always += tcp_cong_kern.o always-y += tcp_cong_kern.o
always += tcp_iw_kern.o always-y += tcp_iw_kern.o
always += tcp_clamp_kern.o always-y += tcp_clamp_kern.o
always += tcp_basertt_kern.o always-y += tcp_basertt_kern.o
always += tcp_tos_reflect_kern.o always-y += tcp_tos_reflect_kern.o
always += tcp_dumpstats_kern.o always-y += tcp_dumpstats_kern.o
always += xdp_redirect_kern.o always-y += xdp_redirect_kern.o
always += xdp_redirect_map_kern.o always-y += xdp_redirect_map_kern.o
always += xdp_redirect_cpu_kern.o always-y += xdp_redirect_cpu_kern.o
always += xdp_monitor_kern.o always-y += xdp_monitor_kern.o
always += xdp_rxq_info_kern.o always-y += xdp_rxq_info_kern.o
always += xdp2skb_meta_kern.o always-y += xdp2skb_meta_kern.o
always += syscall_tp_kern.o always-y += syscall_tp_kern.o
always += cpustat_kern.o always-y += cpustat_kern.o
always += xdp_adjust_tail_kern.o always-y += xdp_adjust_tail_kern.o
always += xdp_fwd_kern.o always-y += xdp_fwd_kern.o
always += task_fd_query_kern.o always-y += task_fd_query_kern.o
always += xdp_sample_pkts_kern.o always-y += xdp_sample_pkts_kern.o
always += ibumad_kern.o always-y += ibumad_kern.o
always += hbm_out_kern.o always-y += hbm_out_kern.o
always += hbm_edt_kern.o always-y += hbm_edt_kern.o
always += xdpsock_kern.o always-y += xdpsock_kern.o
ifeq ($(ARCH), arm) ifeq ($(ARCH), arm)
# Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux # Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux

View File

@ -2,12 +2,8 @@
obj-$(CONFIG_SAMPLE_CONNECTOR) += cn_test.o obj-$(CONFIG_SAMPLE_CONNECTOR) += cn_test.o
# List of programs to build # List of programs to build
ifdef CONFIG_SAMPLE_CONNECTOR hostprogs := ucon
hostprogs-y := ucon always-y := $(hostprogs)
endif
# Tell kbuild to always build the programs
always := $(hostprogs-y)
HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include

View File

@ -1,9 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# List of programs to build # List of programs to build
hostprogs-y := hid-example hostprogs := hid-example
always-y := $(hostprogs)
# Tell kbuild to always build the programs
always := $(hostprogs-y)
HOSTCFLAGS_hid-example.o += -I$(objtree)/usr/include HOSTCFLAGS_hid-example.o += -I$(objtree)/usr/include

View File

@ -1,10 +1,10 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2012-2019, Intel Corporation. All rights reserved. # Copyright (c) 2012-2019, Intel Corporation. All rights reserved.
hostprogs-y := mei-amt-version hostprogs := mei-amt-version
HOSTCFLAGS_mei-amt-version.o += -I$(objtree)/usr/include HOSTCFLAGS_mei-amt-version.o += -I$(objtree)/usr/include
always := $(hostprogs-y) always-y := $(hostprogs)
all: mei-amt-version all: mei-amt-version

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
hostprogs-y := pidfd-metadata hostprogs := pidfd-metadata
always := $(hostprogs-y) always-y := $(hostprogs)
HOSTCFLAGS_pidfd-metadata.o += -I$(objtree)/usr/include HOSTCFLAGS_pidfd-metadata.o += -I$(objtree)/usr/include
all: pidfd-metadata all: pidfd-metadata

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
ifndef CROSS_COMPILE ifndef CROSS_COMPILE
hostprogs-y := bpf-fancy dropper bpf-direct user-trap hostprogs := bpf-fancy dropper bpf-direct user-trap
HOSTCFLAGS_bpf-fancy.o += -I$(objtree)/usr/include HOSTCFLAGS_bpf-fancy.o += -I$(objtree)/usr/include
HOSTCFLAGS_bpf-fancy.o += -idirafter $(objtree)/include HOSTCFLAGS_bpf-fancy.o += -idirafter $(objtree)/include
@ -40,5 +40,5 @@ HOSTLDLIBS_bpf-fancy += $(MFLAG)
HOSTLDLIBS_dropper += $(MFLAG) HOSTLDLIBS_dropper += $(MFLAG)
HOSTLDLIBS_user-trap += $(MFLAG) HOSTLDLIBS_user-trap += $(MFLAG)
endif endif
always := $(hostprogs-y) always-y := $(hostprogs)
endif endif

View File

@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
# List of programs to build # List of programs to build
hostprogs-y := uhid-example hostprogs := uhid-example
# Tell kbuild to always build the programs # Tell kbuild to always build the programs
always := $(hostprogs-y) always-y := $(hostprogs)
HOSTCFLAGS_uhid-example.o += -I$(objtree)/usr/include HOSTCFLAGS_uhid-example.o += -I$(objtree)/usr/include

View File

@ -1,11 +1,10 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
# List of programs to build # List of programs to build
hostprogs-y := \ hostprogs := \
test-fsmount \ test-fsmount \
test-statx test-statx
# Tell kbuild to always build the programs always-y := $(hostprogs)
always := $(hostprogs-y)
HOSTCFLAGS_test-fsmount.o += -I$(objtree)/usr/include HOSTCFLAGS_test-fsmount.o += -I$(objtree)/usr/include
HOSTCFLAGS_test-statx.o += -I$(objtree)/usr/include HOSTCFLAGS_test-statx.o += -I$(objtree)/usr/include

View File

@ -7,14 +7,14 @@
HOST_EXTRACFLAGS += -I$(srctree)/tools/include HOST_EXTRACFLAGS += -I$(srctree)/tools/include
hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c always-$(CONFIG_BUILD_BIN2C) += bin2c
hostprogs-$(CONFIG_KALLSYMS) += kallsyms always-$(CONFIG_KALLSYMS) += kallsyms
hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount always-$(BUILD_C_RECORDMCOUNT) += recordmcount
hostprogs-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
hostprogs-$(CONFIG_ASN1) += asn1_compiler always-$(CONFIG_ASN1) += asn1_compiler
hostprogs-$(CONFIG_MODULE_SIG_FORMAT) += sign-file always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
hostprogs-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert always-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert
hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
@ -30,10 +30,10 @@ HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED
HOSTLDLIBS_sorttable = -lpthread HOSTLDLIBS_sorttable = -lpthread
endif endif
always := $(hostprogs-y) $(hostprogs-m) hostprogs := $(always-y) $(always-m)
# The following hostprogs-y programs are only build on demand # The following programs are only built on demand
hostprogs-y += unifdef hostprogs += unifdef
subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
subdir-$(CONFIG_MODVERSIONS) += genksyms subdir-$(CONFIG_MODVERSIONS) += genksyms

View File

@ -16,6 +16,8 @@ obj-m :=
lib-y := lib-y :=
lib-m := lib-m :=
always := always :=
always-y :=
always-m :=
targets := targets :=
subdir-y := subdir-y :=
subdir-m := subdir-m :=
@ -44,7 +46,7 @@ include $(kbuild-file)
include scripts/Makefile.lib include scripts/Makefile.lib
# Do not include host rules unless needed # Do not include host rules unless needed
ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),) ifneq ($(hostprogs)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),)
include scripts/Makefile.host include scripts/Makefile.host
endif endif
@ -348,7 +350,7 @@ $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
$(call if_changed_rule,as_o_S) $(call if_changed_rule,as_o_S)
targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y) targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y)
targets += $(extra-y) $(MAKECMDGOALS) $(always) targets += $(extra-y) $(always-y) $(MAKECMDGOALS)
# Linker scripts preprocessor (.lds.S -> .lds) # Linker scripts preprocessor (.lds.S -> .lds)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -490,7 +492,7 @@ else
__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
$(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \ $(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \
$(subdir-ym) $(always) $(subdir-ym) $(always-y)
@: @:
endif endif

View File

@ -28,8 +28,8 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
# directory # directory
__clean-files := $(extra-y) $(extra-m) $(extra-) \ __clean-files := $(extra-y) $(extra-m) $(extra-) \
$(always) $(targets) $(clean-files) \ $(always) $(always-y) $(always-m) $(always-) $(targets) $(clean-files) \
$(hostprogs-y) $(hostprogs-m) $(hostprogs-) \ $(hostprogs) $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \
$(hostlibs-y) $(hostlibs-m) $(hostlibs-) \ $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \
$(hostcxxlibs-y) $(hostcxxlibs-m) $(hostcxxlibs-y) $(hostcxxlibs-m)

View File

@ -24,21 +24,21 @@ $(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE
# Both C and C++ are supported, but preferred language is C for such utilities. # Both C and C++ are supported, but preferred language is C for such utilities.
# #
# Sample syntax (see Documentation/kbuild/makefiles.rst for reference) # Sample syntax (see Documentation/kbuild/makefiles.rst for reference)
# hostprogs-y := bin2hex # hostprogs := bin2hex
# Will compile bin2hex.c and create an executable named bin2hex # Will compile bin2hex.c and create an executable named bin2hex
# #
# hostprogs-y := lxdialog # hostprogs := lxdialog
# lxdialog-objs := checklist.o lxdialog.o # lxdialog-objs := checklist.o lxdialog.o
# Will compile lxdialog.c and checklist.c, and then link the executable # Will compile lxdialog.c and checklist.c, and then link the executable
# lxdialog, based on checklist.o and lxdialog.o # lxdialog, based on checklist.o and lxdialog.o
# #
# hostprogs-y := qconf # hostprogs := qconf
# qconf-cxxobjs := qconf.o # qconf-cxxobjs := qconf.o
# qconf-objs := menu.o # qconf-objs := menu.o
# Will compile qconf as a C++ program, and menu as a C program. # Will compile qconf as a C++ program, and menu as a C program.
# They are linked as C++ code to the executable qconf # They are linked as C++ code to the executable qconf
__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) __hostprogs := $(sort $(hostprogs))
host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m)) host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m))
host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m)) host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m))

View File

@ -4,6 +4,8 @@ asflags-y += $(EXTRA_AFLAGS)
ccflags-y += $(EXTRA_CFLAGS) ccflags-y += $(EXTRA_CFLAGS)
cppflags-y += $(EXTRA_CPPFLAGS) cppflags-y += $(EXTRA_CPPFLAGS)
ldflags-y += $(EXTRA_LDFLAGS) ldflags-y += $(EXTRA_LDFLAGS)
always-y += $(always)
hostprogs += $(hostprogs-y) $(hostprogs-m)
# flags that take effect in current and sub directories # flags that take effect in current and sub directories
KBUILD_AFLAGS += $(subdir-asflags-y) KBUILD_AFLAGS += $(subdir-asflags-y)
@ -59,6 +61,8 @@ subdir-obj-y := $(filter %/built-in.a, $(obj-y))
real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))
always-y += $(always-m)
# DTB # DTB
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
extra-y += $(dtb-y) extra-y += $(dtb-y)
@ -72,7 +76,7 @@ endif
# Add subdir path # Add subdir path
extra-y := $(addprefix $(obj)/,$(extra-y)) extra-y := $(addprefix $(obj)/,$(extra-y))
always := $(addprefix $(obj)/,$(always)) always-y := $(addprefix $(obj)/,$(always-y))
targets := $(addprefix $(obj)/,$(targets)) targets := $(addprefix $(obj)/,$(targets))
modorder := $(addprefix $(obj)/,$(modorder)) modorder := $(addprefix $(obj)/,$(modorder))
obj-m := $(addprefix $(obj)/,$(obj-m)) obj-m := $(addprefix $(obj)/,$(obj-m))

View File

@ -2,5 +2,5 @@
# #
# fixdep: used to generate dependency information during build process # fixdep: used to generate dependency information during build process
hostprogs-y := fixdep hostprogs := fixdep
always := $(hostprogs-y) always-y := $(hostprogs)

View File

@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# scripts/dtc makefile # scripts/dtc makefile
hostprogs-$(CONFIG_DTC) := dtc hostprogs := dtc
always := $(hostprogs-y) always-$(CONFIG_DTC) := $(hostprogs)
dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
srcpos.o checks.o util.o srcpos.o checks.o util.o

View File

@ -23,7 +23,7 @@ $(objtree)/$(obj)/randomize_layout_seed.h: FORCE
targets = randomize_layout_seed.h randomize_layout_hash.h targets = randomize_layout_seed.h randomize_layout_hash.h
$(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p))) $(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p)))
always := $($(HOSTLIBS)-y) always-y := $($(HOSTLIBS)-y)
$(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o)) $(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o))

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
hostprogs-y := genksyms hostprogs := genksyms
always := $(hostprogs-y) always-y := $(hostprogs)
genksyms-objs := genksyms.o parse.tab.o lex.lex.o genksyms-objs := genksyms.o parse.tab.o lex.lex.o

View File

@ -33,8 +33,8 @@ struct sym_entry {
unsigned long long addr; unsigned long long addr;
unsigned int len; unsigned int len;
unsigned int start_pos; unsigned int start_pos;
unsigned char *sym;
unsigned int percpu_absolute; unsigned int percpu_absolute;
unsigned char sym[0];
}; };
struct addr_range { struct addr_range {
@ -55,7 +55,7 @@ static struct addr_range percpu_range = {
"__per_cpu_start", "__per_cpu_end", -1ULL, 0 "__per_cpu_start", "__per_cpu_end", -1ULL, 0
}; };
static struct sym_entry *table; static struct sym_entry **table;
static unsigned int table_size, table_cnt; static unsigned int table_size, table_cnt;
static int all_symbols; static int all_symbols;
static int absolute_percpu; static int absolute_percpu;
@ -174,49 +174,55 @@ static void check_symbol_range(const char *sym, unsigned long long addr,
} }
} }
static int read_symbol(FILE *in, struct sym_entry *s) static struct sym_entry *read_symbol(FILE *in)
{ {
char sym[500], stype; char name[500], type;
unsigned long long addr;
unsigned int len;
struct sym_entry *sym;
int rc; int rc;
rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, sym); rc = fscanf(in, "%llx %c %499s\n", &addr, &type, name);
if (rc != 3) { if (rc != 3) {
if (rc != EOF && fgets(sym, 500, in) == NULL) if (rc != EOF && fgets(name, 500, in) == NULL)
fprintf(stderr, "Read error or end of file.\n"); fprintf(stderr, "Read error or end of file.\n");
return -1; return NULL;
} }
if (strlen(sym) >= KSYM_NAME_LEN) { if (strlen(name) >= KSYM_NAME_LEN) {
fprintf(stderr, "Symbol %s too long for kallsyms (%zu >= %d).\n" fprintf(stderr, "Symbol %s too long for kallsyms (%zu >= %d).\n"
"Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n",
sym, strlen(sym), KSYM_NAME_LEN); name, strlen(name), KSYM_NAME_LEN);
return -1; return NULL;
} }
if (is_ignored_symbol(sym, stype)) if (is_ignored_symbol(name, type))
return -1; return NULL;
/* Ignore most absolute/undefined (?) symbols. */ /* Ignore most absolute/undefined (?) symbols. */
if (strcmp(sym, "_text") == 0) if (strcmp(name, "_text") == 0)
_text = s->addr; _text = addr;
check_symbol_range(sym, s->addr, text_ranges, ARRAY_SIZE(text_ranges)); check_symbol_range(name, addr, text_ranges, ARRAY_SIZE(text_ranges));
check_symbol_range(sym, s->addr, &percpu_range, 1); check_symbol_range(name, addr, &percpu_range, 1);
/* include the type field in the symbol name, so that it gets /* include the type field in the symbol name, so that it gets
* compressed together */ * compressed together */
s->len = strlen(sym) + 1;
s->sym = malloc(s->len + 1); len = strlen(name) + 1;
if (!s->sym) {
sym = malloc(sizeof(*sym) + len);
if (!sym) {
fprintf(stderr, "kallsyms failure: " fprintf(stderr, "kallsyms failure: "
"unable to allocate required amount of memory\n"); "unable to allocate required amount of memory\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
strcpy(sym_name(s), sym); sym->addr = addr;
s->sym[0] = stype; sym->len = len;
sym->sym[0] = type;
memcpy(sym_name(sym), name, len);
sym->percpu_absolute = 0;
s->percpu_absolute = 0; return sym;
return 0;
} }
static int symbol_in_range(const struct sym_entry *s, static int symbol_in_range(const struct sym_entry *s,
@ -268,12 +274,12 @@ static void shrink_table(void)
pos = 0; pos = 0;
for (i = 0; i < table_cnt; i++) { for (i = 0; i < table_cnt; i++) {
if (symbol_valid(&table[i])) { if (symbol_valid(table[i])) {
if (pos != i) if (pos != i)
table[pos] = table[i]; table[pos] = table[i];
pos++; pos++;
} else { } else {
free(table[i].sym); free(table[i]);
} }
} }
table_cnt = pos; table_cnt = pos;
@ -287,7 +293,15 @@ static void shrink_table(void)
static void read_map(FILE *in) static void read_map(FILE *in)
{ {
struct sym_entry *sym;
while (!feof(in)) { while (!feof(in)) {
sym = read_symbol(in);
if (!sym)
continue;
sym->start_pos = table_cnt;
if (table_cnt >= table_size) { if (table_cnt >= table_size) {
table_size += 10000; table_size += 10000;
table = realloc(table, sizeof(*table) * table_size); table = realloc(table, sizeof(*table) * table_size);
@ -296,10 +310,8 @@ static void read_map(FILE *in)
exit (1); exit (1);
} }
} }
if (read_symbol(in, &table[table_cnt]) == 0) {
table[table_cnt].start_pos = table_cnt; table[table_cnt++] = sym;
table_cnt++;
}
} }
} }
@ -387,27 +399,27 @@ static void write_src(void)
int overflow; int overflow;
if (!absolute_percpu) { if (!absolute_percpu) {
offset = table[i].addr - relative_base; offset = table[i]->addr - relative_base;
overflow = (offset < 0 || offset > UINT_MAX); overflow = (offset < 0 || offset > UINT_MAX);
} else if (symbol_absolute(&table[i])) { } else if (symbol_absolute(table[i])) {
offset = table[i].addr; offset = table[i]->addr;
overflow = (offset < 0 || offset > INT_MAX); overflow = (offset < 0 || offset > INT_MAX);
} else { } else {
offset = relative_base - table[i].addr - 1; offset = relative_base - table[i]->addr - 1;
overflow = (offset < INT_MIN || offset >= 0); overflow = (offset < INT_MIN || offset >= 0);
} }
if (overflow) { if (overflow) {
fprintf(stderr, "kallsyms failure: " fprintf(stderr, "kallsyms failure: "
"%s symbol value %#llx out of range in relative mode\n", "%s symbol value %#llx out of range in relative mode\n",
symbol_absolute(&table[i]) ? "absolute" : "relative", symbol_absolute(table[i]) ? "absolute" : "relative",
table[i].addr); table[i]->addr);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
printf("\t.long\t%#x\n", (int)offset); printf("\t.long\t%#x\n", (int)offset);
} else if (!symbol_absolute(&table[i])) { } else if (!symbol_absolute(table[i])) {
output_address(table[i].addr); output_address(table[i]->addr);
} else { } else {
printf("\tPTR\t%#llx\n", table[i].addr); printf("\tPTR\t%#llx\n", table[i]->addr);
} }
} }
printf("\n"); printf("\n");
@ -437,12 +449,12 @@ static void write_src(void)
if ((i & 0xFF) == 0) if ((i & 0xFF) == 0)
markers[i >> 8] = off; markers[i >> 8] = off;
printf("\t.byte 0x%02x", table[i].len); printf("\t.byte 0x%02x", table[i]->len);
for (k = 0; k < table[i].len; k++) for (k = 0; k < table[i]->len; k++)
printf(", 0x%02x", table[i].sym[k]); printf(", 0x%02x", table[i]->sym[k]);
printf("\n"); printf("\n");
off += table[i].len + 1; off += table[i]->len + 1;
} }
printf("\n"); printf("\n");
@ -496,7 +508,7 @@ static void build_initial_tok_table(void)
unsigned int i; unsigned int i;
for (i = 0; i < table_cnt; i++) for (i = 0; i < table_cnt; i++)
learn_symbol(table[i].sym, table[i].len); learn_symbol(table[i]->sym, table[i]->len);
} }
static unsigned char *find_token(unsigned char *str, int len, static unsigned char *find_token(unsigned char *str, int len,
@ -520,15 +532,15 @@ static void compress_symbols(const unsigned char *str, int idx)
for (i = 0; i < table_cnt; i++) { for (i = 0; i < table_cnt; i++) {
len = table[i].len; len = table[i]->len;
p1 = table[i].sym; p1 = table[i]->sym;
/* find the token on the symbol */ /* find the token on the symbol */
p2 = find_token(p1, len, str); p2 = find_token(p1, len, str);
if (!p2) continue; if (!p2) continue;
/* decrease the counts for this symbol's tokens */ /* decrease the counts for this symbol's tokens */
forget_symbol(table[i].sym, len); forget_symbol(table[i]->sym, len);
size = len; size = len;
@ -547,10 +559,10 @@ static void compress_symbols(const unsigned char *str, int idx)
} while (p2); } while (p2);
table[i].len = len; table[i]->len = len;
/* increase the counts for this symbol's new tokens */ /* increase the counts for this symbol's new tokens */
learn_symbol(table[i].sym, len); learn_symbol(table[i]->sym, len);
} }
} }
@ -606,8 +618,8 @@ static void insert_real_symbols_in_table(void)
unsigned int i, j, c; unsigned int i, j, c;
for (i = 0; i < table_cnt; i++) { for (i = 0; i < table_cnt; i++) {
for (j = 0; j < table[i].len; j++) { for (j = 0; j < table[i]->len; j++) {
c = table[i].sym[j]; c = table[i]->sym[j];
best_table[c][0]=c; best_table[c][0]=c;
best_table_len[c]=1; best_table_len[c]=1;
} }
@ -660,13 +672,10 @@ static int may_be_linker_script_provide_symbol(const struct sym_entry *se)
static int compare_symbols(const void *a, const void *b) static int compare_symbols(const void *a, const void *b)
{ {
const struct sym_entry *sa; const struct sym_entry *sa = *(const struct sym_entry **)a;
const struct sym_entry *sb; const struct sym_entry *sb = *(const struct sym_entry **)b;
int wa, wb; int wa, wb;
sa = a;
sb = b;
/* sort by address first */ /* sort by address first */
if (sa->addr > sb->addr) if (sa->addr > sb->addr)
return 1; return 1;
@ -697,7 +706,7 @@ static int compare_symbols(const void *a, const void *b)
static void sort_symbols(void) static void sort_symbols(void)
{ {
qsort(table, table_cnt, sizeof(struct sym_entry), compare_symbols); qsort(table, table_cnt, sizeof(table[0]), compare_symbols);
} }
static void make_percpus_absolute(void) static void make_percpus_absolute(void)
@ -705,14 +714,14 @@ static void make_percpus_absolute(void)
unsigned int i; unsigned int i;
for (i = 0; i < table_cnt; i++) for (i = 0; i < table_cnt; i++)
if (symbol_in_range(&table[i], &percpu_range, 1)) { if (symbol_in_range(table[i], &percpu_range, 1)) {
/* /*
* Keep the 'A' override for percpu symbols to * Keep the 'A' override for percpu symbols to
* ensure consistent behavior compared to older * ensure consistent behavior compared to older
* versions of this tool. * versions of this tool.
*/ */
table[i].sym[0] = 'A'; table[i]->sym[0] = 'A';
table[i].percpu_absolute = 1; table[i]->percpu_absolute = 1;
} }
} }
@ -722,12 +731,12 @@ static void record_relative_base(void)
unsigned int i; unsigned int i;
for (i = 0; i < table_cnt; i++) for (i = 0; i < table_cnt; i++)
if (!symbol_absolute(&table[i])) { if (!symbol_absolute(table[i])) {
/* /*
* The table is sorted by address. * The table is sorted by address.
* Take the first non-absolute symbol value. * Take the first non-absolute symbol value.
*/ */
relative_base = table[i].addr; relative_base = table[i]->addr;
return; return;
} }
} }

View File

@ -157,11 +157,11 @@ HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src)
HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src) HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src)
# conf: Used for defconfig, oldconfig and related targets # conf: Used for defconfig, oldconfig and related targets
hostprogs-y += conf hostprogs += conf
conf-objs := conf.o $(common-objs) conf-objs := conf.o $(common-objs)
# nconf: Used for the nconfig target based on ncurses # nconf: Used for the nconfig target based on ncurses
hostprogs-y += nconf hostprogs += nconf
nconf-objs := nconf.o nconf.gui.o $(common-objs) nconf-objs := nconf.o nconf.gui.o $(common-objs)
HOSTLDLIBS_nconf = $(shell . $(obj)/nconf-cfg && echo $$libs) HOSTLDLIBS_nconf = $(shell . $(obj)/nconf-cfg && echo $$libs)
@ -171,7 +171,7 @@ HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/nconf-cfg && echo $$cflags)
$(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg
# mconf: Used for the menuconfig target based on lxdialog # mconf: Used for the menuconfig target based on lxdialog
hostprogs-y += mconf hostprogs += mconf
lxdialog := $(addprefix lxdialog/, \ lxdialog := $(addprefix lxdialog/, \
checklist.o inputbox.o menubox.o textbox.o util.o yesno.o) checklist.o inputbox.o menubox.o textbox.o util.o yesno.o)
mconf-objs := mconf.o $(lxdialog) $(common-objs) mconf-objs := mconf.o $(lxdialog) $(common-objs)
@ -183,7 +183,7 @@ $(foreach f, mconf.o $(lxdialog), \
$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg $(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg
# qconf: Used for the xconfig target based on Qt # qconf: Used for the xconfig target based on Qt
hostprogs-y += qconf hostprogs += qconf
qconf-cxxobjs := qconf.o qconf-cxxobjs := qconf.o
qconf-objs := images.o $(common-objs) qconf-objs := images.o $(common-objs)
@ -199,7 +199,7 @@ $(obj)/%.moc: $(src)/%.h $(obj)/qconf-cfg
$(call cmd,moc) $(call cmd,moc)
# gconf: Used for the gconfig target based on GTK+ # gconf: Used for the gconfig target based on GTK+
hostprogs-y += gconf hostprogs += gconf
gconf-objs := gconf.o images.o $(common-objs) gconf-objs := gconf.o images.o $(common-objs)
HOSTLDLIBS_gconf = $(shell . $(obj)/gconf-cfg && echo $$libs) HOSTLDLIBS_gconf = $(shell . $(obj)/gconf-cfg && echo $$libs)

View File

@ -1312,7 +1312,7 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode)
sym_calc_value(csym); sym_calc_value(csym);
if (mode == def_random) if (mode == def_random)
has_changed = randomize_choice_values(csym); has_changed |= randomize_choice_values(csym);
else { else {
set_all_choice_values(csym); set_all_choice_values(csym);
has_changed = true; has_changed = true;
@ -1331,9 +1331,8 @@ void conf_rewrite_mod_or_yes(enum conf_def_mode mode)
for_all_symbols(i, sym) { for_all_symbols(i, sym) {
if (sym_get_type(sym) == S_TRISTATE && if (sym_get_type(sym) == S_TRISTATE &&
sym->def[S_DEF_USER].tri == old_val) { sym->def[S_DEF_USER].tri == old_val)
sym->def[S_DEF_USER].tri = new_val; sym->def[S_DEF_USER].tri = new_val;
sym_add_change_count(1);
}
} }
sym_clear_all_valid();
} }

View File

@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
OBJECT_FILES_NON_STANDARD := y OBJECT_FILES_NON_STANDARD := y
hostprogs-y := modpost mk_elfconfig hostprogs := modpost mk_elfconfig
always := $(hostprogs-y) empty.o always-y := $(hostprogs) empty.o
modpost-objs := modpost.o file2alias.o sumversion.o modpost-objs := modpost.o file2alias.o sumversion.o

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
hostprogs-y := genheaders hostprogs := genheaders
HOST_EXTRACFLAGS += \ HOST_EXTRACFLAGS += \
-I$(srctree)/include/uapi -I$(srctree)/include \ -I$(srctree)/include/uapi -I$(srctree)/include \
-I$(srctree)/security/selinux/include -I$(srctree)/security/selinux/include
always := $(hostprogs-y) always-y := $(hostprogs)

View File

@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
hostprogs-y := mdp hostprogs := mdp
HOST_EXTRACFLAGS += \ HOST_EXTRACFLAGS += \
-I$(srctree)/include/uapi -I$(srctree)/include \ -I$(srctree)/include/uapi -I$(srctree)/include \
-I$(srctree)/security/selinux/include -I$(objtree)/include -I$(srctree)/security/selinux/include -I$(objtree)/include
always := $(hostprogs-y) always-y := $(hostprogs)
clean-files := policy.* file_contexts clean-files := policy.* file_contexts

View File

@ -52,7 +52,7 @@ ifeq ($(cpio-data),)
cpio-data := $(obj)/initramfs_data.cpio cpio-data := $(obj)/initramfs_data.cpio
hostprogs-y := gen_init_cpio hostprogs := gen_init_cpio
# .initramfs_data.cpio.d is used to identify all files included # .initramfs_data.cpio.d is used to identify all files included
# in initramfs and to detect if any files are added/removed. # in initramfs and to detect if any files are added/removed.