]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
RISC-V: vdso: Do not add missing symbols to version section in linker script
authorNathan Chancellor <nathan@kernel.org>
Tue, 8 Nov 2022 17:13:23 +0000 (10:13 -0700)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Dec 2022 13:00:25 +0000 (14:00 +0100)
[ Upstream commit fcae44fd36d052e956e69a64642fc03820968d78 ]

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/1756
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20221108171324.3377226-1-nathan@kernel.org/
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 144452b42143c380d5b59a694cc66ce91afc84aa)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
arch/riscv/kernel/vdso/Makefile
arch/riscv/kernel/vdso/vdso.lds.S

index 84ac0fe612e79118b23a645871c0304b976ad16b..db6548509bb3e1df127ef1b7f3d3dd5ffd883b18 100644 (file)
@@ -28,6 +28,9 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
 
 obj-y += vdso.o
 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
 CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE)
index e9111f700af08062850cca8ba9e1684749aaa2fa..3729cb28aac8d739672af11766866a399002a124 100644 (file)
@@ -65,9 +65,11 @@ VERSION
        LINUX_4.15 {
        global:
                __vdso_rt_sigreturn;
+#ifdef HAS_VGETTIMEOFDAY
                __vdso_gettimeofday;
                __vdso_clock_gettime;
                __vdso_clock_getres;
+#endif
                __vdso_getcpu;
                __vdso_flush_icache;
        local: *;