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

Unified · Split

12 files
  1. Documentation/kbuild/kbuild.txt +6 −2
  2. Documentation/process/changes.rst +4 −5
  3. Makefile +4 −4
  4. arch/Kconfig +1 −1
  5. arch/ia64/kernel/Makefile.gate +8 −7
  6. arch/powerpc/Kconfig +0 −8
  7. arch/sh/kernel/vsyscall/Makefile +8 −8
  8. arch/sparc/lib/hweight.S +8 −8
  9. arch/tile/kernel/vdso/Makefile +12 −14
  10. arch/x86/um/vdso/Makefile +1 −1
  11. scripts/Makefile.build +4 −4
  12. scripts/link-vmlinux.sh +37 −10
Documentation/kbuild/kbuild.txt+6−2
@@ -236,5 +236,9 @@ Files specified with KBUILD_VMLINUX_INIT are linked first. · 235 unmodified lines
236KBUILD_VMLINUX_MAIN236KBUILD_VMLINUX_MAIN
237--------------------------------------------------237--------------------------------------------------
238All object files for the main part of vmlinux.238All object files for the main part of vmlinux.
239KBUILD_VMLINUX_INIT and KBUILD_VMLINUX_MAIN together specify239
240all the object files used to link vmlinux.240KBUILD_VMLINUX_LIBS
241--------------------------------------------------
242All .a "lib" files for vmlinux.
243KBUILD_VMLINUX_INIT, KBUILD_VMLINUX_MAIN, and KBUILD_VMLINUX_LIBS together
244specify all the object files used to link vmlinux.
Documentation/process/changes.rst+4−5
@@ -31,7 +31,7 @@ you probably needn't concern yourself with isdn4k-utils. · 30 unmodified lines
31====================== =============== ========================================31====================== =============== ========================================
32GNU C 3.2 gcc --version32GNU C 3.2 gcc --version
33GNU make 3.81 make --version33GNU make 3.81 make --version
34binutils 2.12 ld -v34binutils 2.20 ld -v
35util-linux 2.10o fdformat --version35util-linux 2.10o fdformat --version
36module-init-tools 0.9.10 depmod -V36module-init-tools 0.9.10 depmod -V
37e2fsprogs 1.41.4 e2fsck -V37e2fsprogs 1.41.4 e2fsck -V
@@ -75,10 +75,9 @@ You will need GNU make 3.81 or later to build the kernel. · 37 unmodified lines
75Binutils75Binutils
76--------76--------
77 77
78Linux on IA-32 has recently switched from using ``as86`` to using ``gas`` for78The build system has, as of 4.13, switched to using thin archives (`ar T`)
79assembling the 16-bit boot code, removing the need for ``as86`` to compile79rather than incremental linking (`ld -r`) for built-in.o intermediate steps.
80your kernel. This change does, however, mean that you need a recent80This requires binutils 2.20 or newer.
81release of binutils.
82 81
83Perl82Perl
84----83----
Makefile+4−4
@@ -944,19 +944,19 @@ core-y := $(patsubst %/, %/built-in.o, $(core-y)) · 943 unmodified lines
944drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))944drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
945net-y := $(patsubst %/, %/built-in.o, $(net-y))945net-y := $(patsubst %/, %/built-in.o, $(net-y))
946libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))946libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
947libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))947libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.o, $(libs-y)))
948libs-y := $(libs-y1) $(libs-y2)
949virt-y := $(patsubst %/, %/built-in.o, $(virt-y))948virt-y := $(patsubst %/, %/built-in.o, $(virt-y))
950 949
951# Externally visible symbols (used by link-vmlinux.sh)950# Externally visible symbols (used by link-vmlinux.sh)
952export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)951export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
953export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) $(virt-y)952export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y)
953export KBUILD_VMLINUX_LIBS := $(libs-y1)
954export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds954export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
955export LDFLAGS_vmlinux955export LDFLAGS_vmlinux
956# used by scripts/pacmage/Makefile956# used by scripts/pacmage/Makefile
957export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools)957export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools)
958 958
959vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN)959vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS)
960 960
961# Include targets which we want to execute sequentially if the rest of the961# Include targets which we want to execute sequentially if the rest of the
962# kernel build went well. If CONFIG_TRIM_UNUSED_KSYMS is set, this might be962# kernel build went well. If CONFIG_TRIM_UNUSED_KSYMS is set, this might be
arch/Kconfig+1−1
@@ -550,7 +550,7 @@ config CC_STACKPROTECTOR_STRONG · 549 unmodified lines
550endchoice550endchoice
551 551
552config THIN_ARCHIVES552config THIN_ARCHIVES
553 bool553 def_bool y
554 help554 help
555 Select this if the architecture wants to use thin archives555 Select this if the architecture wants to use thin archives
556 instead of ld -r to create the built-in.o files.556 instead of ld -r to create the built-in.o files.
arch/ia64/kernel/Makefile.gate+8−7
@@ -1,8 +1,8 @@
1# The gate DSO image is built using a special linker script.1# The gate DSO image is built using a special linker script.
2 2
3targets += gate.so gate-syms.o3targets += gate.so gate.lds gate.o gate-dummy.o
4 4
5extra-y += gate.so gate-syms.o gate.lds gate.o5obj-y += gate-syms.o
6 6
7CPPFLAGS_gate.lds := -P -C -U$(ARCH)7CPPFLAGS_gate.lds := -P -C -U$(ARCH)
8 8
@@ -14,13 +14,14 @@ GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 \ · 5 unmodified lines
14$(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE14$(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE
15 $(call if_changed,gate)15 $(call if_changed,gate)
16 16
17$(obj)/built-in.o: $(obj)/gate-syms.o17GATECFLAGS_gate-dummy.o = -r
18$(obj)/built-in.o: ld_flags += -R $(obj)/gate-syms.o18$(obj)/gate-dummy.o: $(obj)/gate.lds $(obj)/gate.o FORCE
19
20GATECFLAGS_gate-syms.o = -r
21$(obj)/gate-syms.o: $(obj)/gate.lds $(obj)/gate.o FORCE
22 $(call if_changed,gate)19 $(call if_changed,gate)
23 20
21LDFLAGS_gate-syms.o := -r -R
22$(obj)/gate-syms.o: $(obj)/gate-dummy.o FORCE
23 $(call if_changed,ld)
24
24# gate-data.o contains the gate DSO image as data in section .data..gate.25# gate-data.o contains the gate DSO image as data in section .data..gate.
25# We must build gate.so before we can assemble it.26# We must build gate.so before we can assemble it.
26# Note: kbuild does not track this dependency due to usage of .incbin27# Note: kbuild does not track this dependency due to usage of .incbin
arch/powerpc/Kconfig+0−8
@@ -463,14 +463,6 @@ config MPROFILE_KERNEL · 462 unmodified lines
463 depends on PPC64 && CPU_LITTLE_ENDIAN463 depends on PPC64 && CPU_LITTLE_ENDIAN
464 def_bool !DISABLE_MPROFILE_KERNEL464 def_bool !DISABLE_MPROFILE_KERNEL
465 465
466config USE_THIN_ARCHIVES
467 bool "Build the kernel using thin archives"
468 default n
469 select THIN_ARCHIVES
470 help
471 Build the kernel using thin archives.
472 If you're unsure say N.
473
474config IOMMU_HELPER466config IOMMU_HELPER
475 def_bool PPC64467 def_bool PPC64
476 468
arch/sh/kernel/vsyscall/Makefile+8−8
@@ -1,11 +1,11 @@
1obj-y += vsyscall.o vsyscall-syscall.o1obj-y += vsyscall.o vsyscall-syscall.o vsyscall-syms.o
2 2
3$(obj)/vsyscall-syscall.o: \3$(obj)/vsyscall-syscall.o: \
4 $(foreach F,trapa,$(obj)/vsyscall-$F.so)4 $(foreach F,trapa,$(obj)/vsyscall-$F.so)
5 5
6# Teach kbuild about targets6# Teach kbuild about targets
7targets += $(foreach F,trapa,vsyscall-$F.o vsyscall-$F.so)7targets += $(foreach F,trapa,vsyscall-$F.o vsyscall-$F.so)
8targets += vsyscall-note.o vsyscall.lds8targets += vsyscall-note.o vsyscall.lds vsyscall-dummy.o
9 9
10# The DSO images are built using a special linker script10# The DSO images are built using a special linker script
11quiet_cmd_syscall = SYSCALL $@11quiet_cmd_syscall = SYSCALL $@
@@ -26,11 +26,11 @@ $(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE · 14 unmodified lines
26# We also create a special relocatable object that should mirror the symbol26# We also create a special relocatable object that should mirror the symbol
27# table and layout of the linked DSO. With ld -R we can then refer to27# table and layout of the linked DSO. With ld -R we can then refer to
28# these symbols in the kernel code rather than hand-coded addresses.28# these symbols in the kernel code rather than hand-coded addresses.
29extra-y += vsyscall-syms.o29SYSCFLAGS_vsyscall-dummy.o = -r
30$(obj)/built-in.o: $(obj)/vsyscall-syms.o30$(obj)/vsyscall-dummy.o: $(src)/vsyscall.lds \
31$(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o
32
33SYSCFLAGS_vsyscall-syms.o = -r
34$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds \
35 $(obj)/vsyscall-trapa.o $(obj)/vsyscall-note.o FORCE31 $(obj)/vsyscall-trapa.o $(obj)/vsyscall-note.o FORCE
36 $(call if_changed,syscall)32 $(call if_changed,syscall)
33
34LDFLAGS_vsyscall-syms.o := -r -R
35$(obj)/vsyscall-syms.o: $(obj)/vsyscall-dummy.o FORCE
36 $(call if_changed,ld)
arch/sparc/lib/hweight.S+8−8
@@ -4,9 +4,9 @@ · 3 unmodified lines
4 .text4 .text
5 .align 325 .align 32
6ENTRY(__arch_hweight8)6ENTRY(__arch_hweight8)
7 ba,pt %xcc, __sw_hweight87 sethi %hi(__sw_hweight8), %g1
8 jmpl %g1 + %lo(__sw_hweight8), %g0
8 nop9 nop
9 nop
10ENDPROC(__arch_hweight8)10ENDPROC(__arch_hweight8)
11EXPORT_SYMBOL(__arch_hweight8)11EXPORT_SYMBOL(__arch_hweight8)
12 .section .popc_3insn_patch, "ax"12 .section .popc_3insn_patch, "ax"
@@ -17,9 +17,9 @@ EXPORT_SYMBOL(__arch_hweight8) · 4 unmodified lines
17 .previous17 .previous
18 18
19ENTRY(__arch_hweight16)19ENTRY(__arch_hweight16)
20 ba,pt %xcc, __sw_hweight1620 sethi %hi(__sw_hweight16), %g1
21 jmpl %g1 + %lo(__sw_hweight16), %g0
21 nop22 nop
22 nop
23ENDPROC(__arch_hweight16)23ENDPROC(__arch_hweight16)
24EXPORT_SYMBOL(__arch_hweight16)24EXPORT_SYMBOL(__arch_hweight16)
25 .section .popc_3insn_patch, "ax"25 .section .popc_3insn_patch, "ax"
@@ -30,9 +30,9 @@ EXPORT_SYMBOL(__arch_hweight16) · 4 unmodified lines
30 .previous30 .previous
31 31
32ENTRY(__arch_hweight32)32ENTRY(__arch_hweight32)
33 ba,pt %xcc, __sw_hweight3233 sethi %hi(__sw_hweight32), %g1
34 jmpl %g1 + %lo(__sw_hweight32), %g0
34 nop35 nop
35 nop
36ENDPROC(__arch_hweight32)36ENDPROC(__arch_hweight32)
37EXPORT_SYMBOL(__arch_hweight32)37EXPORT_SYMBOL(__arch_hweight32)
38 .section .popc_3insn_patch, "ax"38 .section .popc_3insn_patch, "ax"
@@ -43,9 +43,9 @@ EXPORT_SYMBOL(__arch_hweight32) · 4 unmodified lines
43 .previous43 .previous
44 44
45ENTRY(__arch_hweight64)45ENTRY(__arch_hweight64)
46 ba,pt %xcc, __sw_hweight6446 sethi %hi(__sw_hweight16), %g1
47 jmpl %g1 + %lo(__sw_hweight16), %g0
47 nop48 nop
48 nop
49ENDPROC(__arch_hweight64)49ENDPROC(__arch_hweight64)
50EXPORT_SYMBOL(__arch_hweight64)50EXPORT_SYMBOL(__arch_hweight64)
51 .section .popc_3insn_patch, "ax"51 .section .popc_3insn_patch, "ax"
arch/tile/kernel/vdso/Makefile+12−14
@@ -5,15 +5,14 @@ vdso-syms = rt_sigreturn gettimeofday · 4 unmodified lines
5obj-vdso = $(patsubst %, v%.o, $(vdso-syms))5obj-vdso = $(patsubst %, v%.o, $(vdso-syms))
6 6
7# Build rules7# Build rules
8targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds8targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o
9obj-vdso := $(addprefix $(obj)/, $(obj-vdso))9obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
10 10
11# vdso32 is only for tilegx -m32 compat task.11# vdso32 is only for tilegx -m32 compat task.
12VDSO32-$(CONFIG_COMPAT) := y12VDSO32-$(CONFIG_COMPAT) := y
13 13
14obj-y += vdso.o14obj-y += vdso.o vdso-syms.o
15obj-$(VDSO32-y) += vdso32.o15obj-$(VDSO32-y) += vdso32.o
16extra-y += vdso.lds
17CPPFLAGS_vdso.lds += -P -C -U$(ARCH)16CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
18 17
19# vDSO code runs in userspace and -pg doesn't help with profiling anyway.18# vDSO code runs in userspace and -pg doesn't help with profiling anyway.
@@ -42,23 +41,22 @@ $(obj)/vdso.o: $(obj)/vdso.so · 22 unmodified lines
42 41
43# link rule for the .so file, .lds has to be first42# link rule for the .so file, .lds has to be first
44SYSCFLAGS_vdso.so.dbg = $(c_flags)43SYSCFLAGS_vdso.so.dbg = $(c_flags)
45$(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso)44$(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
46 $(call if_changed,vdsold)45 $(call if_changed,vdsold)
47 46
48
49# We also create a special relocatable object that should mirror the symbol47# We also create a special relocatable object that should mirror the symbol
50# table and layout of the linked DSO. With ld -R we can then refer to48# table and layout of the linked DSO. With ld -R we can then refer to
51# these symbols in the kernel code rather than hand-coded addresses.49# these symbols in the kernel code rather than hand-coded addresses.
52extra-y += vdso-syms.o
53$(obj)/built-in.o: $(obj)/vdso-syms.o
54$(obj)/built-in.o: ld_flags += -R $(obj)/vdso-syms.o
55 50
56SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \51SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
57 $(call cc-ldoption, -Wl$(comma)--hash-style=both)52 $(call cc-ldoption, -Wl$(comma)--hash-style=both)
58SYSCFLAGS_vdso_syms.o = -r53SYSCFLAGS_vdso_dummy.o = -r
59$(obj)/vdso-syms.o: $(src)/vdso.lds $(obj)/vrt_sigreturn.o FORCE54$(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/vrt_sigreturn.o FORCE
60 $(call if_changed,vdsold)55 $(call if_changed,vdsold)
61 56
57LDFLAGS_vdso-syms.o := -r -R
58$(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE
59 $(call if_changed,ld)
62 60
63# strip rule for the .so file61# strip rule for the .so file
64$(obj)/%.so: OBJCOPYFLAGS := -S62$(obj)/%.so: OBJCOPYFLAGS := -S
@@ -96,17 +94,17 @@ KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) · 31 unmodified lines
96KBUILD_CFLAGS_32 += -m32 -fPIC -shared94KBUILD_CFLAGS_32 += -m32 -fPIC -shared
97 95
98obj-vdso32 = $(patsubst %, v%32.o, $(vdso-syms))96obj-vdso32 = $(patsubst %, v%32.o, $(vdso-syms))
99obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
100 97
101targets += $(obj-vdso32) vdso32.so vdso32.so.dbg98targets += $(obj-vdso32) vdso32.so vdso32.so.dbg
99obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
102 100
103$(obj-vdso32:%=%): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)101$(obj-vdso32:%=%): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
104$(obj-vdso32:%=%): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)102$(obj-vdso32:%=%): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
105 103
106$(obj)/vgettimeofday32.o: $(obj)/vgettimeofday.c104$(obj)/vgettimeofday32.o: $(obj)/vgettimeofday.c FORCE
107 $(call if_changed_rule,cc_o_c)105 $(call if_changed_rule,cc_o_c)
108 106
109$(obj)/vrt_sigreturn32.o: $(obj)/vrt_sigreturn.S107$(obj)/vrt_sigreturn32.o: $(obj)/vrt_sigreturn.S FORCE
110 $(call if_changed,as_o_S)108 $(call if_changed,as_o_S)
111 109
112# Force dependency110# Force dependency
@@ -114,5 +112,5 @@ $(obj)/vdso32.o: $(obj)/vdso32.so · 1 unmodified line
114 112
115SYSCFLAGS_vdso32.so.dbg = -m32 -shared -s -Wl,-soname=linux-vdso32.so.1 \113SYSCFLAGS_vdso32.so.dbg = -m32 -shared -s -Wl,-soname=linux-vdso32.so.1 \
116 $(call cc-ldoption, -Wl$(comma)--hash-style=both)114 $(call cc-ldoption, -Wl$(comma)--hash-style=both)
117$(obj)/vdso32.so.dbg: $(src)/vdso.lds $(obj-vdso32)115$(obj)/vdso32.so.dbg: $(src)/vdso.lds $(obj-vdso32) FORCE
118 $(call if_changed,vdsold)116 $(call if_changed,vdsold)
arch/x86/um/vdso/Makefile+1−1
@@ -53,7 +53,7 @@ CFLAGS_REMOVE_vdso-note.o = -pg -fprofile-arcs -ftest-coverage · 52 unmodified lines
53CFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage53CFLAGS_REMOVE_um_vdso.o = -pg -fprofile-arcs -ftest-coverage
54 54
55targets += vdso-syms.lds55targets += vdso-syms.lds
56obj-$(VDSO64-y) += vdso-syms.lds56extra-$(VDSO64-y) += vdso-syms.lds
57 57
58#58#
59# Match symbols in the DSO that look like VDSO*; produce a file of constants.59# Match symbols in the DSO that look like VDSO*; produce a file of constants.
scripts/Makefile.build+4−4
@@ -437,8 +437,8 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ; · 436 unmodified lines
437ifdef builtin-target437ifdef builtin-target
438 438
439ifdef CONFIG_THIN_ARCHIVES439ifdef 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 $@
443else443else
444 cmd_make_builtin = $(LD) $(ld_flags) -r -o444 cmd_make_builtin = $(LD) $(ld_flags) -r -o
@@ -478,7 +478,7 @@ ifdef lib-target · 33 unmodified lines
478quiet_cmd_link_l_target = AR $@478quiet_cmd_link_l_target = AR $@
479 479
480ifdef CONFIG_THIN_ARCHIVES480ifdef 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)
482else482else
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)
484endif484endif
@@ -531,7 +531,7 @@ cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secana · 46 unmodified lines
531 531
532ifdef CONFIG_THIN_ARCHIVES532ifdef 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)
535else535else
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)
scripts/link-vmlinux.sh+37−10
@@ -3,9 +3,12 @@ · 2 unmodified lines
3# link vmlinux3# link vmlinux
4#4#
5# vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and5# 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 directories6# $(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# vmlinux13# 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 + more20# | +--< 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 normal27# vmlinux version (uname -v) cannot be updated during normal
@@ -37,9 +43,10 @@ info() · 15 unmodified lines
37 fi43 fi
38}44}
39 45
40# Thin archive build here makes a final archive with46# Thin archive build here makes a final archive with symbol table and indexes
41# symbol table and indexes from vmlinux objects, which can be47# 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 step51# 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}" ]; then57 if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then
51 info AR built-in.o58 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 fi63 fi
@@ -63,11 +70,17 @@ modpost_link() · 6 unmodified lines
63 local objects70 local objects
64 71
65 if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then72 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 else79 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 fi85 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" ]; then97 if [ "${SRCARCH}" != "um" ]; then
85 if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then98 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 else106 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 fi113 fi
@@ -96,11 +116,18 @@ vmlinux_link() · 2 unmodified lines
96 -T ${lds} ${objects}116 -T ${lds} ${objects}
97 else117 else
98 if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then118 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 else126 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 fi133 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