about summary refs log tree commit diff
path: root/ports/sysdeps/aarch64/sysdep.h
diff options
context:
space:
mode:
Diffstat (limited to 'ports/sysdeps/aarch64/sysdep.h')
-rw-r--r--ports/sysdeps/aarch64/sysdep.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/ports/sysdeps/aarch64/sysdep.h b/ports/sysdeps/aarch64/sysdep.h
index 0dd597acfc..7169ba716c 100644
--- a/ports/sysdeps/aarch64/sysdep.h
+++ b/ports/sysdeps/aarch64/sysdep.h
@@ -78,6 +78,17 @@
 # define L(name)         .L##name
 #endif
 
+/* Load or store to/from a pc-relative EXPR into/from R, using T.  */
+#define LDST_PCREL(OP, R, T, EXPR)  \
+	adrp	T, EXPR;	    \
+	OP	R, [T, #:lo12:EXPR];\
+
+/* Load or store to/from a got-relative EXPR into/from R, using T.  */
+#define LDST_GLOBAL(OP, R, T, EXPR)     \
+	adrp	T, :got:EXPR;		\
+	ldr	T, [T, #:got_lo12:EXPR];\
+	OP	R, [T];
+
 /* Since C identifiers are not normally prefixed with an underscore
    on this system, the asm identifier `syscall_error' intrudes on the
    C name space.  Make sure we use an innocuous name.  */