use pc-relative offsets for PIC too
authornotaz <notasas@gmail.com>
Tue, 2 May 2017 23:52:15 +0000 (02:52 +0300)
committernotaz <notasas@gmail.com>
Tue, 2 May 2017 23:52:15 +0000 (02:52 +0300)
include/arm_features.h
libpcsxcore/new_dynarec/linkage_arm.S
plugins/dfsound/arm_utils.S
plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S

index f35e0b7..7c82ff3 100644 (file)
@@ -73,4 +73,8 @@
 
 #endif
 
+#if defined(__MACH__) || defined(__PIC__)
+#define TEXRELS_FORBIDDEN
+#endif
+
 #endif /* __ARM_FEATURES_H__ */
index 147b0df..d32dc0b 100644 (file)
@@ -93,7 +93,7 @@ DRC_VAR(restore_candidate, 512)
 DRC_VAR(FCR0, 4)
 DRC_VAR(FCR31, 4)
 
-#ifdef __MACH__
+#ifdef TEXRELS_FORBIDDEN
        .data
        .align 2
 ptr_jump_in:
@@ -117,21 +117,21 @@ ptr_hash_table:
 #endif
 
 .macro load_varadr reg var
-#if defined(HAVE_ARMV7) && !defined(__PIC__)
-       movw    \reg, #:lower16:\var
-       movt    \reg, #:upper16:\var
-#elif defined(HAVE_ARMV7) && defined(__MACH__)
+#if defined(HAVE_ARMV7) && defined(TEXRELS_FORBIDDEN)
        movw    \reg, #:lower16:(\var-(1678f+8))
        movt    \reg, #:upper16:(\var-(1678f+8))
 1678:
        add     \reg, pc
+#elif defined(HAVE_ARMV7) && !defined(__PIC__)
+       movw    \reg, #:lower16:\var
+       movt    \reg, #:upper16:\var
 #else
        ldr     \reg, =\var
 #endif
 .endm
 
 .macro load_varadr_ext reg var
-#if defined(HAVE_ARMV7) && defined(__MACH__) && defined(__PIC__)
+#if defined(HAVE_ARMV7) && defined(TEXRELS_FORBIDDEN)
        movw    \reg, #:lower16:(ptr_\var-(1678f+8))
        movt    \reg, #:upper16:(ptr_\var-(1678f+8))
 1678:
index eaeca51..8ac7c30 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "arm_features.h"
 
-#ifdef __MACH__
+#ifdef TEXRELS_FORBIDDEN
 .data
 .align 2
 ptr_ChanBuf:   .word ESYM(ChanBuf)
@@ -20,14 +20,14 @@ ptr_ChanBuf:   .word ESYM(ChanBuf)
 .align 2
 
 .macro load_varadr reg var
-#if defined(HAVE_ARMV7) && !defined(__PIC__)
-       movw    \reg, #:lower16:ESYM(\var)
-       movt    \reg, #:upper16:ESYM(\var)
-#elif defined(HAVE_ARMV7) && defined(__MACH__)
+#if defined(HAVE_ARMV7) && defined(TEXRELS_FORBIDDEN)
        movw    \reg, #:lower16:(ptr_\var-(1678f+8))
        movt    \reg, #:upper16:(ptr_\var-(1678f+8))
 1678:
        ldr     \reg, [pc, \reg]
+#elif defined(HAVE_ARMV7) && !defined(__PIC__)
+       movw    \reg, #:lower16:ESYM(\var)
+       movt    \reg, #:upper16:ESYM(\var)
 #else
        ldr     \reg, =ESYM(\var)
 #endif
index 110c868..7c820d2 100644 (file)
 
 .align 4
 
-#ifndef __MACH__
+#include "arm_features.h"
 
-#define function(name)                                                         \
-  .global name;                                                                \
-  .type name, %function;                                                       \
-  name:                                                                        \
+#define function(name) FUNCTION(name):
+
+#ifndef TEXRELS_FORBIDDEN
 
 #define JT_OP_REL(table_label, index_reg, temp)
 #define JT_OP(x...) x
 #define JTE(start, target) target
 
-#define EXTRA_UNSAVED_REGS
-
 #else
 
-#define function(name)                                                         \
-  .globl _##name;                                                              \
-  name:                                                                        \
-  _##name:                                                                     \
-
 #define JT_OP_REL(table_label, index_reg, temp)                                \
   adr temp, table_label;                                                       \
   ldr temp, [temp, index_reg, lsl #2];                                         \
 #define JT_OP(x...)
 #define JTE(start, target) (target - start)
 
-// r7 is preserved, but add it for EABI alignment..
-#define EXTRA_UNSAVED_REGS r7, r9,
+#endif
 
+#ifdef __MACH__
 #define flush_render_block_buffer _flush_render_block_buffer
 #define setup_sprite_untextured_simple _setup_sprite_untextured_simple
 #define update_texture_8bpp_cache _update_texture_8bpp_cache
-
 #endif
 
 @ r0: psx_gpu