未验证 提交 fcae44fd 编写于 作者: N Nathan Chancellor 提交者: Palmer Dabbelt

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: https://github.com/ClangBuiltLinux/linux/issues/1756Signed-off-by: NNathan Chancellor <nathan@kernel.org>
Tested-by: NConor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20221108171324.3377226-1-nathan@kernel.org/Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
上级 50e63dd8
...@@ -28,6 +28,9 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) ...@@ -28,6 +28,9 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
obj-y += vdso.o obj-y += vdso.o
CPPFLAGS_vdso.lds += -P -C -U$(ARCH) CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
ifneq ($(filter vgettimeofday, $(vdso-syms)),)
CPPFLAGS_vdso.lds += -DHAS_VGETTIMEOFDAY
endif
# Disable -pg to prevent insert call site # Disable -pg to prevent insert call site
CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE)
......
...@@ -68,9 +68,11 @@ VERSION ...@@ -68,9 +68,11 @@ VERSION
LINUX_4.15 { LINUX_4.15 {
global: global:
__vdso_rt_sigreturn; __vdso_rt_sigreturn;
#ifdef HAS_VGETTIMEOFDAY
__vdso_gettimeofday; __vdso_gettimeofday;
__vdso_clock_gettime; __vdso_clock_gettime;
__vdso_clock_getres; __vdso_clock_getres;
#endif
__vdso_getcpu; __vdso_getcpu;
__vdso_flush_icache; __vdso_flush_icache;
local: *; local: *;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册