configure.ac: Quote `$ac_cv_search_clock_gettime' properly.
[catacomb] / base / asm-common.h
index 32c0543..bcfa735 100644 (file)
@@ -162,6 +162,11 @@ _where_am_i.\got :
 
 #if CPUFAM_ARM
 
+// ARM/Thumb mode things.  Use ARM by default.
+#define ARM .arm; .L$_pcoff = 8
+#define THUMB .thumb; .L$_pcoff = 4
+       ARM
+
 // Set the function hooks.
 #define FUNC_PREHOOK(_) .balign 4
 #define ENDFUNC_HOOK(name) .ltorg
@@ -190,7 +195,7 @@ _where_am_i.\got :
        _LIT
        .balign 4
 .L$_ldgot$\@:
-       .word   _GLOBAL_OFFSET_TABLE_ - .L$_ldgot_pc$\@ - 8
+       .word   _GLOBAL_OFFSET_TABLE_ - .L$_ldgot_pc$\@ - .L$_pcoff
        _ENDLIT
 #endif
        .endm
@@ -210,6 +215,27 @@ _where_am_i.\got :
 #endif
        .endm
 
+// Load address of external symbol ADDR into REG directly.
+       .macro  leaextq reg, addr, cond=
+#if WANT_PIC
+       ldr\cond \reg, .L$_leaextq$\@
+.L$_leaextq_pc$\@:
+       .if     .L$_pcoff == 8
+       ldr\cond \reg, [pc, \reg]
+       .else
+       add\cond \reg, pc
+       ldr\cond \reg, [\reg]
+       .endif
+       _LIT
+       .balign 4
+.L$_leaextq$\@:
+       .word   \addr(GOT_PREL) + (. - .L$_leaextq_pc$\@ - .L$_pcoff)
+       _ENDLIT
+#else
+       ldr\cond \reg, =\addr
+#endif
+       .endm
+
 #endif
 
 ///--------------------------------------------------------------------------