[PATCH v4 16/24] powerpc/vdso: Enable the vdsocheck tool
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Aug 12 15:44:29 AEST 2025
The vdsocheck tool validates the object files and final .so library.
It can detect if the compiler created relocations which are incompatible
with the vDSO which need to be worked around.
Wire it up for the architecture.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
arch/powerpc/kernel/vdso/Makefile | 4 ++--
lib/vdso/Kconfig | 1 +
lib/vdso/check/vdsocheck.rs | 25 +++++++++++++++++++++++++
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index 8834dfe9d72796c8f1e20b84ebcb33a6b74b82f0..193af6877eba25898aeaf55a04cd834f7a2eb753 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -75,9 +75,9 @@ targets += vdso64.lds
CPPFLAGS_vdso64.lds += -P -C
# link rule for the .so file, .lds has to be first
-$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o FORCE
+$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o $(vdsocheck) FORCE
$(call if_changed,vdso32ld_and_check)
-$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o $(obj)/vgetrandom-64.o FORCE
+$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o $(obj)/vgetrandom-64.o $(vdsocheck) FORCE
$(call if_changed,vdso64ld_and_check)
# assembly rules for the .S files
diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig
index 3037b15476bb60ee47c1e083eae3968ab9604f59..8994419d90e7b5c66ac77449b6c3bd96c968983d 100644
--- a/lib/vdso/Kconfig
+++ b/lib/vdso/Kconfig
@@ -54,6 +54,7 @@ config HAVE_VDSOCHECK
default y if X86
default y if ARM
default y if ARM64
+ default y if PPC
help
Selected for architectures that are supported by the 'vdsocheck' progam.
Only transitional.
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index a695aed95ad391a0c55e5388bc6d1f1141fd784e..54372a547b1cde05c1a4454b9a21de357b22b0df 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -65,6 +65,31 @@ fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'s
bindings::R_AARCH64_CALL26,
],
}),
+ bindings::EM_PPC => Some(AllowedRelocations {
+ ignored_object_file_sections: None,
+ in_object_file: &[
+ bindings::R_PPC_REL24,
+ bindings::R_PPC_REL14,
+ bindings::R_PPC_REL32,
+ bindings::R_PPC_REL16,
+ bindings::R_PPC_REL16_LO,
+ bindings::R_PPC_REL16_HI,
+ bindings::R_PPC_REL16_HA,
+ ],
+ }),
+ bindings::EM_PPC64 => Some(AllowedRelocations {
+ ignored_object_file_sections: None,
+ in_object_file: &[
+ bindings::R_PPC64_REL24,
+ bindings::R_PPC64_REL14,
+ bindings::R_PPC64_REL32,
+ bindings::R_PPC64_REL64,
+ bindings::R_PPC64_REL16,
+ bindings::R_PPC64_REL16_LO,
+ bindings::R_PPC64_REL16_HI,
+ bindings::R_PPC64_REL16_HA,
+ ],
+ }),
_ => None,
}
}
--
2.50.1
More information about the Linuxppc-dev
mailing list