Android 6 does not link shared libraries with text relocations.
Make the movrel macro position independent and add movrelx for indirect
loads of external symbols.
Move the function pointer table for the aligned memcpy variants to the
data.rel.ro section on Linux/Android.
+#if SYS_LINUX
+#define HAVE_SECTION_DATA_REL_RO 1
+#else
+#define HAVE_SECTION_DATA_REL_RO 0
+#endif
+
.macro require8, val=1
ELF .eabi_attribute 24, \val
.endm
.macro require8, val=1
ELF .eabi_attribute 24, \val
.endm
+.macro const name, align=2, relocate=0
+ .macro endconst
+ELF .size \name, . - \name
+ .purgem endconst
+ .endm
+.if HAVE_SECTION_DATA_REL_RO && \relocate
+ .section .data.rel.ro
+.else
+ .section .rodata
+.endif
+ .align \align
+\name:
+.endm
+
-#if HAVE_ARMV6T2 && !defined(PIC)
+#if defined(PIC)
+ ldr \rd, 1f
+ b 2f
+1:
+@ FIXME: thumb
+ .word \val - (2f + 8)
+2:
+ add \rd, \rd, pc
+#elif HAVE_ARMV6T2
movw \rd, #:lower16:\val
movt \rd, #:upper16:\val
#else
movw \rd, #:lower16:\val
movt \rd, #:upper16:\val
#else
+.macro movrelx rd, val, got
+#if defined(PIC) && defined(__ELF__)
+ ldr \got, 2f
+ ldr \rd, 1f
+ b 3f
+1:
+@ FIXME: thumb
+ .word \val(GOT)
+2:
+ .word _GLOBAL_OFFSET_TABLE_ - (3f + 8)
+3:
+ add \got, \got, pc
+ ldr \rd, [\got, \rd]
+#elif defined(PIC) && defined(__APPLE__)
+ ldr \rd, 1f
+ b 2f
+1:
+@ FIXME: thumb
+ .word 3f - (2f + 8)
+2:
+ ldr \rd, [pc, \rd]
+ .non_lazy_symbol_pointer
+3:
+ .indirect_symbol \val
+ .word 0
+ .text
+#else
+ movrel \rd, \val
+#endif
+.endm
+
.macro movconst rd, val
#if HAVE_ARMV6T2
movw \rd, #:lower16:\val
.macro movconst rd, val
#if HAVE_ARMV6T2
movw \rd, #:lower16:\val
MEMCPY_ALIGNED 8, 16
MEMCPY_ALIGNED 8, 8
MEMCPY_ALIGNED 8, 16
MEMCPY_ALIGNED 8, 8
-.section .rodata
-memcpy_table:
+const memcpy_table align=2, relocate=1
.word memcpy_aligned_16_16_neon
.word memcpy_aligned_16_8_neon
.word memcpy_aligned_8_16_neon
.word memcpy_aligned_8_8_neon
.word memcpy_aligned_16_16_neon
.word memcpy_aligned_16_8_neon
.word memcpy_aligned_8_16_neon
.word memcpy_aligned_8_8_neon
lsr r1, r1, #2
.endif
rbit r1, r1
lsr r1, r1, #2
.endif
rbit r1, r1
- movrel r3, X(x264_decimate_table4)
+ movrelx r3, X(x264_decimate_table4), r2
1:
clz r2, r1
lsl r1, r1, r2
1:
clz r2, r1
lsl r1, r1, r2
mvn r12, r12
mov r0, #0
mov lr, #32
mvn r12, r12
mov r0, #0
mov lr, #32
- movrel r3, X(x264_decimate_table8)
+ movrelx r3, X(x264_decimate_table8), r2