[rtems commit] libdl/arm: Add support for ARM trampolines
Chris Johns
chrisj at rtems.org
Sun Aug 4 02:36:12 UTC 2019
Module: rtems
Branch: master
Commit: 8c66acc8dcb4d459c1f61f2d5f62a23d14e3af46
Changeset: http://git.rtems.org/rtems/commit/?id=8c66acc8dcb4d459c1f61f2d5f62a23d14e3af46
Author: Chris Johns <chrisj at rtems.org>
Date: Tue Jul 30 20:43:15 2019 +1000
libdl/arm: Add support for ARM trampolines
Closes #3776
---
cpukit/libdl/rtl-mdreloc-arm.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/cpukit/libdl/rtl-mdreloc-arm.c b/cpukit/libdl/rtl-mdreloc-arm.c
index 9e5d66e..4950dcd 100644
--- a/cpukit/libdl/rtl-mdreloc-arm.c
+++ b/cpukit/libdl/rtl-mdreloc-arm.c
@@ -78,10 +78,27 @@ set_veneer(void* tramopline, Elf_Addr target)
/*
* http://shell-storm.org/online/Online-Assembler-and-Disassembler/
*
- * ldr.w pc, [pc]
+ * Thumb mode:
+ * ldr.w pc, [pc]
+ *
+ * ARM mode:
+ * ldr pc, [pc, #-4]
+ *
*/
uint32_t* tramp = (uint32_t*) tramopline;
+#if defined(__thumb__)
+ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
*tramp++ = 0xf000f8df;
+ #else
+ *tramp++ = 0xf8dff000; /* not tested */
+ #endif
+#else
+ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ *tramp++ = 0xe51ff004;
+ #else
+ *tramp++ = 0xe51ff004; /* not tested */
+ #endif
+#endif
*tramp++ = (uint32_t) target;
return tramp;
}
More information about the vc
mailing list