summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2017-06-19 11:52:05 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-06-29 20:03:03 -0400
commit3a166fc2d4ef7a6b7e440271ee6bd1799c066605 (patch)
treef0c4ea695592ad123e22c85d649ec917796a6652 /Makefile
parent9a6cfca4f4130444cb02536a4fdf7b6e285c713e (diff)
kbuild: handle libs-y archives separately from built-in.o archives
The thin archives build currently puts all lib.a and built-in.o files together and links them with --whole-archive. This works because thin archives can recursively refer to thin archives. However some architectures include libgcc.a, which may not be a thin archive, or it may not be constructed with the "P" option, in which case its contents do not get linked correctly. So don't pull .a libs into the root built-in.o archive. These libs should already have symbol tables and indexes built, so they can be direct linker inputs. Move them out of the --whole-archive option, which restore the conditional linking behaviour of lib.a to thin archives builds. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile8
1 files changed, 4 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 853ae9179af9..1177775fa410 100644
--- a/Makefile
+++ b/Makefile
@@ -952,19 +952,19 @@ core-y := $(patsubst %/, %/built-in.o, $(core-y))
952drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y)) 952drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
953net-y := $(patsubst %/, %/built-in.o, $(net-y)) 953net-y := $(patsubst %/, %/built-in.o, $(net-y))
954libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)) 954libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
955libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y)) 955libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.o, $(libs-y)))
956libs-y := $(libs-y1) $(libs-y2)
957virt-y := $(patsubst %/, %/built-in.o, $(virt-y)) 956virt-y := $(patsubst %/, %/built-in.o, $(virt-y))
958 957
959# Externally visible symbols (used by link-vmlinux.sh) 958# Externally visible symbols (used by link-vmlinux.sh)
960export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) 959export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
961export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) $(virt-y) 960export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y)
961export KBUILD_VMLINUX_LIBS := $(libs-y1)
962export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds 962export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
963export LDFLAGS_vmlinux 963export LDFLAGS_vmlinux
964# used by scripts/pacmage/Makefile 964# used by scripts/pacmage/Makefile
965export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools) 965export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools)
966 966
967vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) 967vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS)
968 968
969# Include targets which we want to execute sequentially if the rest of the 969# Include targets which we want to execute sequentially if the rest of the
970# kernel build went well. If CONFIG_TRIM_UNUSED_KSYMS is set, this might be 970# kernel build went well. If CONFIG_TRIM_UNUSED_KSYMS is set, this might be