kbuild: switch to thin archives
Subsystems (6)
Nicholas Piggin
reviewerPATCH v2 1/1 kbuild: switch to thin archives
Switch from incremental build to thin archives for packaging built-in.o. binutils version must be bumped to 2.20. Proposed patch for 4.13.
--- Documentation/process/changes.rst | 9 ++++----- Makefile | 3 +++ arch/Kconfig | 6 ------ arch/powerpc/Kconfig | 8 -------- arch/x86/um/vdso/Makefile | 2 +- scripts/Makefile.build | 27 ++++++------------------- scripts/link-vmlinux.sh | 42 +++++++++------------------------------ 7 files changed, 23 insertions(+), 74 deletions(-)
Documentation/process/changes.rst +4 -5
@@ -31,7 +31,7 @@ you probably needn't concern yourself with isdn4k-utils. ====================== =============== ======================================== GNU C 3.2 gcc --version GNU make 3.81 make --version -binutils 2.12 ld -v +binutils 2.20 ld -v util-linux 2.10o fdformat --version module-init-tools 0.9.10 depmod -V e2fsprogs 1.41.4 e2fsck -V
@@ -75,10 +75,9 @@ You will need GNU make 3.81 or later to build the kernel. Binutils -------- -Linux on IA-32 has recently switched from using ``as86`` to using ``gas`` for -assembling the 16-bit boot code, removing the need for ``as86`` to compile -your kernel. This change does, however, mean that you need a recent -release of binutils. +The build system has recently switched to using thin archives (`ar T`) rather +than incremental linking (`ld -r`) for built-in.o intermediate steps. This +requires binutils 2.20 or newer. Perl ----
Makefile +3 -0
@@ -818,6 +818,9 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D) +# must use thin archives. +KBUILD_ARFLAGS :=$(KBUILD_ARFLAGS)T + include scripts/Makefile.kasan include scripts/Makefile.extrawarn include scripts/Makefile.ubsan
arch/Kconfig +0 -6
@@ -510,12 +510,6 @@ config CC_STACKPROTECTOR_STRONG endchoice -config THIN_ARCHIVES - bool - help - Select this if the architecture wants to use thin archives - instead of ld -r to create the built-in.o files. - config LD_DEAD_CODE_DATA_ELIMINATION bool help
arch/powerpc/Kconfig +0 -8
@@ -472,14 +472,6 @@ config MPROFILE_KERNEL depends on PPC64 && CPU_LITTLE_ENDIAN def_bool !DISABLE_MPROFILE_KERNEL -config USE_THIN_ARCHIVES - bool "Build the kernel using thin archives" - default n - select THIN_ARCHIVES - help - Build the kernel using thin archives. - If you're unsure say N. - config IOMMU_HELPER def_bool PPC64
arch/x86/um/vdso/Makefile +1 -1
@@ -53,7 +53,7 @@ CFLAGS_REMOVE_vdso-note.o = -pg -fprofile-arcs -ftest-coverage CFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage targets += vdso-syms.lds -obj-$(VDSO64-y) += vdso-syms.lds +extra-$(VDSO64-y) += vdso-syms.lds # # Match symbols in the DSO that look like VDSO*; produce a file of constants.
scripts/Makefile.build +6 -21
@@ -436,15 +436,9 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; # ifdef builtin-target -ifdef CONFIG_THIN_ARCHIVES - cmd_make_builtin = rm -f $@; $(AR) rcST$(KBUILD_ARFLAGS) - cmd_make_empty_builtin = rm -f $@; $(AR) rcST$(KBUILD_ARFLAGS) - quiet_cmd_link_o_target = AR $@ -else - cmd_make_builtin = $(LD) $(ld_flags) -r -o - cmd_make_empty_builtin = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) - quiet_cmd_link_o_target = LD $@ -endif +cmd_make_builtin = rm -f $@; $(AR) rcS$(KBUILD_ARFLAGS) +cmd_make_empty_builtin = rm -f $@; $(AR) rcS$(KBUILD_ARFLAGS) +quiet_cmd_link_o_target = AR $@ # If the list of objects to link is empty, just create an empty built-in.o cmd_link_o_target = $(if $(strip $(obj-y)),\
@@ -477,11 +471,7 @@ $(modorder-target): $(subdir-ym) FORCE ifdef lib-target quiet_cmd_link_l_target = AR $@ -ifdef CONFIG_THIN_ARCHIVES - cmd_link_l_target = rm -f $@; $(AR) rcsT$(KBUILD_ARFLAGS) $@ $(lib-y) -else - cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y) -endif +cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y) $(lib-target): $(lib-y) FORCE $(call if_changed,link_l_target)
@@ -529,13 +519,8 @@ $($(subst $(obj)/,,$(@:.o=-m)))), $^) cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) -ifdef CONFIG_THIN_ARCHIVES - quiet_cmd_link_multi-y = AR $@ - cmd_link_multi-y = rm -f $@; $(AR) rcST$(KBUILD_ARFLAGS) $@ $(link_multi_deps) -else - quiet_cmd_link_multi-y = LD $@ - cmd_link_multi-y = $(cmd_link_multi-link) -endif +quiet_cmd_link_multi-y = AR $@ +cmd_link_multi-y = rm -f $@; $(AR) rcS$(KBUILD_ARFLAGS) $@ $(link_multi_deps) quiet_cmd_link_multi-m = LD [M] $@ cmd_link_multi-m = $(cmd_link_multi-link)
scripts/link-vmlinux.sh +9 -33
64 lines not on this page · raw message
Signature · 1 line
2.11.0
kbuild test robot
build boturl: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/kbuild-switch-to-thin-archives/20170608-163425 config: sh-sh7724_generic_defconfig (attached as .config) compiler: sh4-linux-gnu-gcc…
Hi Nicholas,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.12-rc4 next-20170608]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/kbuild-switch-to-thin-archives/20170608-163425
config: sh-sh7724_generic_defconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sh
All errors (new ones prefixed by >>):
arch/sh/kernel/process.o: In function `arch_dup_task_struct':
process.c:(.text+0xc0): undefined reference to save_fpu' arch/sh/kernel/process_32.o: In function __switch_to':
process_32.c:(.text+0x2ec): undefined reference to save_fpu' arch/sh/kernel/signal_32.o: In function setup_sigcontext':
signal_32.c:(.text+0x350): undefined reference to save_fpu' arch/sh/kernel/signal_32.o: In function do_signal':
signal_32.c:(.text+0x5c4): undefined reference to __kernel_sigreturn' signal_32.c:(.text+0x724): undefined reference to __kernel_rt_sigreturn' arch/sh/kernel/cpu/sh3/ex.o: In function `exception_handling_table':
(.data+0x24): undefined reference to fpu_error_trap_handler' arch/sh/kernel/cpu/fpu.o: In function init_fpu':
fpu.c:(.text+0xd0): undefined reference to save_fpu' arch/sh/kernel/cpu/fpu.o: In function __fpu_state_restore':
fpu.c:(.text+0x100): undefined reference to restore_fpu' arch/sh/kernel/cpu/sh4/softfloat.o: In function roundAndPackFloat64':
softfloat.c:(.text+0x1b4): undefined reference to float_rounding_mode' softfloat.c:(.text+0x1b8): undefined reference to float_raise' arch/sh/kernel/cpu/sh4/softfloat.o: In function `subFloat64Sigs':
softfloat.c:(.text+0x4c4): undefined reference to float_rounding_mode' arch/sh/kernel/cpu/sh4/softfloat.o: In function roundAndPackFloat32':
softfloat.c:(.text+0x884): undefined reference to float_rounding_mode' softfloat.c:(.text+0x888): undefined reference to float_raise' arch/sh/kernel/cpu/sh4/softfloat.o: In function `subFloat32Sigs':
softfloat.c:(.text+0x9f0): undefined reference to float_rounding_mode' arch/sh/kernel/cpu/sh4/softfloat.o: In function float64_div':
softfloat.c:(.text+0x1334): undefined reference to float_raise' kernel/power/hibernate.o: In function hibernation_snapshot':
>> hibernate.c:(.text+0x6f4): undefined reference to `swsusp_arch_suspend' kernel/power/hibernate.o: In function `hibernation_restore': >> hibernate.c:(.text+0x8ac): undefined reference to `swsusp_arch_resume'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation