summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2019-07-30 20:43:15 +1000
committerChris Johns <chrisj@rtems.org>2019-08-04 12:32:50 +1000
commit8c66acc8dcb4d459c1f61f2d5f62a23d14e3af46 (patch)
treeaa167aa7bfe22b26ad76a4d0f9587ace962d1dd9
parent163927e502343649203da195d46150f5e9ef303c (diff)
downloadrtems-8c66acc8dcb4d459c1f61f2d5f62a23d14e3af46.tar.bz2
libdl/arm: Add support for ARM trampolines
Closes #3776
-rw-r--r--cpukit/libdl/rtl-mdreloc-arm.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/cpukit/libdl/rtl-mdreloc-arm.c b/cpukit/libdl/rtl-mdreloc-arm.c
index 9e5d66ee1f..4950dcdab1 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;
}