Pull Kbuild thin archives updates from Masahiro Yamada: "Thin archives migration by Nicholas Piggin. THIN_ARCHIVES has been available for a while as an optional feature only for PowerPC architecture, but we do not need two different intermediate-artifact schemes. Using thin archives instead of conventional incremental linking has various advantages: - save disk space for builds - speed-up building a little - fix some link issues (for example, allyesconfig on ARM) due to more flexibility for the final linking - work better with dead code elimination we are planning As discussed before, this migration has been done unconditionally so that any problems caused by this will show up with "git bisect". With testing with 0-day and linux-next, some architectures actually showed up problems, but they were trivial and all fixed now" * tag 'kbuild-thinar-v4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: tile: remove unneeded extra-y in Makefile kbuild: thin archives make default for all archs x86/um: thin archives build fix tile: thin archives fix linking ia64: thin archives fix linking sh: thin archives fix linking kbuild: handle libs-y archives separately from built-in.o archives kbuild: thin archives use P option to ar kbuild: thin archives final link close --whole-archives option ia64: remove unneeded extra-y in Makefile.gate tile: fix dependency and .*.cmd inclusion for incremental build sparc64: Use indirect calls in hamming weight stubs
Showing the changes to scripts (2 of 12 files). Show all
Unified · Split
| @@ -437,8 +437,8 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; · 436 unmodified lines | |||
| 437 | ifdef builtin-target | 437 | ifdef builtin-target |
| 438 | 438 | ||
| 439 | ifdef CONFIG_THIN_ARCHIVES | 439 | ifdef CONFIG_THIN_ARCHIVES |
| 440 | cmd_make_builtin = rm -f $@; $(AR) rcST$(KBUILD_ARFLAGS) | 440 | cmd_make_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) |
| 441 | cmd_make_empty_builtin = rm -f $@; $(AR) rcST$(KBUILD_ARFLAGS) | 441 | cmd_make_empty_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) |
| 442 | quiet_cmd_link_o_target = AR $@ | 442 | quiet_cmd_link_o_target = AR $@ |
| 443 | else | 443 | else |
| 444 | cmd_make_builtin = $(LD) $(ld_flags) -r -o | 444 | cmd_make_builtin = $(LD) $(ld_flags) -r -o |
| @@ -478,7 +478,7 @@ ifdef lib-target · 33 unmodified lines | |||
| 478 | quiet_cmd_link_l_target = AR $@ | 478 | quiet_cmd_link_l_target = AR $@ |
| 479 | 479 | ||
| 480 | ifdef CONFIG_THIN_ARCHIVES | 480 | ifdef CONFIG_THIN_ARCHIVES |
| 481 | cmd_link_l_target = rm -f $@; $(AR) rcsT$(KBUILD_ARFLAGS) $@ $(lib-y) | 481 | cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y) |
| 482 | else | 482 | else |
| 483 | cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y) | 483 | cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y) |
| 484 | endif | 484 | endif |
| @@ -531,7 +531,7 @@ cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secana · 46 unmodified lines | |||
| 531 | 531 | ||
| 532 | ifdef CONFIG_THIN_ARCHIVES | 532 | ifdef CONFIG_THIN_ARCHIVES |
| 533 | quiet_cmd_link_multi-y = AR $@ | 533 | quiet_cmd_link_multi-y = AR $@ |
| 534 | cmd_link_multi-y = rm -f $@; $(AR) rcST$(KBUILD_ARFLAGS) $@ $(link_multi_deps) | 534 | cmd_link_multi-y = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(link_multi_deps) |
| 535 | else | 535 | else |
| 536 | quiet_cmd_link_multi-y = LD $@ | 536 | quiet_cmd_link_multi-y = LD $@ |
| 537 | cmd_link_multi-y = $(cmd_link_multi-link) | 537 | cmd_link_multi-y = $(cmd_link_multi-link) |
| @@ -3,9 +3,12 @@ · 2 unmodified lines | |||
| 3 | # link vmlinux | 3 | # link vmlinux |
| 4 | # | 4 | # |
| 5 | # vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and | 5 | # vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and |
| 6 | # $(KBUILD_VMLINUX_MAIN). Most are built-in.o files from top-level directories | 6 | # $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.o files |
| 7 | # in the kernel tree, others are specified in arch/$(ARCH)/Makefile. | 7 | # from top-level directories in the kernel tree, others are specified in |
| 8 | # Ordering when linking is important, and $(KBUILD_VMLINUX_INIT) must be first. | 8 | # arch/$(ARCH)/Makefile. Ordering when linking is important, and |
| 9 | # $(KBUILD_VMLINUX_INIT) must be first. $(KBUILD_VMLINUX_LIBS) are archives | ||
| 10 | # which are linked conditionally (not within --whole-archive), and do not | ||
| 11 | # require symbol indexes added. | ||
| 9 | # | 12 | # |
| 10 | # vmlinux | 13 | # vmlinux |
| 11 | # ^ | 14 | # ^ |
| @@ -16,6 +19,9 @@ · 4 unmodified lines | |||
| 16 | # +--< $(KBUILD_VMLINUX_MAIN) | 19 | # +--< $(KBUILD_VMLINUX_MAIN) |
| 17 | # | +--< drivers/built-in.o mm/built-in.o + more | 20 | # | +--< drivers/built-in.o mm/built-in.o + more |
| 18 | # | | 21 | # | |
| 22 | # +--< $(KBUILD_VMLINUX_LIBS) | ||
| 23 | # | +--< lib/lib.a + more | ||
| 24 | # | | ||
| 19 | # +-< ${kallsymso} (see description in KALLSYMS section) | 25 | # +-< ${kallsymso} (see description in KALLSYMS section) |
| 20 | # | 26 | # |
| 21 | # vmlinux version (uname -v) cannot be updated during normal | 27 | # vmlinux version (uname -v) cannot be updated during normal |
| @@ -37,9 +43,10 @@ info() · 15 unmodified lines | |||
| 37 | fi | 43 | fi |
| 38 | } | 44 | } |
| 39 | 45 | ||
| 40 | # Thin archive build here makes a final archive with | 46 | # Thin archive build here makes a final archive with symbol table and indexes |
| 41 | # symbol table and indexes from vmlinux objects, which can be | 47 | # from vmlinux objects INIT and MAIN, which can be used as input to linker. |
| 42 | # used as input to linker. | 48 | # KBUILD_VMLINUX_LIBS archives should already have symbol table and indexes |
| 49 | # added. | ||
| 43 | # | 50 | # |
| 44 | # Traditional incremental style of link does not require this step | 51 | # Traditional incremental style of link does not require this step |
| 45 | # | 52 | # |
| @@ -50,7 +57,7 @@ archive_builtin() · 4 unmodified lines | |||
| 50 | if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then | 57 | if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then |
| 51 | info AR built-in.o | 58 | info AR built-in.o |
| 52 | rm -f built-in.o; | 59 | rm -f built-in.o; |
| 53 | ${AR} rcsT${KBUILD_ARFLAGS} built-in.o \ | 60 | ${AR} rcsTP${KBUILD_ARFLAGS} built-in.o \ |
| 54 | ${KBUILD_VMLINUX_INIT} \ | 61 | ${KBUILD_VMLINUX_INIT} \ |
| 55 | ${KBUILD_VMLINUX_MAIN} | 62 | ${KBUILD_VMLINUX_MAIN} |
| 56 | fi | 63 | fi |
| @@ -63,11 +70,17 @@ modpost_link() · 6 unmodified lines | |||
| 63 | local objects | 70 | local objects |
| 64 | 71 | ||
| 65 | if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then | 72 | if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then |
| 66 | objects="--whole-archive built-in.o" | 73 | objects="--whole-archive \ |
| 74 | built-in.o \ | ||
| 75 | --no-whole-archive \ | ||
| 76 | --start-group \ | ||
| 77 | ${KBUILD_VMLINUX_LIBS} \ | ||
| 78 | --end-group" | ||
| 67 | else | 79 | else |
| 68 | objects="${KBUILD_VMLINUX_INIT} \ | 80 | objects="${KBUILD_VMLINUX_INIT} \ |
| 69 | --start-group \ | 81 | --start-group \ |
| 70 | ${KBUILD_VMLINUX_MAIN} \ | 82 | ${KBUILD_VMLINUX_MAIN} \ |
| 83 | ${KBUILD_VMLINUX_LIBS} \ | ||
| 71 | --end-group" | 84 | --end-group" |
| 72 | fi | 85 | fi |
| 73 | ${LD} ${LDFLAGS} -r -o ${1} ${objects} | 86 | ${LD} ${LDFLAGS} -r -o ${1} ${objects} |
| @@ -83,11 +96,18 @@ vmlinux_link() · 9 unmodified lines | |||
| 83 | 96 | ||
| 84 | if [ "${SRCARCH}" != "um" ]; then | 97 | if [ "${SRCARCH}" != "um" ]; then |
| 85 | if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then | 98 | if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then |
| 86 | objects="--whole-archive built-in.o ${1}" | 99 | objects="--whole-archive \ |
| 100 | built-in.o \ | ||
| 101 | --no-whole-archive \ | ||
| 102 | --start-group \ | ||
| 103 | ${KBUILD_VMLINUX_LIBS} \ | ||
| 104 | --end-group \ | ||
| 105 | ${1}" | ||
| 87 | else | 106 | else |
| 88 | objects="${KBUILD_VMLINUX_INIT} \ | 107 | objects="${KBUILD_VMLINUX_INIT} \ |
| 89 | --start-group \ | 108 | --start-group \ |
| 90 | ${KBUILD_VMLINUX_MAIN} \ | 109 | ${KBUILD_VMLINUX_MAIN} \ |
| 110 | ${KBUILD_VMLINUX_LIBS} \ | ||
| 91 | --end-group \ | 111 | --end-group \ |
| 92 | ${1}" | 112 | ${1}" |
| 93 | fi | 113 | fi |
| @@ -96,11 +116,18 @@ vmlinux_link() · 2 unmodified lines | |||
| 96 | -T ${lds} ${objects} | 116 | -T ${lds} ${objects} |
| 97 | else | 117 | else |
| 98 | if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then | 118 | if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then |
| 99 | objects="-Wl,--whole-archive built-in.o ${1}" | 119 | objects="-Wl,--whole-archive \ |
| 120 | built-in.o \ | ||
| 121 | -Wl,--no-whole-archive \ | ||
| 122 | -Wl,--start-group \ | ||
| 123 | ${KBUILD_VMLINUX_LIBS} \ | ||
| 124 | -Wl,--end-group \ | ||
| 125 | ${1}" | ||
| 100 | else | 126 | else |
| 101 | objects="${KBUILD_VMLINUX_INIT} \ | 127 | objects="${KBUILD_VMLINUX_INIT} \ |
| 102 | -Wl,--start-group \ | 128 | -Wl,--start-group \ |
| 103 | ${KBUILD_VMLINUX_MAIN} \ | 129 | ${KBUILD_VMLINUX_MAIN} \ |
| 130 | ${KBUILD_VMLINUX_LIBS} \ | ||
| 104 | -Wl,--end-group \ | 131 | -Wl,--end-group \ |
| 105 | ${1}" | 132 | ${1}" |
| 106 | fi | 133 | fi |