[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260204124542.523567-10-daniel@thingy.jp>
Date: Wed, 4 Feb 2026 21:45:41 +0900
From: Daniel Palmer <daniel@...ngy.jp>
To: w@....eu,
linux@...ssschuh.net
Cc: linux-kernel@...r.kernel.org,
Daniel Palmer <daniel@...ngy.jp>
Subject: [RFC PATCH v2 09/10] tools/nolibc: ppc: Add relocation support
Add relocation support for 32bit and 64bit ppc.
Signed-off-by: Daniel Palmer <daniel@...ngy.jp>
---
tools/include/nolibc/arch-powerpc.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tools/include/nolibc/arch-powerpc.h b/tools/include/nolibc/arch-powerpc.h
index e0c7e0b81f7c..a23c41b51cf7 100644
--- a/tools/include/nolibc/arch-powerpc.h
+++ b/tools/include/nolibc/arch-powerpc.h
@@ -7,8 +7,16 @@
#ifndef _NOLIBC_ARCH_POWERPC_H
#define _NOLIBC_ARCH_POWERPC_H
+#include "elf.h"
+
+#define _NOLIBC_ARCH_HAS_RELOC
+#ifndef __powerpc64__
+#define _NOLIBC_ARCH_ELF32
+#endif
+
#include "compiler.h"
#include "crt.h"
+#include "reloc.h"
/* Syscalls for PowerPC :
* - stack is 16-byte aligned
@@ -184,6 +192,22 @@
#endif /* !__powerpc64__ */
#ifndef NOLIBC_NO_RUNTIME
+
+#ifdef NOLIBC_WANT_RELOC
+static __inline__ int __relocate_rela(unsigned long base, _nolibc_elf_rela *entry)
+{
+ switch (_nolibc_elf_r_type(entry->r_info)) {
+ case R_PPC_RELATIVE:
+ __relocate_rela_relative(base, entry);
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+#endif /* NOLIBC_WANT_RELOC */
+
/* startup code */
void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
{
--
2.51.0
Powered by blists - more mailing lists