Commit 6f1a6ae8 authored by Will Deacon's avatar Will Deacon Committed by Catalin Marinas

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

This patch fixes the problem by explicitly passing -shared to the linker
when building the vDSO.

Cc: <>
Reported-by: default avatarSzabolcs Nagy <>
Reported-by: default avatarJames Greenlaigh <>
Signed-off-by: default avatarWill Deacon <>
Signed-off-by: default avatarCatalin Marinas <>
parent af391b15
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment