History

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

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

Linus Torvalds committed 9 years ago

Commit 98ced882 parents 16ffc4c 42317ea12 files · +93 −72Browse files

Showing the changes to scripts (2 of 12 files). Show all

Unified · Split

2 files
  1. scripts/Makefile.build +4 −4
  2. scripts/link-vmlinux.sh +37 −10
scripts/Makefile.build+4−4
@@ -437,8 +437,8 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; · 436 unmodified lines
437437 ifdef builtin-target
438438
439439 ifdef CONFIG_THIN_ARCHIVES
440− cmd_make_builtin = rm -f $@; $(AR) rcST$(KBUILD_ARFLAGS)
441− cmd_make_empty_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) rcSTP$(KBUILD_ARFLAGS)
442442 quiet_cmd_link_o_target = AR $@
443443 else
444444 cmd_make_builtin = $(LD) $(ld_flags) -r -o
@@ -478,7 +478,7 @@ ifdef lib-target · 33 unmodified lines
478478 quiet_cmd_link_l_target = AR $@
479479
480480 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)
482482 else
483483 cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
484484 endif
@@ -531,7 +531,7 @@ cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secana · 46 unmodified lines
531531
532532 ifdef CONFIG_THIN_ARCHIVES
533533 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)
535535 else
536536 quiet_cmd_link_multi-y = LD $@
537537 cmd_link_multi-y = $(cmd_link_multi-link)
scripts/link-vmlinux.sh+37−10
@@ -3,9 +3,12 @@ · 2 unmodified lines
33 # link vmlinux
44 #
55 # 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
7−# in the kernel tree, others are specified in arch/$(ARCH)/Makefile.
8−# Ordering when linking is important, and $(KBUILD_VMLINUX_INIT) must be first.
6+# $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.o files
7+# from top-level directories in the kernel tree, others are specified in
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.
912 #
1013 # vmlinux
1114 # ^
@@ -16,6 +19,9 @@ · 4 unmodified lines
1619 # +--< $(KBUILD_VMLINUX_MAIN)
1720 # | +--< drivers/built-in.o mm/built-in.o + more
1821 # |
22+# +--< $(KBUILD_VMLINUX_LIBS)
23+# | +--< lib/lib.a + more
24+# |
1925 # +-< ${kallsymso} (see description in KALLSYMS section)
2026 #
2127 # vmlinux version (uname -v) cannot be updated during normal
@@ -37,9 +43,10 @@ info() · 15 unmodified lines
3743 fi
3844 }
3945
40−# Thin archive build here makes a final archive with
41−# symbol table and indexes from vmlinux objects, which can be
42−# used as input to linker.
46+# Thin archive build here makes a final archive with symbol table and indexes
47+# from vmlinux objects INIT and MAIN, which can be used as input to linker.
48+# KBUILD_VMLINUX_LIBS archives should already have symbol table and indexes
49+# added.
4350 #
4451 # Traditional incremental style of link does not require this step
4552 #
@@ -50,7 +57,7 @@ archive_builtin() · 4 unmodified lines
5057 if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then
5158 info AR built-in.o
5259 rm -f built-in.o;
53− ${AR} rcsT${KBUILD_ARFLAGS} built-in.o \
60+ ${AR} rcsTP${KBUILD_ARFLAGS} built-in.o \
5461 ${KBUILD_VMLINUX_INIT} \
5562 ${KBUILD_VMLINUX_MAIN}
5663 fi
@@ -63,11 +70,17 @@ modpost_link() · 6 unmodified lines
6370 local objects
6471
6572 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"
6779 else
6880 objects="${KBUILD_VMLINUX_INIT} \
6981 --start-group \
7082 ${KBUILD_VMLINUX_MAIN} \
83+ ${KBUILD_VMLINUX_LIBS} \
7184 --end-group"
7285 fi
7386 ${LD} ${LDFLAGS} -r -o ${1} ${objects}
@@ -83,11 +96,18 @@ vmlinux_link() · 9 unmodified lines
8396
8497 if [ "${SRCARCH}" != "um" ]; then
8598 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}"
87106 else
88107 objects="${KBUILD_VMLINUX_INIT} \
89108 --start-group \
90109 ${KBUILD_VMLINUX_MAIN} \
110+ ${KBUILD_VMLINUX_LIBS} \
91111 --end-group \
92112 ${1}"
93113 fi
@@ -96,11 +116,18 @@ vmlinux_link() · 2 unmodified lines
96116 -T ${lds} ${objects}
97117 else
98118 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}"
100126 else
101127 objects="${KBUILD_VMLINUX_INIT} \
102128 -Wl,--start-group \
103129 ${KBUILD_VMLINUX_MAIN} \
130+ ${KBUILD_VMLINUX_LIBS} \
104131 -Wl,--end-group \
105132 ${1}"
106133 fi

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t