Add relocation support for arm.
Signed-off-by: Daniel Palmer <daniel@thingy.jp>
---
tools/include/nolibc/arch-arm.h | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/tools/include/nolibc/arch-arm.h b/tools/include/nolibc/arch-arm.h
index 251c42579028..0a0d864c857a 100644
--- a/tools/include/nolibc/arch-arm.h
+++ b/tools/include/nolibc/arch-arm.h
@@ -7,8 +7,17 @@
#ifndef _NOLIBC_ARCH_ARM_H
#define _NOLIBC_ARCH_ARM_H
+#include "elf.h"
+
+#ifdef R_ARM_RELATIVE
+#define _NOLIBC_ARCH_HAS_RELOC
+#define _NOLIBC_ARCH_ELF32
+#define _NOLIBC_ARCH_ELF_REL
+#endif
+
#include "compiler.h"
#include "crt.h"
+#include "reloc.h"
/* Syscalls for ARM in ARM or Thumb modes :
* - registers are 32-bit
@@ -185,6 +194,22 @@
})
#ifndef NOLIBC_NO_RUNTIME
+
+#ifdef NOLIBC_WANT_RELOC
+static __inline__ int __relocate_rel(unsigned long base, _nolibc_elf_rel *entry)
+{
+ switch (_nolibc_elf_r_type(entry->r_info)) {
+ case R_ARM_RELATIVE:
+ __relocate_rel_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