[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260204124542.523567-9-daniel@thingy.jp>
Date: Wed, 4 Feb 2026 21:45:40 +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 08/10] tools/nolibc: sh: Add relocation support
Add relocation support for SuperH
Signed-off-by: Daniel Palmer <daniel@...ngy.jp>
---
tools/include/nolibc/arch-sh.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tools/include/nolibc/arch-sh.h b/tools/include/nolibc/arch-sh.h
index 7a421197d104..8e0507977ca1 100644
--- a/tools/include/nolibc/arch-sh.h
+++ b/tools/include/nolibc/arch-sh.h
@@ -7,8 +7,16 @@
#ifndef _NOLIBC_ARCH_SH_H
#define _NOLIBC_ARCH_SH_H
+#include "elf.h"
+
+#ifdef R_SH_RELATIVE
+#define _NOLIBC_ARCH_HAS_RELOC
+#define _NOLIBC_ARCH_ELF32
+#endif
+
#include "compiler.h"
#include "crt.h"
+#include "reloc.h"
/*
* Syscalls for SuperH:
@@ -141,6 +149,22 @@
})
#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_SH_RELATIVE:
+ __relocate_rela_relative(base, entry);
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+#endif
+
/* startup code */
void _start_wrapper(void);
void __attribute__((weak,noreturn)) __nolibc_entrypoint __no_stack_protector _start_wrapper(void)
--
2.51.0
Powered by blists - more mailing lists