Morello LLVM allows opting into distinguishing between function pointers
(which may be interposed on by a compartmentalisation runtime) and code
pointers (which always directly point to specific instructions, for
cases like C++ landing pads and GNU C indirect goto). Supporting both
relocations (which are equivalent for kselftest's non-compartmentalised
purposes) will allow for Morello LLVM to make this opt-in behaviour
always-on, reducing the number of ABI combinations.
Signed-off-by: Jessica Clarke <jrtc27(a)jrtc27.com>
---
.../selftests/arm64/morello/freestanding_init_globals.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/arm64/morello/freestanding_init_globals.c b/tools/testing/selftests/arm64/morello/freestanding_init_globals.c
index 12eb0af97..2fa2aa643 100644
--- a/tools/testing/selftests/arm64/morello/freestanding_init_globals.c
+++ b/tools/testing/selftests/arm64/morello/freestanding_init_globals.c
@@ -38,6 +38,9 @@
#ifndef R_MORELLO_RELATIVE
#define R_MORELLO_RELATIVE 59395
#endif
+#ifndef R_MORELLO_FUNC_RELATIVE
+#define R_MORELLO_FUNC_RELATIVE 59400
+#endif
struct cap_reloc {
size_t capability_location;
@@ -181,7 +184,8 @@ void __morello_process_dynamic_relocs(void *auxv)
for (reloc = rela_dyn_start; reloc < rela_dyn_end; ++reloc) {
uintptr_t *reloc_addr, value;
- if (reloc->r_info != R_MORELLO_RELATIVE)
+ if (reloc->r_info != R_MORELLO_RELATIVE &&
+ reloc->r_info != R_MORELLO_FUNC_RELATIVE)
continue;
reloc_addr = (uintptr_t *)cheri_address_set(cap_rw, reloc->r_offset);
value = morello_relative(0, cap_rx, cap_rw, reloc, reloc_addr);
--
2.34.1