Skip to content

Commit fcae44f

Browse files
nathanchancepalmer-dabbelt
authored andcommitted
RISC-V: vdso: Do not add missing symbols to version section in linker script
Recently, ld.lld moved from '--undefined-version' to '--no-undefined-version' as the default, which breaks the compat vDSO build: ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_gettimeofday' failed: symbol not defined ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_clock_gettime' failed: symbol not defined ld.lld: error: version script assignment of 'LINUX_4.15' to symbol '__vdso_clock_getres' failed: symbol not defined These symbols are not present in the compat vDSO or the regular vDSO for 32-bit but they are unconditionally included in the version section of the linker script, which is prohibited with '--no-undefined-version'. Fix this issue by only including the symbols that are actually exported in the version section of the linker script. Link: ClangBuiltLinux#1756 Signed-off-by: Nathan Chancellor <[email protected]> Tested-by: Conor Dooley <[email protected]> Link: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 50e63dd commit fcae44f

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

arch/riscv/kernel/vdso/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
2828

2929
obj-y += vdso.o
3030
CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
31+
ifneq ($(filter vgettimeofday, $(vdso-syms)),)
32+
CPPFLAGS_vdso.lds += -DHAS_VGETTIMEOFDAY
33+
endif
3134

3235
# Disable -pg to prevent insert call site
3336
CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE)

arch/riscv/kernel/vdso/vdso.lds.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ VERSION
6868
LINUX_4.15 {
6969
global:
7070
__vdso_rt_sigreturn;
71+
#ifdef HAS_VGETTIMEOFDAY
7172
__vdso_gettimeofday;
7273
__vdso_clock_gettime;
7374
__vdso_clock_getres;
75+
#endif
7476
__vdso_getcpu;
7577
__vdso_flush_icache;
7678
local: *;

0 commit comments

Comments
 (0)