1
0
Fork 0

Kbuild updates for v4.19 (2nd)

- add build_{menu,n,g,x}config targets for compile-testing Kconfig
 
  - fix and improve recursive dependency detection in Kconfig
 
  - fix parallel building of menuconfig/nconfig
 
  - fix syntax error in clang-version.sh
 
  - suppress distracting log from syncconfig
 
  - remove obsolete "rpm" target
 
  - remove VMLINUX_SYMBOL(_STR) macro entirely
 
  - fix microblaze build with CONFIG_DYNAMIC_FTRACE
 
  - move compiler test for dead code/data elimination to Kconfig
 
  - rename well-known LDFLAGS variable to KBUILD_LDFLAGS
 
  - misc fixes and cleanups
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJbgYhCAAoJED2LAQed4NsGErAP/jt7gt76+N0PZmADBZqyVR/H
 4k286g3OiT7DIcdvwqE5BRvu+zNOamDujnnXw63/jwu2RjrkLX/JnhzTbC0IZleZ
 KeO4bU4ZH0WFa0Ny9pp0LAnzbXGMnQjDXygcUd5BFoEd5JSLKW2PISEEjRh6b5B7
 swJRdgySFaMrUBRNf13FwH5EvX/D0xZQe/wFhFCOv6L4gJZFMmpGUIepgTjTUmxZ
 wcNN6xxXg+ulLHVcPdPQ9EYssNHN5xNys02+IdIrhhXuNHji/TFm4dGYuU+dDGeE
 Eu4O6Qs7pg0PFGrZ5gLxXDJEp75W+uaTNOqV+jcjq8MRxJuWxyy2biUeelKRT/KH
 0iv4ZQJVOMOhl8fZgLtQaXHyQ++5uwd6kvPPf+XFdkogGAIXK0wKWLoALFEOXwb6
 z1BBnFx09LrKPGt0ZlKX624OEczedv/UAFiSh3Ic2S3PFEpq4oHrEGhTnyKRobPv
 OEcF3RqKjmAdK7PLy4kVpTLhkutkWWhw6Giy9qXUkXYJWonJR7NTQ1mIan2LoGZC
 sGi+qKae/8xgO2Nerx59tZpkiHYTMfYeAo8frzWurOxm3YzEfaxNNGPl+IMW7VKz
 cNPzQZ5tMUy4i4PAhk/gIWibnUTPfjDbWsZSMtIbO0GFcao56EvllwD8/awuy7lO
 QkaAeZHFcF+qgU3muaYK
 =Vsb2
 -----END PGP SIGNATURE-----

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

Pull more Kbuild updates from Masahiro Yamada:

 - add build_{menu,n,g,x}config targets for compile-testing Kconfig

 - fix and improve recursive dependency detection in Kconfig

 - fix parallel building of menuconfig/nconfig

 - fix syntax error in clang-version.sh

 - suppress distracting log from syncconfig

 - remove obsolete "rpm" target

 - remove VMLINUX_SYMBOL(_STR) macro entirely

 - fix microblaze build with CONFIG_DYNAMIC_FTRACE

 - move compiler test for dead code/data elimination to Kconfig

 - rename well-known LDFLAGS variable to KBUILD_LDFLAGS

 - misc fixes and cleanups

* tag 'kbuild-v4.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: rename LDFLAGS to KBUILD_LDFLAGS
  kbuild: pass LDFLAGS to recordmcount.pl
  kbuild: test dead code/data elimination support in Kconfig
  initramfs: move gen_initramfs_list.sh from scripts/ to usr/
  vmlinux.lds.h: remove stale <linux/export.h> include
  export.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR()
  Coccinelle: remove pci_alloc_consistent semantic to detect in zalloc-simple.cocci
  kbuild: make sorting initramfs contents independent of locale
  kbuild: remove "rpm" target, which is alias of "rpm-pkg"
  kbuild: Fix LOADLIBES rename in Documentation/kbuild/makefiles.txt
  kconfig: suppress "configuration written to .config" for syncconfig
  kconfig: fix "Can't open ..." in parallel build
  kbuild: Add a space after `!` to prevent parsing as file pattern
  scripts: modpost: check memory allocation results
  kconfig: improve the recursive dependency report
  kconfig: report recursive dependency involving 'imply'
  kconfig: error out when seeing recursive dependency
  kconfig: add build-only configurator targets
  scripts/dtc: consolidate include path options in Makefile
hifive-unleashed-5.1
Linus Torvalds 2018-08-25 13:40:38 -07:00
commit 1bc276775d
52 changed files with 189 additions and 210 deletions

View File

@ -66,17 +66,17 @@ early userspace image can be built by an unprivileged user.
As a technical note, when directories and files are specified, the As a technical note, when directories and files are specified, the
entire CONFIG_INITRAMFS_SOURCE is passed to entire CONFIG_INITRAMFS_SOURCE is passed to
scripts/gen_initramfs_list.sh. This means that CONFIG_INITRAMFS_SOURCE usr/gen_initramfs_list.sh. This means that CONFIG_INITRAMFS_SOURCE
can really be interpreted as any legal argument to can really be interpreted as any legal argument to
gen_initramfs_list.sh. If a directory is specified as an argument then gen_initramfs_list.sh. If a directory is specified as an argument then
the contents are scanned, uid/gid translation is performed, and the contents are scanned, uid/gid translation is performed, and
usr/gen_init_cpio file directives are output. If a directory is usr/gen_init_cpio file directives are output. If a directory is
specified as an argument to scripts/gen_initramfs_list.sh then the specified as an argument to usr/gen_initramfs_list.sh then the
contents of the file are simply copied to the output. All of the output contents of the file are simply copied to the output. All of the output
directives from directory scanning and file contents copying are directives from directory scanning and file contents copying are
processed by usr/gen_init_cpio. processed by usr/gen_init_cpio.
See also 'scripts/gen_initramfs_list.sh -h'. See also 'usr/gen_initramfs_list.sh -h'.
Where's this all leading? Where's this all leading?
========================= =========================

View File

@ -164,7 +164,7 @@ Documentation/early-userspace/README for more details.)
The kernel does not depend on external cpio tools. If you specify a The kernel does not depend on external cpio tools. If you specify a
directory instead of a configuration file, the kernel's build infrastructure directory instead of a configuration file, the kernel's build infrastructure
creates a configuration file from that directory (usr/Makefile calls creates a configuration file from that directory (usr/Makefile calls
scripts/gen_initramfs_list.sh), and proceeds to package up that directory usr/gen_initramfs_list.sh), and proceeds to package up that directory
using the config file (by feeding it to usr/gen_init_cpio, which is created using the config file (by feeding it to usr/gen_init_cpio, which is created
from usr/gen_init_cpio.c). The kernel's build-time cpio creation code is from usr/gen_init_cpio.c). The kernel's build-time cpio creation code is
entirely self-contained, and the kernel's boot-time extractor is also entirely self-contained, and the kernel's boot-time extractor is also

View File

@ -545,7 +545,7 @@ make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
Practical solutions to kconfig recursive issue Practical solutions to kconfig recursive issue
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Developers who run into the recursive Kconfig issue have three options Developers who run into the recursive Kconfig issue have two options
at their disposal. We document them below and also provide a list of at their disposal. We document them below and also provide a list of
historical issues resolved through these different solutions. historical issues resolved through these different solutions.
@ -553,7 +553,6 @@ historical issues resolved through these different solutions.
b) Match dependency semantics: b) Match dependency semantics:
b1) Swap all "select FOO" to "depends on FOO" or, b1) Swap all "select FOO" to "depends on FOO" or,
b2) Swap all "depends on FOO" to "select FOO" b2) Swap all "depends on FOO" to "select FOO"
c) Consider the use of "imply" instead of "select"
The resolution to a) can be tested with the sample Kconfig file The resolution to a) can be tested with the sample Kconfig file
Documentation/kbuild/Kconfig.recursion-issue-01 through the removal Documentation/kbuild/Kconfig.recursion-issue-01 through the removal

View File

@ -680,7 +680,7 @@ Both possibilities are described in the following.
Example: Example:
#scripts/kconfig/Makefile #scripts/kconfig/Makefile
HOSTLOADLIBES_qconf := -L$(QTDIR)/lib HOSTLDLIBS_qconf := -L$(QTDIR)/lib
When linking qconf, it will be passed the extra option When linking qconf, it will be passed the extra option
"-L$(QTDIR)/lib". "-L$(QTDIR)/lib".

View File

@ -440,7 +440,7 @@ KBUILD_CFLAGS_KERNEL :=
KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_AFLAGS_MODULE := -DMODULE
KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
LDFLAGS := KBUILD_LDFLAGS :=
GCC_PLUGINS_CFLAGS := GCC_PLUGINS_CFLAGS :=
export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
@ -448,7 +448,7 @@ export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
@ -790,8 +790,8 @@ KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
endif endif
ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
KBUILD_CFLAGS_KERNEL += $(call cc-option,-ffunction-sections,) KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
KBUILD_CFLAGS_KERNEL += $(call cc-option,-fdata-sections,) LDFLAGS_vmlinux += --gc-sections
endif endif
# arch Makefile may override CC so keep this after arch Makefile is included # arch Makefile may override CC so keep this after arch Makefile is included
@ -857,10 +857,6 @@ LDFLAGS_BUILD_ID := $(call ld-option, --build-id)
KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
LDFLAGS_vmlinux += $(call ld-option, --gc-sections,)
endif
ifeq ($(CONFIG_STRIP_ASM_SYMS),y) ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
LDFLAGS_vmlinux += $(call ld-option, -X,) LDFLAGS_vmlinux += $(call ld-option, -X,)
endif endif
@ -1024,7 +1020,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
# Final link of vmlinux with optional arch pass after final link # Final link of vmlinux with optional arch pass after final link
cmd_link-vmlinux = \ cmd_link-vmlinux = \
$(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ; \ $(CONFIG_SHELL) $< $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) ; \
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
@ -1354,16 +1350,12 @@ distclean: mrproper
# Packaging of the kernel to various formats # Packaging of the kernel to various formats
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# rpm target kept for backward compatibility
package-dir := scripts/package package-dir := scripts/package
%src-pkg: FORCE %src-pkg: FORCE
$(Q)$(MAKE) $(build)=$(package-dir) $@ $(Q)$(MAKE) $(build)=$(package-dir) $@
%pkg: include/config/kernel.release FORCE %pkg: include/config/kernel.release FORCE
$(Q)$(MAKE) $(build)=$(package-dir) $@ $(Q)$(MAKE) $(build)=$(package-dir) $@
rpm: rpm-pkg
@echo " WARNING: \"rpm\" target will be removed after Linux 4.18"
@echo " Please use \"rpm-pkg\" instead."
# Brief documentation of the typical targets used # Brief documentation of the typical targets used

View File

@ -95,7 +95,7 @@ KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
# Finally dump eveything into kernel build system # Finally dump eveything into kernel build system
KBUILD_CFLAGS += $(cflags-y) KBUILD_CFLAGS += $(cflags-y)
KBUILD_AFLAGS += $(KBUILD_CFLAGS) KBUILD_AFLAGS += $(KBUILD_CFLAGS)
LDFLAGS += $(ldflags-y) KBUILD_LDFLAGS += $(ldflags-y)
head-y := arch/arc/kernel/head.o head-y := arch/arc/kernel/head.o

View File

@ -43,12 +43,12 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
KBUILD_CPPFLAGS += -mbig-endian KBUILD_CPPFLAGS += -mbig-endian
CHECKFLAGS += -D__ARMEB__ CHECKFLAGS += -D__ARMEB__
AS += -EB AS += -EB
LDFLAGS += -EB KBUILD_LDFLAGS += -EB
else else
KBUILD_CPPFLAGS += -mlittle-endian KBUILD_CPPFLAGS += -mlittle-endian
CHECKFLAGS += -D__ARMEL__ CHECKFLAGS += -D__ARMEL__
AS += -EL AS += -EL
LDFLAGS += -EL KBUILD_LDFLAGS += -EL
endif endif
# #

View File

@ -62,14 +62,14 @@ CHECKFLAGS += -D__AARCH64EB__
AS += -EB AS += -EB
# Prefer the baremetal ELF build target, but not all toolchains include # Prefer the baremetal ELF build target, but not all toolchains include
# it so fall back to the standard linux version if needed. # it so fall back to the standard linux version if needed.
LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb) KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb)
UTS_MACHINE := aarch64_be UTS_MACHINE := aarch64_be
else else
KBUILD_CPPFLAGS += -mlittle-endian KBUILD_CPPFLAGS += -mlittle-endian
CHECKFLAGS += -D__AARCH64EL__ CHECKFLAGS += -D__AARCH64EL__
AS += -EL AS += -EL
# Same as above, prefer ELF but fall back to linux target if needed. # Same as above, prefer ELF but fall back to linux target if needed.
LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux) KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux)
UTS_MACHINE := aarch64 UTS_MACHINE := aarch64
endif endif

View File

@ -23,8 +23,7 @@ ifdef CONFIG_CPU_BIG_ENDIAN
KBUILD_CFLAGS += -mbig-endian KBUILD_CFLAGS += -mbig-endian
KBUILD_AFLAGS += -mbig-endian KBUILD_AFLAGS += -mbig-endian
LINKFLAGS += -mbig-endian LINKFLAGS += -mbig-endian
KBUILD_LDFLAGS += -mbig-endian KBUILD_LDFLAGS += -mbig-endian -EB
LDFLAGS += -EB
CHECKFLAGS += -D_BIG_ENDIAN CHECKFLAGS += -D_BIG_ENDIAN
endif endif

View File

@ -22,7 +22,7 @@ KBUILD_CFLAGS += -mint32 -fno-builtin
KBUILD_CFLAGS += -D__linux__ KBUILD_CFLAGS += -D__linux__
KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\" KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
KBUILD_AFLAGS += $(aflags-y) KBUILD_AFLAGS += $(aflags-y)
LDFLAGS += $(ldflags-y) KBUILD_LDFLAGS += $(ldflags-y)
CHECKFLAGS += -msize-long CHECKFLAGS += -msize-long

View File

@ -22,9 +22,7 @@ ldflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
KBUILD_CFLAGS += $(cflags-y) KBUILD_CFLAGS += $(cflags-y)
KBUILD_AFLAGS += $(aflags-y) KBUILD_AFLAGS += $(aflags-y)
KBUILD_LDFLAGS += $(ldflags-y)
# no KBUILD_LDFLAGS?
LDFLAGS += $(ldflags-y)
# Thread-info register will be r19. This value is not configureable; # Thread-info register will be r19. This value is not configureable;
# it is hard-coded in several files. # it is hard-coded in several files.

View File

@ -69,7 +69,7 @@ KBUILD_CFLAGS += -D__uClinux__
KBUILD_AFLAGS += -D__uClinux__ KBUILD_AFLAGS += -D__uClinux__
endif endif
LDFLAGS := -m m68kelf KBUILD_LDFLAGS := -m m68kelf
KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
ifdef CONFIG_SUN3 ifdef CONFIG_SUN3

View File

@ -40,11 +40,11 @@ CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
ifdef CONFIG_CPU_BIG_ENDIAN ifdef CONFIG_CPU_BIG_ENDIAN
KBUILD_CFLAGS += -mbig-endian KBUILD_CFLAGS += -mbig-endian
KBUILD_AFLAGS += -mbig-endian KBUILD_AFLAGS += -mbig-endian
LDFLAGS += -EB KBUILD_LDFLAGS += -EB
else else
KBUILD_CFLAGS += -mlittle-endian KBUILD_CFLAGS += -mlittle-endian
KBUILD_AFLAGS += -mlittle-endian KBUILD_AFLAGS += -mlittle-endian
LDFLAGS += -EL KBUILD_LDFLAGS += -EL
endif endif
CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER)) CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))

View File

@ -309,7 +309,7 @@ endif
# instead of .eh_frame so we don't discard them. # instead of .eh_frame so we don't discard them.
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
LDFLAGS += -m $(ld-emul) KBUILD_LDFLAGS += -m $(ld-emul)
ifdef CONFIG_MIPS ifdef CONFIG_MIPS
CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \

View File

@ -92,7 +92,7 @@ UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
vmlinuzobjs-y += $(obj)/piggy.o vmlinuzobjs-y += $(obj)/piggy.o
quiet_cmd_zld = LD $@ quiet_cmd_zld = LD $@
cmd_zld = $(LD) $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@ cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
quiet_cmd_strip = STRIP $@ quiet_cmd_strip = STRIP $@
cmd_strip = $(STRIP) -s $@ cmd_strip = $(STRIP) -s $@
vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr

View File

@ -38,7 +38,7 @@ $(obj)/rom.bin: $(obj)/rom
# Rule to make the bootloader # Rule to make the bootloader
$(obj)/rom: $(addprefix $(obj)/,$(OBJECTS)) $(obj)/rom: $(addprefix $(obj)/,$(OBJECTS))
$(LD) $(LDFLAGS) $(LDSCRIPT) -o $@ $^ $(LD) $(KBUILD_LDFLAGS) $(LDSCRIPT) -o $@ $^
$(obj)/%.o: $(obj)/%.gz $(obj)/%.o: $(obj)/%.gz
$(LD) -r -o $@ -b binary $< $(LD) -r -o $@ -b binary $<

View File

@ -33,12 +33,12 @@ endif
ifdef CONFIG_CPU_LITTLE_ENDIAN ifdef CONFIG_CPU_LITTLE_ENDIAN
KBUILD_CFLAGS += $(call cc-option, -EL) KBUILD_CFLAGS += $(call cc-option, -EL)
KBUILD_AFLAGS += $(call cc-option, -EL) KBUILD_AFLAGS += $(call cc-option, -EL)
LDFLAGS += $(call cc-option, -EL) KBUILD_LDFLAGS += $(call cc-option, -EL)
CHECKFLAGS += -D__NDS32_EL__ CHECKFLAGS += -D__NDS32_EL__
else else
KBUILD_CFLAGS += $(call cc-option, -EB) KBUILD_CFLAGS += $(call cc-option, -EB)
KBUILD_AFLAGS += $(call cc-option, -EB) KBUILD_AFLAGS += $(call cc-option, -EB)
LDFLAGS += $(call cc-option, -EB) KBUILD_LDFLAGS += $(call cc-option, -EB)
CHECKFLAGS += -D__NDS32_EB__ CHECKFLAGS += -D__NDS32_EB__
endif endif

View File

@ -76,14 +76,14 @@ endif
ifdef CONFIG_CPU_LITTLE_ENDIAN ifdef CONFIG_CPU_LITTLE_ENDIAN
KBUILD_CFLAGS += -mlittle-endian KBUILD_CFLAGS += -mlittle-endian
LDFLAGS += -EL KBUILD_LDFLAGS += -EL
LDEMULATION := lppc LDEMULATION := lppc
GNUTARGET := powerpcle GNUTARGET := powerpcle
MULTIPLEWORD := -mno-multiple MULTIPLEWORD := -mno-multiple
KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
else else
KBUILD_CFLAGS += $(call cc-option,-mbig-endian) KBUILD_CFLAGS += $(call cc-option,-mbig-endian)
LDFLAGS += -EB KBUILD_LDFLAGS += -EB
LDEMULATION := ppc LDEMULATION := ppc
GNUTARGET := powerpc GNUTARGET := powerpc
MULTIPLEWORD := -mmultiple MULTIPLEWORD := -mmultiple
@ -108,7 +108,7 @@ aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
ifeq ($(HAS_BIARCH),y) ifeq ($(HAS_BIARCH),y)
KBUILD_CFLAGS += -m$(BITS) KBUILD_CFLAGS += -m$(BITS)
KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS) KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS)
LDFLAGS += -m elf$(BITS)$(LDEMULATION) KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET) KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET)
endif endif

View File

@ -29,7 +29,7 @@ ifeq ($(CONFIG_ARCH_RV64I),y)
KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128) KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
KBUILD_MARCH = rv64im KBUILD_MARCH = rv64im
LDFLAGS += -melf64lriscv KBUILD_LDFLAGS += -melf64lriscv
else else
BITS := 32 BITS := 32
UTS_MACHINE := riscv32 UTS_MACHINE := riscv32
@ -37,7 +37,7 @@ else
KBUILD_CFLAGS += -mabi=ilp32 KBUILD_CFLAGS += -mabi=ilp32
KBUILD_AFLAGS += -mabi=ilp32 KBUILD_AFLAGS += -mabi=ilp32
KBUILD_MARCH = rv32im KBUILD_MARCH = rv32im
LDFLAGS += -melf32lriscv KBUILD_LDFLAGS += -melf32lriscv
endif endif
KBUILD_CFLAGS += -Wall KBUILD_CFLAGS += -Wall

View File

@ -11,7 +11,7 @@
# #
LD_BFD := elf64-s390 LD_BFD := elf64-s390
LDFLAGS := -m elf64_s390 KBUILD_LDFLAGS := -m elf64_s390
KBUILD_AFLAGS_MODULE += -fPIC KBUILD_AFLAGS_MODULE += -fPIC
KBUILD_CFLAGS_MODULE += -fPIC KBUILD_CFLAGS_MODULE += -fPIC
KBUILD_AFLAGS += -m64 KBUILD_AFLAGS += -m64

View File

@ -122,11 +122,11 @@ endif
ifdef CONFIG_CPU_LITTLE_ENDIAN ifdef CONFIG_CPU_LITTLE_ENDIAN
ld-bfd := elf32-$(UTS_MACHINE)-linux ld-bfd := elf32-$(UTS_MACHINE)-linux
LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld-bfd) LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld-bfd)
LDFLAGS += -EL KBUILD_LDFLAGS += -EL
else else
ld-bfd := elf32-$(UTS_MACHINE)big-linux ld-bfd := elf32-$(UTS_MACHINE)big-linux
LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd) LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd)
LDFLAGS += -EB KBUILD_LDFLAGS += -EB
endif endif
export ld-bfd BITS export ld-bfd BITS

View File

@ -21,7 +21,7 @@ ifeq ($(CONFIG_SPARC32),y)
# #
CHECKFLAGS += -D__sparc__ CHECKFLAGS += -D__sparc__
LDFLAGS := -m elf32_sparc KBUILD_LDFLAGS := -m elf32_sparc
export BITS := 32 export BITS := 32
UTS_MACHINE := sparc UTS_MACHINE := sparc
@ -40,7 +40,7 @@ else
# #
CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__
LDFLAGS := -m elf64_sparc KBUILD_LDFLAGS := -m elf64_sparc
export BITS := 64 export BITS := 64
UTS_MACHINE := sparc64 UTS_MACHINE := sparc64

View File

@ -133,7 +133,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
# The wrappers will select whether using "malloc" or the kernel allocator. # The wrappers will select whether using "malloc" or the kernel allocator.
LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
# Used by link-vmlinux.sh which has special support for um link # Used by link-vmlinux.sh which has special support for um link
export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)

View File

@ -219,7 +219,7 @@ sha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA2
KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr)
KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr)
LDFLAGS := -m elf_$(UTS_MACHINE) KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE)
# #
# The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to # The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to
@ -227,7 +227,7 @@ LDFLAGS := -m elf_$(UTS_MACHINE)
# by the linker. # by the linker.
# #
ifdef CONFIG_X86_64 ifdef CONFIG_X86_64
LDFLAGS += $(call ld-option, -z max-page-size=0x200000) KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000)
endif endif
# Speed up the build # Speed up the build

View File

@ -4,7 +4,7 @@ core-y += arch/x86/crypto/
ifeq ($(CONFIG_X86_32),y) ifeq ($(CONFIG_X86_32),y)
START := 0x8048000 START := 0x8048000
LDFLAGS += -m elf_i386 KBUILD_LDFLAGS += -m elf_i386
ELF_ARCH := i386 ELF_ARCH := i386
ELF_FORMAT := elf32-i386 ELF_FORMAT := elf32-i386
CHECKFLAGS += -D__i386__ CHECKFLAGS += -D__i386__
@ -43,7 +43,7 @@ KBUILD_CFLAGS += -fno-builtin -m64
CHECKFLAGS += -m64 -D__x86_64__ CHECKFLAGS += -m64 -D__x86_64__
KBUILD_AFLAGS += -m64 KBUILD_AFLAGS += -m64
LDFLAGS += -m elf_x86_64 KBUILD_LDFLAGS += -m elf_x86_64
KBUILD_CPPFLAGS += -m64 KBUILD_CPPFLAGS += -m64
ELF_ARCH := i386:x86-64 ELF_ARCH := i386:x86-64

View File

@ -42,16 +42,16 @@ KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
GCOV_PROFILE := n GCOV_PROFILE := n
UBSAN_SANITIZE :=n UBSAN_SANITIZE :=n
LDFLAGS := -m elf_$(UTS_MACHINE) KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE)
# Compressed kernel should be built as PIE since it may be loaded at any # Compressed kernel should be built as PIE since it may be loaded at any
# address by the bootloader. # address by the bootloader.
ifeq ($(CONFIG_X86_32),y) ifeq ($(CONFIG_X86_32),y)
LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker) KBUILD_LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker)
else else
# To build 64-bit compressed kernel as PIE, we disable relocation # To build 64-bit compressed kernel as PIE, we disable relocation
# overflow check to avoid relocation overflow error with a new linker # overflow check to avoid relocation overflow error with a new linker
# command-line option, -z noreloc-overflow. # command-line option, -z noreloc-overflow.
LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ KBUILD_LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \
&& echo "-z noreloc-overflow -pie --no-dynamic-linker") && echo "-z noreloc-overflow -pie --no-dynamic-linker")
endif endif
LDFLAGS_vmlinux := -T LDFLAGS_vmlinux := -T

View File

@ -49,7 +49,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)
KBUILD_AFLAGS += -mlongcalls -mtext-section-literals KBUILD_AFLAGS += -mlongcalls -mtext-section-literals
ifneq ($(CONFIG_LD_NO_RELAX),) ifneq ($(CONFIG_LD_NO_RELAX),)
LDFLAGS := --no-relax KBUILD_LDFLAGS := --no-relax
endif endif
ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1) ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)

View File

@ -25,7 +25,7 @@ $(obj)/Image.o: vmlinux.bin $(OBJS)
$(OBJS) $@ $(OBJS) $@
$(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds $(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
$(Q)$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ $(Q)$(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) \
-T $(obj)/boot.lds \ -T $(obj)/boot.lds \
--build-id=none \ --build-id=none \
-o $@ $(obj)/Image.o -o $@ $(obj)/Image.o

View File

@ -5,8 +5,8 @@
__INITRODATA __INITRODATA
.align 8 .align 8
.globl VMLINUX_SYMBOL(system_certificate_list) .globl system_certificate_list
VMLINUX_SYMBOL(system_certificate_list): system_certificate_list:
__cert_list_start: __cert_list_start:
#ifdef CONFIG_MODULE_SIG #ifdef CONFIG_MODULE_SIG
.incbin "certs/signing_key.x509" .incbin "certs/signing_key.x509"
@ -15,21 +15,21 @@ __cert_list_start:
__cert_list_end: __cert_list_end:
#ifdef CONFIG_SYSTEM_EXTRA_CERTIFICATE #ifdef CONFIG_SYSTEM_EXTRA_CERTIFICATE
.globl VMLINUX_SYMBOL(system_extra_cert) .globl system_extra_cert
.size system_extra_cert, CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE .size system_extra_cert, CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE
VMLINUX_SYMBOL(system_extra_cert): system_extra_cert:
.fill CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE, 1, 0 .fill CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE, 1, 0
.align 4 .align 4
.globl VMLINUX_SYMBOL(system_extra_cert_used) .globl system_extra_cert_used
VMLINUX_SYMBOL(system_extra_cert_used): system_extra_cert_used:
.int 0 .int 0
#endif /* CONFIG_SYSTEM_EXTRA_CERTIFICATE */ #endif /* CONFIG_SYSTEM_EXTRA_CERTIFICATE */
.align 8 .align 8
.globl VMLINUX_SYMBOL(system_certificate_list_size) .globl system_certificate_list_size
VMLINUX_SYMBOL(system_certificate_list_size): system_certificate_list_size:
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
.quad __cert_list_end - __cert_list_start .quad __cert_list_end - __cert_list_start
#else #else

View File

@ -54,8 +54,6 @@
#define LOAD_OFFSET 0 #define LOAD_OFFSET 0
#endif #endif
#include <linux/export.h>
/* Align . to a 8 byte boundary equals to maximum function alignment. */ /* Align . to a 8 byte boundary equals to maximum function alignment. */
#define ALIGN_FUNCTION() . = ALIGN(8) #define ALIGN_FUNCTION() . = ALIGN(8)

View File

@ -10,13 +10,6 @@
* hackers place grumpy comments in header files. * hackers place grumpy comments in header files.
*/ */
#define __VMLINUX_SYMBOL(x) x
#define __VMLINUX_SYMBOL_STR(x) #x
/* Indirect, so macros are expanded before pasting. */
#define VMLINUX_SYMBOL(x) __VMLINUX_SYMBOL(x)
#define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#ifdef MODULE #ifdef MODULE
extern struct module __this_module; extern struct module __this_module;

View File

@ -1097,6 +1097,8 @@ config LD_DEAD_CODE_DATA_ELIMINATION
bool "Dead code and data elimination (EXPERIMENTAL)" bool "Dead code and data elimination (EXPERIMENTAL)"
depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
depends on EXPERT depends on EXPERT
depends on $(cc-option,-ffunction-sections -fdata-sections)
depends on $(ld-option,--gc-sections)
help help
Enable this if you want to do dead code and data elimination with Enable this if you want to do dead code and data elimination with
the linker by compiling with -ffunction-sections -fdata-sections, the linker by compiling with -ffunction-sections -fdata-sections,

View File

@ -163,8 +163,8 @@ cc-ldoption = $(call try-run,\
$(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
# ld-option # ld-option
# Usage: LDFLAGS += $(call ld-option, -X, -Y) # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2),$(3)) ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
# ar-option # ar-option
# Usage: KBUILD_ARFLAGS := $(call ar-option,D) # Usage: KBUILD_ARFLAGS := $(call ar-option,D)

View File

@ -190,7 +190,7 @@ cmd_modversions_c = \
$(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
> $(@D)/.tmp_$(@F:.o=.ver); \ > $(@D)/.tmp_$(@F:.o=.ver); \
\ \
$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
-T $(@D)/.tmp_$(@F:.o=.ver); \ -T $(@D)/.tmp_$(@F:.o=.ver); \
rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
else \ else \
@ -220,7 +220,7 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
"$(if $(CONFIG_64BIT),64,32)" \ "$(if $(CONFIG_64BIT),64,32)" \
"$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \ "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
"$(LD)" "$(NM)" "$(RM)" "$(MV)" \ "$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \
"$(if $(part-of-module),1,0)" "$(@)"; "$(if $(part-of-module),1,0)" "$(@)";
recordmcount_source := $(srctree)/scripts/recordmcount.pl recordmcount_source := $(srctree)/scripts/recordmcount.pl
endif # BUILD_C_RECORDMCOUNT endif # BUILD_C_RECORDMCOUNT
@ -394,7 +394,7 @@ cmd_modversions_S = \
$(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
> $(@D)/.tmp_$(@F:.o=.ver); \ > $(@D)/.tmp_$(@F:.o=.ver); \
\ \
$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
-T $(@D)/.tmp_$(@F:.o=.ver); \ -T $(@D)/.tmp_$(@F:.o=.ver); \
rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
else \ else \

View File

@ -162,7 +162,7 @@ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
$(__cpp_flags) $(__cpp_flags)
ld_flags = $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes

View File

@ -120,7 +120,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
# Step 6), final link of the modules with optional arch pass after final link # Step 6), final link of the modules with optional arch pass after final link
quiet_cmd_ld_ko_o = LD [M] $@ quiet_cmd_ld_ko_o = LD [M] $@
cmd_ld_ko_o = \ cmd_ld_ko_o = \
$(LD) -r $(LDFLAGS) \ $(LD) -r $(KBUILD_LDFLAGS) \
$(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
-o $@ $(filter-out FORCE,$^) ; \ -o $@ $(filter-out FORCE,$^) ; \
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)

View File

@ -12,7 +12,7 @@
compiler="$*" compiler="$*"
if !( $compiler --version | grep -q clang) ; then if ! ( $compiler --version | grep -q clang) ; then
echo 0 echo 0
exit 1 exit 1
fi fi

View File

@ -35,8 +35,7 @@ statement S;
* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\| * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\| kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\| devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|kvmalloc_node(E1,...)\);
kvmalloc_node(E1,...)\);
if ((x==NULL) || ...) S if ((x==NULL) || ...) S
* memset((T2)x,0,E1); * memset((T2)x,0,E1);
@ -124,15 +123,6 @@ statement S;
- x = (T)kvmalloc(E1,E2); - x = (T)kvmalloc(E1,E2);
+ x = (T)kvzalloc(E1,E2); + x = (T)kvzalloc(E1,E2);
| |
- x = pci_alloc_consistent(E2,E1,E3);
+ x = pci_zalloc_consistent(E2,E1,E3);
|
- x = (T *)pci_alloc_consistent(E2,E1,E3);
+ x = pci_zalloc_consistent(E2,E1,E3);
|
- x = (T)pci_alloc_consistent(E2,E1,E3);
+ x = (T)pci_zalloc_consistent(E2,E1,E3);
|
- x = kvmalloc_node(E1,E2,E3); - x = kvmalloc_node(E1,E2,E3);
+ x = kvzalloc_node(E1,E2,E3); + x = kvzalloc_node(E1,E2,E3);
| |
@ -388,35 +378,6 @@ x << r7.x;
msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x) msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x)
coccilib.report.print_report(p[0], msg) coccilib.report.print_report(p[0], msg)
//-----------------------------------------------------------------
@r8 depends on org || report@
type T, T2;
expression x;
expression E1,E2,E3;
statement S;
position p;
@@
x = (T)pci_alloc_consistent@p(E2,E1,E3);
if ((x==NULL) || ...) S
memset((T2)x,0,E1);
@script:python depends on org@
p << r8.p;
x << r8.x;
@@
msg="%s" % (x)
msg_safe=msg.replace("[","@(").replace("]",")")
coccilib.org.print_todo(p[0], msg_safe)
@script:python depends on report@
p << r8.p;
x << r8.x;
@@
msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x)
coccilib.report.print_report(p[0], msg)
//----------------------------------------------------------------- //-----------------------------------------------------------------
@r9 depends on org || report@ @r9 depends on org || report@
type T, T2; type T, T2;

View File

@ -9,21 +9,11 @@ dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
# Source files need to get at the userspace version of libfdt_env.h to compile # Source files need to get at the userspace version of libfdt_env.h to compile
HOST_EXTRACFLAGS := -I$(src)/libfdt
HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt # Generated files need one more search path to include headers in source tree
HOSTCFLAGS_dtc-lexer.lex.o := -I$(src)
HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC) HOSTCFLAGS_dtc-parser.tab.o := -I$(src)
HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC)
HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC)
HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC)
HOSTCFLAGS_util.o := $(HOSTCFLAGS_DTC)
HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
# dependencies on generated files need to be listed explicitly # dependencies on generated files need to be listed explicitly
$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h

View File

@ -3,7 +3,8 @@
# Kernel configuration targets # Kernel configuration targets
# These targets are used from top-level makefile # These targets are used from top-level makefile
PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig \
build_menuconfig build_nconfig build_gconfig build_xconfig
ifdef KBUILD_KCONFIG ifdef KBUILD_KCONFIG
Kconfig := $(KBUILD_KCONFIG) Kconfig := $(KBUILD_KCONFIG)
@ -33,6 +34,14 @@ config: $(obj)/conf
nconfig: $(obj)/nconf nconfig: $(obj)/nconf
$< $(silent) $(Kconfig) $< $(silent) $(Kconfig)
build_menuconfig: $(obj)/mconf
build_nconfig: $(obj)/nconf
build_gconfig: $(obj)/gconf
build_xconfig: $(obj)/qconf
localyesconfig localmodconfig: $(obj)/conf localyesconfig localmodconfig: $(obj)/conf
$(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
$(Q)if [ -f .config ]; then \ $(Q)if [ -f .config ]; then \
@ -169,7 +178,7 @@ HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs)
HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
$(obj)/nconf.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-y += mconf
@ -180,7 +189,8 @@ HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)
$(foreach f, mconf.o $(lxdialog), \ $(foreach f, mconf.o $(lxdialog), \
$(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags)))
$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/.mconf-cfg $(obj)/mconf.o: $(obj)/.mconf-cfg
$(addprefix $(obj)/lxdialog/, $(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-y += qconf

View File

@ -508,6 +508,11 @@ int main(int ac, char **av)
input_mode = (enum input_mode)opt; input_mode = (enum input_mode)opt;
switch (opt) { switch (opt) {
case syncconfig: case syncconfig:
/*
* syncconfig is invoked during the build stage.
* Suppress distracting "configuration written to ..."
*/
conf_set_message_callback(NULL);
sync_kconfig = 1; sync_kconfig = 1;
break; break;
case defconfig: case defconfig:

View File

@ -1011,7 +1011,7 @@ static struct dep_stack {
struct dep_stack *prev, *next; struct dep_stack *prev, *next;
struct symbol *sym; struct symbol *sym;
struct property *prop; struct property *prop;
struct expr *expr; struct expr **expr;
} *check_top; } *check_top;
static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym) static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym)
@ -1076,18 +1076,7 @@ static void sym_check_print_recursive(struct symbol *last_sym)
fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
prop->file->name, prop->lineno); prop->file->name, prop->lineno);
if (stack->expr) { if (sym_is_choice(sym)) {
fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
prop->file->name, prop->lineno,
sym->name ? sym->name : "<choice>",
prop_get_type_name(prop->type),
next_sym->name ? next_sym->name : "<choice>");
} else if (stack->prop) {
fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n",
prop->file->name, prop->lineno,
sym->name ? sym->name : "<choice>",
next_sym->name ? next_sym->name : "<choice>");
} else if (sym_is_choice(sym)) {
fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n", fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
menu->file->name, menu->lineno, menu->file->name, menu->lineno,
sym->name ? sym->name : "<choice>", sym->name ? sym->name : "<choice>",
@ -1097,11 +1086,33 @@ static void sym_check_print_recursive(struct symbol *last_sym)
menu->file->name, menu->lineno, menu->file->name, menu->lineno,
sym->name ? sym->name : "<choice>", sym->name ? sym->name : "<choice>",
next_sym->name ? next_sym->name : "<choice>"); next_sym->name ? next_sym->name : "<choice>");
} else { } else if (stack->expr == &sym->dir_dep.expr) {
fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n",
prop->file->name, prop->lineno,
sym->name ? sym->name : "<choice>",
next_sym->name ? next_sym->name : "<choice>");
} else if (stack->expr == &sym->rev_dep.expr) {
fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n", fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n",
prop->file->name, prop->lineno, prop->file->name, prop->lineno,
sym->name ? sym->name : "<choice>", sym->name ? sym->name : "<choice>",
next_sym->name ? next_sym->name : "<choice>"); next_sym->name ? next_sym->name : "<choice>");
} else if (stack->expr == &sym->implied.expr) {
fprintf(stderr, "%s:%d:\tsymbol %s is implied by %s\n",
prop->file->name, prop->lineno,
sym->name ? sym->name : "<choice>",
next_sym->name ? next_sym->name : "<choice>");
} else if (stack->expr) {
fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
prop->file->name, prop->lineno,
sym->name ? sym->name : "<choice>",
prop_get_type_name(prop->type),
next_sym->name ? next_sym->name : "<choice>");
} else {
fprintf(stderr, "%s:%d:\tsymbol %s %s is visible depending on %s\n",
prop->file->name, prop->lineno,
sym->name ? sym->name : "<choice>",
prop_get_type_name(prop->type),
next_sym->name ? next_sym->name : "<choice>");
} }
} }
@ -1157,12 +1168,26 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
dep_stack_insert(&stack, sym); dep_stack_insert(&stack, sym);
stack.expr = &sym->dir_dep.expr;
sym2 = sym_check_expr_deps(sym->dir_dep.expr);
if (sym2)
goto out;
stack.expr = &sym->rev_dep.expr;
sym2 = sym_check_expr_deps(sym->rev_dep.expr); sym2 = sym_check_expr_deps(sym->rev_dep.expr);
if (sym2) if (sym2)
goto out; goto out;
stack.expr = &sym->implied.expr;
sym2 = sym_check_expr_deps(sym->implied.expr);
if (sym2)
goto out;
stack.expr = NULL;
for (prop = sym->prop; prop; prop = prop->next) { for (prop = sym->prop; prop; prop = prop->next) {
if (prop->type == P_CHOICE || prop->type == P_SELECT) if (prop->type == P_CHOICE || prop->type == P_SELECT ||
prop->type == P_IMPLY)
continue; continue;
stack.prop = prop; stack.prop = prop;
sym2 = sym_check_expr_deps(prop->visible.expr); sym2 = sym_check_expr_deps(prop->visible.expr);
@ -1170,7 +1195,7 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
break; break;
if (prop->type != P_DEFAULT || sym_is_choice(sym)) if (prop->type != P_DEFAULT || sym_is_choice(sym))
continue; continue;
stack.expr = prop->expr; stack.expr = &prop->expr;
sym2 = sym_check_expr_deps(prop->expr); sym2 = sym_check_expr_deps(prop->expr);
if (sym2) if (sym2)
break; break;
@ -1248,9 +1273,6 @@ struct symbol *sym_check_deps(struct symbol *sym)
sym->flags &= ~SYMBOL_CHECK; sym->flags &= ~SYMBOL_CHECK;
} }
if (sym2 && sym2 == sym)
sym2 = NULL;
return sym2; return sym2;
} }

View File

@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
# depends on itself # depends on itself
config A config A
@ -31,7 +33,6 @@ config D2
bool bool
# depends on and imply # depends on and imply
# This is not recursive dependency
config E1 config E1
bool "E1" bool "E1"

View File

@ -0,0 +1,10 @@
# SPDX-License-Identifier: GPL-2.0
"""
Detect recursive dependency error.
Recursive dependency should be treated as an error.
"""
def test(conf):
assert conf.oldaskconfig() == 1
assert conf.stderr_contains('expected_stderr')

View File

@ -0,0 +1,38 @@
Kconfig:11:error: recursive dependency detected!
Kconfig:11: symbol B is selected by B
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:5:error: recursive dependency detected!
Kconfig:5: symbol A depends on A
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:17:error: recursive dependency detected!
Kconfig:17: symbol C1 depends on C2
Kconfig:21: symbol C2 depends on C1
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:32:error: recursive dependency detected!
Kconfig:32: symbol D2 is selected by D1
Kconfig:27: symbol D1 depends on D2
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:37:error: recursive dependency detected!
Kconfig:37: symbol E1 depends on E2
Kconfig:42: symbol E2 is implied by E1
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:60:error: recursive dependency detected!
Kconfig:60: symbol G depends on G
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:51:error: recursive dependency detected!
Kconfig:51: symbol F2 depends on F1
Kconfig:49: symbol F1 default value contains F2
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"

View File

@ -1,9 +0,0 @@
"""
Warn recursive inclusion.
Recursive dependency should be warned.
"""
def test(conf):
assert conf.oldaskconfig() == 0
assert conf.stderr_contains('expected_stderr')

View File

@ -1,30 +0,0 @@
Kconfig:9:error: recursive dependency detected!
Kconfig:9: symbol B is selected by B
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:3:error: recursive dependency detected!
Kconfig:3: symbol A depends on A
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:15:error: recursive dependency detected!
Kconfig:15: symbol C1 depends on C2
Kconfig:19: symbol C2 depends on C1
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:30:error: recursive dependency detected!
Kconfig:30: symbol D2 is selected by D1
Kconfig:25: symbol D1 depends on D2
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:59:error: recursive dependency detected!
Kconfig:59: symbol G depends on G
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
Kconfig:50:error: recursive dependency detected!
Kconfig:50: symbol F2 depends on F1
Kconfig:48: symbol F1 default value contains F2

View File

@ -75,7 +75,7 @@ modpost_link()
${KBUILD_VMLINUX_LIBS} \ ${KBUILD_VMLINUX_LIBS} \
--end-group" --end-group"
${LD} ${LDFLAGS} -r -o ${1} ${objects} ${LD} ${KBUILD_LDFLAGS} -r -o ${1} ${objects}
} }
# Link of vmlinux # Link of vmlinux
@ -95,7 +95,7 @@ vmlinux_link()
--end-group \ --end-group \
${1}" ${1}"
${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \
-T ${lds} ${objects} -T ${lds} ${objects}
else else
objects="-Wl,--whole-archive \ objects="-Wl,--whole-archive \

View File

@ -672,7 +672,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER)
break; break;
if (symname[0] == '.') { if (symname[0] == '.') {
char *munged = strdup(symname); char *munged = NOFAIL(strdup(symname));
munged[0] = '_'; munged[0] = '_';
munged[1] = toupper(munged[1]); munged[1] = toupper(munged[1]);
symname = munged; symname = munged;
@ -1318,7 +1318,7 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
static char *sec2annotation(const char *s) static char *sec2annotation(const char *s)
{ {
if (match(s, init_exit_sections)) { if (match(s, init_exit_sections)) {
char *p = malloc(20); char *p = NOFAIL(malloc(20));
char *r = p; char *r = p;
*p++ = '_'; *p++ = '_';
@ -1338,7 +1338,7 @@ static char *sec2annotation(const char *s)
strcat(p, " "); strcat(p, " ");
return r; return r;
} else { } else {
return strdup(""); return NOFAIL(strdup(""));
} }
} }
@ -2036,7 +2036,7 @@ void buf_write(struct buffer *buf, const char *s, int len)
{ {
if (buf->size - buf->pos < len) { if (buf->size - buf->pos < len) {
buf->size += len + SZ; buf->size += len + SZ;
buf->p = realloc(buf->p, buf->size); buf->p = NOFAIL(realloc(buf->p, buf->size));
} }
strncpy(buf->p + buf->pos, s, len); strncpy(buf->p + buf->pos, s, len);
buf->pos += len; buf->pos += len;

View File

@ -24,7 +24,7 @@ $(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE
# Generate the initramfs cpio archive # Generate the initramfs cpio archive
hostprogs-y := gen_init_cpio hostprogs-y := gen_init_cpio
initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh initramfs := $(CONFIG_SHELL) $(srctree)/$(src)/gen_initramfs_list.sh
ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
$(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
ramfs-args := \ ramfs-args := \

View File

@ -174,7 +174,7 @@ dir_filelist() {
${dep_list}header "$1" ${dep_list}header "$1"
srcdir=$(echo "$1" | sed -e 's://*:/:g') srcdir=$(echo "$1" | sed -e 's://*:/:g')
dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | sort) dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort)
# If $dirlist is only one line, then the directory is empty # If $dirlist is only one line, then the directory is empty
if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then

View File

@ -30,8 +30,8 @@ __irf_start:
.incbin __stringify(INITRAMFS_IMAGE) .incbin __stringify(INITRAMFS_IMAGE)
__irf_end: __irf_end:
.section .init.ramfs.info,"a" .section .init.ramfs.info,"a"
.globl VMLINUX_SYMBOL(__initramfs_size) .globl __initramfs_size
VMLINUX_SYMBOL(__initramfs_size): __initramfs_size:
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
.quad __irf_end - __irf_start .quad __irf_end - __irf_start
#else #else