Skip to content

Commit

Permalink
Merge tag 'kbuild-v5.3-2' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/masahiroy/linux-kbuild

Pull more Kbuild updates from Masahiro Yamada:

 - match the directory structure of the linux-libc-dev package to that
   of Debian-based distributions

 - fix incorrect include/config/auto.conf generation when Kconfig
   creates it along with the .config file

 - remove misleading $(AS) from documents

 - clean up precious tag files by distclean instead of mrproper

 - add a new coccinelle patch for devm_platform_ioremap_resource
   migration

 - refactor module-related scripts to read modules.order instead of
   $(MODVERDIR)/*.mod files to get the list of created modules

 - remove MODVERDIR

 - update list of header compile-test

 - add -fcf-protection=none flag to avoid conflict with the retpoline
   flags when CONFIG_RETPOLINE=y

 - misc cleanups

* tag 'kbuild-v5.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (25 commits)
  kbuild: add -fcf-protection=none when using retpoline flags
  kbuild: update compile-test header list for v5.3-rc1
  kbuild: split out *.mod out of {single,multi}-used-m rules
  kbuild: remove 'prepare1' target
  kbuild: remove the first line of *.mod files
  kbuild: create *.mod with full directory path and remove MODVERDIR
  kbuild: export_report: read modules.order instead of .tmp_versions/*.mod
  kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod
  kbuild: modsign: read modules.order instead of $(MODVERDIR)/*.mod
  kbuild: modinst: read modules.order instead of $(MODVERDIR)/*.mod
  scsi: remove pointless $(MODVERDIR)/$(obj)/53c700.ver
  kbuild: remove duplication from modules.order in sub-directories
  kbuild: get rid of kernel/ prefix from in-tree modules.{order,builtin}
  kbuild: do not create empty modules.order in the prepare stage
  coccinelle: api: add devm_platform_ioremap_resource script
  kbuild: compile-test headers listed in header-test-m as well
  kbuild: remove unused hostcc-option
  kbuild: remove tag files by distclean instead of mrproper
  kbuild: add --hash-style= and --build-id unconditionally
  kbuild: get rid of misleading $(AS) from documents
  ...
  • Loading branch information
torvalds committed Jul 20, 2019
2 parents 18253e0 + 29be86d commit 168c799
Show file tree
Hide file tree
Showing 36 changed files with 178 additions and 173 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*.lz4
*.lzma
*.lzo
*.mod
*.mod.c
*.o
*.o.*
Expand Down
1 change: 1 addition & 0 deletions Documentation/dontdiff
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*.lzo
*.mo
*.moc
*.mod
*.mod.c
*.o
*.o.*
Expand Down
5 changes: 2 additions & 3 deletions Documentation/kbuild/kbuild.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ Additional options to the assembler (for built-in and modules).

AFLAGS_MODULE
-------------
Additional module specific options to use for $(AS).
Additional assembler options for modules.

AFLAGS_KERNEL
-------------
Additional options for $(AS) when used for assembler
code for code that is compiled as built-in.
Additional assembler options for built-in.

KCFLAGS
-------
Expand Down
12 changes: 6 additions & 6 deletions Documentation/kbuild/makefiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ more details, with real examples.
variable $(KBUILD_CFLAGS) and uses it for compilation flags for the
entire tree.

asflags-y specifies options for assembling with $(AS).
asflags-y specifies assembler options.

Example::

Expand Down Expand Up @@ -490,7 +490,7 @@ more details, with real examples.
as-instr checks if the assembler reports a specific instruction
and then outputs either option1 or option2
C escapes are supported in the test instruction
Note: as-instr-option uses KBUILD_AFLAGS for $(AS) options
Note: as-instr-option uses KBUILD_AFLAGS for assembler options

cc-option
cc-option is used to check if $(CC) supports a given option, and if
Expand Down Expand Up @@ -906,7 +906,7 @@ When kbuild executes, the following steps are followed (roughly):
vmlinux. The usage of $(call if_changed,xxx) will be described later.

KBUILD_AFLAGS
$(AS) assembler flags
Assembler flags

Default value - see top level Makefile
Append or modify as required per architecture.
Expand Down Expand Up @@ -949,16 +949,16 @@ When kbuild executes, the following steps are followed (roughly):
to 'y' when selected.

KBUILD_AFLAGS_KERNEL
$(AS) options specific for built-in
Assembler options specific for built-in

$(KBUILD_AFLAGS_KERNEL) contains extra C compiler flags used to compile
resident kernel code.

KBUILD_AFLAGS_MODULE
Options for $(AS) when building modules
Assembler options specific for modules

$(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that
are used for $(AS).
are used for assembler.

From commandline AFLAGS_MODULE shall be used (see kbuild.txt).

Expand Down
61 changes: 28 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,6 @@ export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
export KBUILD_ARFLAGS

# When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might
# even be read-only.
export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions

# Files to ignore in find ... statements

export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
Expand Down Expand Up @@ -887,6 +882,12 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
# change __FILE__ to the relative path from the srctree
KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)

# ensure -fcf-protection is disabled when using retpoline as it is
# incompatible with -mindirect-branch=thunk-extern
ifdef CONFIG_RETPOLINE
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
endif

# use the deterministic mode of AR if available
KBUILD_ARFLAGS := $(call ar-option,D)

Expand All @@ -900,10 +901,8 @@ KBUILD_CPPFLAGS += $(ARCH_CPPFLAGS) $(KCPPFLAGS)
KBUILD_AFLAGS += $(ARCH_AFLAGS) $(KAFLAGS)
KBUILD_CFLAGS += $(ARCH_CFLAGS) $(KCFLAGS)

# Use --build-id when available.
LDFLAGS_BUILD_ID := $(call ld-option, --build-id)
KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
KBUILD_LDFLAGS_MODULE += --build-id
LDFLAGS_vmlinux += --build-id

ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
LDFLAGS_vmlinux += $(call ld-option, -X,)
Expand Down Expand Up @@ -1031,8 +1030,8 @@ vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)

# Recurse until adjust_autoksyms.sh is satisfied
PHONY += autoksyms_recursive
autoksyms_recursive: $(vmlinux-deps)
ifdef CONFIG_TRIM_UNUSED_KSYMS
autoksyms_recursive: $(vmlinux-deps) modules.order
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
"$(MAKE) -f $(srctree)/Makefile vmlinux"
endif
Expand Down Expand Up @@ -1074,7 +1073,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;

PHONY += $(vmlinux-dirs)
$(vmlinux-dirs): prepare
$(Q)$(MAKE) $(build)=$@ need-builtin=1
$(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1

filechk_kernel.release = \
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
Expand All @@ -1096,7 +1095,7 @@ scripts: scripts_basic scripts_dtc
# archprepare is used in arch Makefiles and when processed asm symlink,
# version.h and scripts_basic is processed / created.

PHONY += prepare archprepare prepare1 prepare3
PHONY += prepare archprepare prepare3

# prepare3 is used to check if we are building in a separate output directory,
# and if so do:
Expand All @@ -1113,11 +1112,8 @@ ifdef building_out_of_srctree
fi;
endif

prepare1: prepare3 outputmakefile asm-generic $(version_h) $(autoksyms_h) \
include/generated/utsrelease.h
$(cmd_crmodverdir)

archprepare: archheaders archscripts prepare1 scripts
archprepare: archheaders archscripts scripts prepare3 outputmakefile \
asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h

prepare0: archprepare
$(Q)$(MAKE) $(build)=scripts/mod
Expand Down Expand Up @@ -1331,8 +1327,8 @@ _modinst_:
rm -f $(MODLIB)/build ; \
ln -s $(CURDIR) $(MODLIB)/build ; \
fi
@cp -f $(objtree)/modules.order $(MODLIB)/
@cp -f $(objtree)/modules.builtin $(MODLIB)/
@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
@sed 's:^:kernel/:' modules.builtin > $(MODLIB)/modules.builtin
@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst

Expand Down Expand Up @@ -1373,18 +1369,22 @@ endif # CONFIG_MODULES
# make distclean Remove editor backup files, patch leftover files and the like

# Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR) include/ksym
CLEAN_DIRS += include/ksym
CLEAN_FILES += modules.builtin.modinfo

# Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config include/generated \
arch/$(SRCARCH)/include/generated .tmp_objdiff
MRPROPER_FILES += .config .config.old .version \
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
Module.symvers \
signing_key.pem signing_key.priv signing_key.x509 \
x509.genkey extra_certificates signing_key.x509.keyid \
signing_key.x509.signer vmlinux-gdb.py

# Directories & files removed with 'make distclean'
DISTCLEAN_DIRS +=
DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS

# clean - Delete most, but leave enough to build external modules
#
clean: rm-dirs := $(CLEAN_DIRS)
Expand Down Expand Up @@ -1417,9 +1417,14 @@ mrproper: clean $(mrproper-dirs)

# distclean
#
distclean: rm-dirs := $(wildcard $(DISTCLEAN_DIRS))
distclean: rm-files := $(wildcard $(DISTCLEAN_FILES))

PHONY += distclean

distclean: mrproper
$(call cmd,rmdirs)
$(call cmd,rmfiles)
@find $(srctree) $(RCS_FIND_IGNORE) \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '*%' \
Expand Down Expand Up @@ -1609,7 +1614,7 @@ $(objtree)/Module.symvers:
module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
PHONY += $(module-dirs) modules
$(module-dirs): prepare $(objtree)/Module.symvers
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) need-modorder=1

modules: $(module-dirs)
@$(kecho) ' Building modules, stage 2.';
Expand All @@ -1634,7 +1639,6 @@ PHONY += $(clean-dirs) clean
$(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)

clean: rm-dirs := $(MODVERDIR)
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers

PHONY += help
Expand All @@ -1648,8 +1652,6 @@ help:
@echo ''

PHONY += prepare
prepare:
$(cmd_crmodverdir)
endif # KBUILD_EXTMOD

clean: $(clean-dirs)
Expand All @@ -1660,7 +1662,7 @@ clean: $(clean-dirs)
-o -name '*.ko.*' \
-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
-o -name '*.dwo' -o -name '*.lst' \
-o -name '*.su' \
-o -name '*.su' -o -name '*.mod' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.lex.c' -o -name '*.tab.[ch]' \
-o -name '*.asn1.[ch]' \
Expand Down Expand Up @@ -1765,8 +1767,6 @@ build-dir = $(patsubst %/,%,$(dir $(build-target)))
$(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
%.symtypes: prepare FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
%.ko: %.o
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost

# Modules
PHONY += /
Expand All @@ -1789,11 +1789,6 @@ quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
$(KERNELRELEASE)

# Create temporary dir for module support files
# clean it up only when building all modules
cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
$(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)

# read saved command lines for existing targets
existing-targets := $(wildcard $(sort $(targets)))

Expand Down
3 changes: 1 addition & 2 deletions arch/arm/vdso/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ ccflags-y += -DDISABLE_BRANCH_PROFILING
ldflags-$(CONFIG_CPU_ENDIAN_BE8) := --be8
ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
-z max-page-size=4096 -nostdlib -shared $(ldflags-y) \
$(call ld-option, --hash-style=sysv) \
$(call ld-option, --build-id) \
--hash-style=sysv --build-id \
-T

obj-$(CONFIG_VDSO) += vdso.o
Expand Down
4 changes: 2 additions & 2 deletions arch/arm64/kernel/vdso32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ VDSO_LDFLAGS := $(VDSO_CPPFLAGS)
VDSO_LDFLAGS += -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1
VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
VDSO_LDFLAGS += -nostdlib -shared -mfloat-abi=soft
VDSO_LDFLAGS += $(call cc32-ldoption,-Wl$(comma)--hash-style=sysv)
VDSO_LDFLAGS += $(call cc32-ldoption,-Wl$(comma)--build-id)
VDSO_LDFLAGS += -Wl,--hash-style=sysv
VDSO_LDFLAGS += -Wl,--build-id
VDSO_LDFLAGS += $(call cc32-ldoption,-fuse-ld=bfd)


Expand Down
2 changes: 0 additions & 2 deletions arch/riscv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ else
KBUILD_LDFLAGS += -melf32lriscv
endif

KBUILD_CFLAGS += -Wall

# ISA string setting
riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima
riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima
Expand Down
3 changes: 1 addition & 2 deletions arch/sparc/vdso/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ quiet_cmd_vdso = VDSO $@
-T $(filter %.lds,$^) $(filter %.o,$^) && \
sh $(srctree)/$(src)/checkundef.sh '$(OBJDUMP)' '$@'

VDSO_LDFLAGS = -shared $(call ld-option, --hash-style=both) \
$(call ld-option, --build-id) -Bsymbolic
VDSO_LDFLAGS = -shared --hash-style=both --build-id -Bsymbolic
GCOV_PROFILE := n

#
Expand Down
5 changes: 2 additions & 3 deletions arch/x86/entry/vdso/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ quiet_cmd_vdso = VDSO $@
-T $(filter %.lds,$^) $(filter %.o,$^) && \
sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'

VDSO_LDFLAGS = -shared $(call ld-option, --hash-style=both) \
$(call ld-option, --build-id) $(call ld-option, --eh-frame-hdr) \
-Bsymbolic
VDSO_LDFLAGS = -shared --hash-style=both --build-id \
$(call ld-option, --eh-frame-hdr) -Bsymbolic
GCOV_PROFILE := n

quiet_cmd_vdso_and_check = VDSO $@
Expand Down
1 change: 1 addition & 0 deletions drivers/memory/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ti-emif-asm-offsets.h
5 changes: 3 additions & 2 deletions drivers/memory/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ ti-emif-sram-objs := ti-emif-pm.o ti-emif-sram-pm.o

AFLAGS_ti-emif-sram-pm.o :=-Wa,-march=armv7-a

drivers/memory/ti-emif-sram-pm.o: include/generated/ti-emif-asm-offsets.h
$(obj)/ti-emif-sram-pm.o: $(obj)/ti-emif-asm-offsets.h

include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s FORCE
$(obj)/ti-emif-asm-offsets.h: $(obj)/emif-asm-offsets.s FORCE
$(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__)

targets += emif-asm-offsets.s
clean-files += ti-emif-asm-offsets.h
2 changes: 1 addition & 1 deletion drivers/memory/ti-emif-sram-pm.S
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* GNU General Public License for more details.
*/

#include <generated/ti-emif-asm-offsets.h>
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <asm/memory.h>

#include "emif.h"
#include "ti-emif-asm-offsets.h"

#define EMIF_POWER_MGMT_WAIT_SELF_REFRESH_8192_CYCLES 0x00a0
#define EMIF_POWER_MGMT_SR_TIMER_MASK 0x00f0
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ zalon7xx-objs := zalon.o ncr53c8xx.o
# Files generated that shall be removed upon make clean
clean-files := 53c700_d.h 53c700_u.h scsi_devinfo_tbl.c

$(obj)/53c700.o $(MODVERDIR)/$(obj)/53c700.ver: $(obj)/53c700_d.h
$(obj)/53c700.o: $(obj)/53c700_d.h

$(obj)/scsi_sysfs.o: $(obj)/scsi_devinfo_tbl.c

Expand Down
Loading

0 comments on commit 168c799

Please sign in to comment.