path: root/arch/arm64/kernel/vdso/Makefile
diff options
authorWill Deacon <>2015-06-19 13:56:33 +0100
committerCatalin Marinas <>2015-06-19 14:54:10 +0100
commit6f1a6ae87c0c60d7c462ef8fd071f291aa7a9abb (patch)
treedd7bb673e7bf89cd9db13f5db3b27e9bb4d7160b /arch/arm64/kernel/vdso/Makefile
parentaf391b15f7b56ce19f52862d36595637dd42b575 (diff)
arm64: vdso: work-around broken ELF toolchains in Makefile
When building the kernel with a bare-metal (ELF) toolchain, the -shared option may not be passed down to collect2, resulting in silent corruption of the vDSO image (in particular, the DYNAMIC section is omitted). The effect of this corruption is that the dynamic linker fails to find the vDSO symbols and libc is instead used for the syscalls that we intended to optimise (e.g. gettimeofday). Functionally, there is no issue as the sigreturn trampoline is still intact and located by the kernel. This patch fixes the problem by explicitly passing -shared to the linker when building the vDSO. Cc: <> Reported-by: Szabolcs Nagy <> Reported-by: James Greenlaigh <> Signed-off-by: Will Deacon <> Signed-off-by: Catalin Marinas <>
Diffstat (limited to 'arch/arm64/kernel/vdso/Makefile')
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index ff3bddea482d..f6fe17d88da5 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -15,6 +15,10 @@ ccflags-y := -shared -fno-common -fno-builtin
ccflags-y += -nostdlib -Wl, \
$(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared
+# down to collect2, resulting in silent corruption of the vDSO image.
+ccflags-y += -Wl,-shared
obj-y += vdso.o
extra-y += vdso-offsets.h += -P -C -U$(ARCH)