diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-10 20:48:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-10 20:48:21 -0400 |
commit | ffd602eb4693bbb49b301fa059b109bbdebf9524 (patch) | |
tree | a7be15ffb7fe1a23dde4dc2831670f3abed6ce95 /scripts/link-vmlinux.sh | |
parent | 5af7f115886f7ec193171e2e49b8000ddd1e7147 (diff) | |
parent | 9250d20e9ecedab6aa331a127fbfc1272383ed72 (diff) |
Merge tag 'kbuild-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada:
- do not generate unneeded top-level built-in.a
- let git ignore O= directory entirely
- optimize scripts/kallsyms slightly
- exclude DWARF info from *.s regardless of config options
- fix GCC toolchain search path for Clang to prepare ld.lld support
- do not generate modules.order when CONFIG_MODULES is disabled
- simplify single target rules and remove VPATH for external module
build
- allow to add optional flags to dpkg-buildpackage when building
deb-pkg
- move some compiler option tests from Makefile to Kconfig
- various Makefile cleanups
* tag 'kbuild-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (40 commits)
kbuild: remove scripts/basic/% build target
kbuild: use -Werror=implicit-... instead of -Werror-implicit-...
kbuild: clean up scripts/gcc-version.sh
kbuild: remove cc-version macro
kbuild: update comment block of scripts/clang-version.sh
kbuild: remove commented-out INITRD_COMPRESS
kbuild: move -gsplit-dwarf, -gdwarf-4 option tests to Kconfig
kbuild: [bin]deb-pkg: add DPKG_FLAGS variable
kbuild: move ".config not found!" message from Kconfig to Makefile
kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing
kbuild: simplify single target rules
kbuild: remove empty rules for makefiles
kbuild: make -r/-R effective in top Makefile for old Make versions
kbuild: move tools_silent to a more relevant place
kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig
kbuild: refactor cc-cross-prefix implementation
kbuild: hardcode genksyms path and remove GENKSYMS variable
scripts/gdb: refactor rules for symlink creation
kbuild: create symlink to vmlinux-gdb.py in scripts_gdb target
scripts/gdb: do not descend into scripts/gdb from scripts
...
Diffstat (limited to 'scripts/link-vmlinux.sh')
-rwxr-xr-x | scripts/link-vmlinux.sh | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index c8cf45362bd6..bc7f1fc1f55b 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh | |||
@@ -3,22 +3,17 @@ | |||
3 | # | 3 | # |
4 | # link vmlinux | 4 | # link vmlinux |
5 | # | 5 | # |
6 | # vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and | 6 | # vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_OBJS) and |
7 | # $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.a files | 7 | # $(KBUILD_VMLINUX_LIBS). Most are built-in.a files from top-level directories |
8 | # from top-level directories in the kernel tree, others are specified in | 8 | # in the kernel tree, others are specified in arch/$(ARCH)/Makefile. |
9 | # arch/$(ARCH)/Makefile. Ordering when linking is important, and | 9 | # $(KBUILD_VMLINUX_LIBS) are archives which are linked conditionally |
10 | # $(KBUILD_VMLINUX_INIT) must be first. $(KBUILD_VMLINUX_LIBS) are archives | 10 | # (not within --whole-archive), and do not require symbol indexes added. |
11 | # which are linked conditionally (not within --whole-archive), and do not | ||
12 | # require symbol indexes added. | ||
13 | # | 11 | # |
14 | # vmlinux | 12 | # vmlinux |
15 | # ^ | 13 | # ^ |
16 | # | | 14 | # | |
17 | # +-< $(KBUILD_VMLINUX_INIT) | 15 | # +--< $(KBUILD_VMLINUX_OBJS) |
18 | # | +--< init/version.o + more | 16 | # | +--< init/built-in.a drivers/built-in.a mm/built-in.a + more |
19 | # | | ||
20 | # +--< $(KBUILD_VMLINUX_MAIN) | ||
21 | # | +--< drivers/built-in.a mm/built-in.a + more | ||
22 | # | | 17 | # | |
23 | # +--< $(KBUILD_VMLINUX_LIBS) | 18 | # +--< $(KBUILD_VMLINUX_LIBS) |
24 | # | +--< lib/lib.a + more | 19 | # | +--< lib/lib.a + more |
@@ -44,24 +39,6 @@ info() | |||
44 | fi | 39 | fi |
45 | } | 40 | } |
46 | 41 | ||
47 | # Thin archive build here makes a final archive with symbol table and indexes | ||
48 | # from vmlinux objects INIT and MAIN, which can be used as input to linker. | ||
49 | # KBUILD_VMLINUX_LIBS archives should already have symbol table and indexes | ||
50 | # added. | ||
51 | # | ||
52 | # Traditional incremental style of link does not require this step | ||
53 | # | ||
54 | # built-in.a output file | ||
55 | # | ||
56 | archive_builtin() | ||
57 | { | ||
58 | info AR built-in.a | ||
59 | rm -f built-in.a; | ||
60 | ${AR} rcsTP${KBUILD_ARFLAGS} built-in.a \ | ||
61 | ${KBUILD_VMLINUX_INIT} \ | ||
62 | ${KBUILD_VMLINUX_MAIN} | ||
63 | } | ||
64 | |||
65 | # Link of vmlinux.o used for section mismatch analysis | 42 | # Link of vmlinux.o used for section mismatch analysis |
66 | # ${1} output file | 43 | # ${1} output file |
67 | modpost_link() | 44 | modpost_link() |
@@ -69,7 +46,7 @@ modpost_link() | |||
69 | local objects | 46 | local objects |
70 | 47 | ||
71 | objects="--whole-archive \ | 48 | objects="--whole-archive \ |
72 | built-in.a \ | 49 | ${KBUILD_VMLINUX_OBJS} \ |
73 | --no-whole-archive \ | 50 | --no-whole-archive \ |
74 | --start-group \ | 51 | --start-group \ |
75 | ${KBUILD_VMLINUX_LIBS} \ | 52 | ${KBUILD_VMLINUX_LIBS} \ |
@@ -88,7 +65,7 @@ vmlinux_link() | |||
88 | 65 | ||
89 | if [ "${SRCARCH}" != "um" ]; then | 66 | if [ "${SRCARCH}" != "um" ]; then |
90 | objects="--whole-archive \ | 67 | objects="--whole-archive \ |
91 | built-in.a \ | 68 | ${KBUILD_VMLINUX_OBJS} \ |
92 | --no-whole-archive \ | 69 | --no-whole-archive \ |
93 | --start-group \ | 70 | --start-group \ |
94 | ${KBUILD_VMLINUX_LIBS} \ | 71 | ${KBUILD_VMLINUX_LIBS} \ |
@@ -99,7 +76,7 @@ vmlinux_link() | |||
99 | -T ${lds} ${objects} | 76 | -T ${lds} ${objects} |
100 | else | 77 | else |
101 | objects="-Wl,--whole-archive \ | 78 | objects="-Wl,--whole-archive \ |
102 | built-in.a \ | 79 | ${KBUILD_VMLINUX_OBJS} \ |
103 | -Wl,--no-whole-archive \ | 80 | -Wl,--no-whole-archive \ |
104 | -Wl,--start-group \ | 81 | -Wl,--start-group \ |
105 | ${KBUILD_VMLINUX_LIBS} \ | 82 | ${KBUILD_VMLINUX_LIBS} \ |
@@ -160,7 +137,6 @@ cleanup() | |||
160 | rm -f .tmp_System.map | 137 | rm -f .tmp_System.map |
161 | rm -f .tmp_kallsyms* | 138 | rm -f .tmp_kallsyms* |
162 | rm -f .tmp_vmlinux* | 139 | rm -f .tmp_vmlinux* |
163 | rm -f built-in.a | ||
164 | rm -f System.map | 140 | rm -f System.map |
165 | rm -f vmlinux | 141 | rm -f vmlinux |
166 | rm -f vmlinux.o | 142 | rm -f vmlinux.o |
@@ -217,8 +193,6 @@ fi; | |||
217 | # final build of init/ | 193 | # final build of init/ |
218 | ${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init | 194 | ${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init |
219 | 195 | ||
220 | archive_builtin | ||
221 | |||
222 | #link vmlinux.o | 196 | #link vmlinux.o |
223 | info LD vmlinux.o | 197 | info LD vmlinux.o |
224 | modpost_link vmlinux.o | 198 | modpost_link vmlinux.o |