summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-09-12 03:22:19 +0000
committerRich Felker <dalias@aerifal.cx>2015-09-12 03:23:49 +0000
commitd4c82d05b8d0ee97f6356d60986799a95ed5bd74 (patch)
treede0fdcb0f480af72fa10ffe7197fd861a16a5257
parent4ccc1a01e037251a0ddc3dd07dd1a1fb91a8aa16 (diff)
downloadmusl-d4c82d05b8d0ee97f6356d60986799a95ed5bd74.tar.gz
add sh fdpic subarch variants
with this commit it should be possible to produce a working static-linked fdpic libc and application binaries for sh. the changes in reloc.h are largely unused at this point since dynamic linking is not supported, but the CRTJMP macro is used one place outside of dynamic linking, in __unmapself.
-rw-r--r--arch/sh/reloc.h17
-rwxr-xr-xconfigure4
2 files changed, 20 insertions, 1 deletions
diff --git a/arch/sh/reloc.h b/arch/sh/reloc.h
index 77da6508..73bacebb 100644
--- a/arch/sh/reloc.h
+++ b/arch/sh/reloc.h
@@ -12,7 +12,13 @@
#define FP_SUFFIX "-nofpu"
#endif
-#define LDSO_ARCH "sh" ENDIAN_SUFFIX FP_SUFFIX
+#if __SH_FDPIC__
+#define ABI_SUFFIX "-fdpic"
+#else
+#define ABI_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "sh" ENDIAN_SUFFIX FP_SUFFIX ABI_SUFFIX
#define TPOFF_K 8
@@ -26,5 +32,14 @@
#define REL_DTPOFF R_SH_TLS_DTPOFF32
#define REL_TPOFF R_SH_TLS_TPOFF32
+#if __SH_FDPIC__
+#define REL_FUNCDESC R_SH_FUNCDESC
+#define REL_FUNCDESC_VAL R_SH_FUNCDESC_VALUE
+#undef REL_RELATIVE
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mov.l @%0+,r0 ; mov.l @%0,r12 ; jmp @r0 ; mov %1,r15" \
+ : : "r"(pc), "r"(sp) : "r0", "memory" )
+#else
#define CRTJMP(pc,sp) __asm__ __volatile__( \
"jmp @%0 ; mov %1,r15" : : "r"(pc), "r"(sp) : "memory" )
+#endif
diff --git a/configure b/configure
index 70b77fb8..c277764a 100755
--- a/configure
+++ b/configure
@@ -558,6 +558,10 @@ fi
else
SUBARCH=${SUBARCH}-nofpu
fi
+if trycppif __SH_FDPIC__ "$t" ; then
+SUBARCH=${SUBARCH}-fdpic
+shared=no
+fi
fi
test "$SUBARCH" \