about summary refs log tree commit diff
path: root/ports/sysdeps/arm
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2013-02-13 21:21:39 -0800
committerRichard Henderson <rth@twiddle.net>2013-03-06 07:44:24 -0800
commitcd24e113c38e81c15a72536a99062373d5701389 (patch)
tree9bf6a337d9d803b5e9e80fea4c6e676140d9b770 /ports/sysdeps/arm
parent8e39047d31421857f7c8a95816e8eb785199ccb3 (diff)
downloadglibc-cd24e113c38e81c15a72536a99062373d5701389.tar.gz
glibc-cd24e113c38e81c15a72536a99062373d5701389.tar.xz
glibc-cd24e113c38e81c15a72536a99062373d5701389.zip
arm: Introduce and use LDST_PCREL
Macro-ising the few instances where we need to distinguish between
arm and thumb pc-relative memory operations.
Diffstat (limited to 'ports/sysdeps/arm')
-rw-r--r--ports/sysdeps/arm/sysdep.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/ports/sysdeps/arm/sysdep.h b/ports/sysdeps/arm/sysdep.h
index 4af7429ac9..29a78f043d 100644
--- a/ports/sysdeps/arm/sysdep.h
+++ b/ports/sysdeps/arm/sysdep.h
@@ -117,6 +117,23 @@
    the caller.  */
 	.eabi_attribute 24, 1
 
+/* Load or store to/from a pc-relative EXPR into/from R, using T.  */
+# ifdef __thumb2__
+#  define LDST_PCREL(OP, R, T, EXPR) \
+	ldr	T, 98f;					\
+	.subsection 2;					\
+98:	.word	EXPR - 99f - PC_OFS;			\
+	.previous;					\
+99:	add	T, T, pc;				\
+	OP	R, [T]
+# else
+#  define LDST_PCREL(OP, R, T, EXPR) \
+	ldr	T, 98f;					\
+	.subsection 2;					\
+98:	.word	EXPR - 99f - PC_OFS;			\
+	.previous;					\
+99:	OP	R, [pc, T]
+# endif
 #endif	/* __ASSEMBLER__ */
 
 /* This number is the offset from the pc at the current location.  */