summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-09-12 03:18:08 +0000
committerRich Felker <dalias@aerifal.cx>2015-09-12 03:18:08 +0000
commit4ccc1a01e037251a0ddc3dd07dd1a1fb91a8aa16 (patch)
tree4ee7b58125e69ca82dfb16598bce5b02554c95fd /arch
parent6d03c4ee586576bf199cf8d6dc86ba4cd54e4186 (diff)
downloadmusl-4ccc1a01e037251a0ddc3dd07dd1a1fb91a8aa16.tar.gz
add fdpic version of entry point code for sh
this version of the entry point is only suitable for static linking in ET_EXEC form. neither dynamic linking nor pie is supported yet. at some point in the future the fdpic and non-fdpic versions of this code may be unified but for now it's easiest to work with them separately.
Diffstat (limited to 'arch')
-rw-r--r--arch/sh/crt_arch.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/sh/crt_arch.h b/arch/sh/crt_arch.h
index f8907108..e9745f9b 100644
--- a/arch/sh/crt_arch.h
+++ b/arch/sh/crt_arch.h
@@ -1,3 +1,30 @@
+#ifdef __SH_FDPIC__
+
+__asm__(
+".text \n"
+".global " START " \n"
+START ": \n"
+" mov r8, r4 \n"
+" mova 1f, r0 \n"
+" mov.l 1f, r5 \n"
+" mov.l 1f+4, r6 \n"
+" add r0, r5 \n"
+" bsr __fdpic_fixup \n"
+" add r0, r6 \n"
+" mov r0, r12 \n"
+" mov r15, r4 \n"
+" mov #-16, r0 \n"
+" bsr " START "_c \n"
+" and r0, r15 \n"
+".align 2 \n"
+"1: .long __ROFIXUP_LIST__@PCREL \n"
+" .long __ROFIXUP_END__@PCREL + 4 \n"
+);
+
+#include "fdpic_crt.h"
+
+#else
+
__asm__(
".text \n"
".global " START " \n"
@@ -16,6 +43,8 @@ START ": \n"
"1: .long _DYNAMIC-. \n"
);
+#endif
+
/* used by gcc for switching the FPU between single and double precision */
#ifdef SHARED
__attribute__((__visibility__("hidden")))