aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/arm/asm.S
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-01 22:12:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-01 22:43:09 +0200
commit5eb353e0cd62ad212634c14e4b863554c0bc6161 (patch)
tree0f53c933b7a61bf14553c3ab8abb8226bd9c23bb /libavutil/arm/asm.S
parent23eeffcd48a15e73fb2649b712870b6d101c5471 (diff)
parent3893feeccdf754057fc7c7ac711ae876733f2f33 (diff)
downloadffmpeg-5eb353e0cd62ad212634c14e4b863554c0bc6161.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: opt/eval: Include mathematics.h for NAN/INFINITY mathematics: Don't use division by zero in NAN/INFINITY macros wma: Lower the maximum number of channels to 2 x86: cpu: clean up check for cpuid instruction support ARM: generate position independent code to access data symbols Conflicts: libavutil/opt.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/arm/asm.S')
-rw-r--r--libavutil/arm/asm.S73
1 files changed, 72 insertions, 1 deletions
diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 28d52cfd53..ccb52316c7 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -62,7 +62,14 @@ ELF .eabi_attribute 25, \val
.endm
.macro function name, export=0
+ .set .Lpic_idx, 0
+ .set .Lpic_gp, 0
.macro endfunc
+ .if .Lpic_idx
+ .altmacro
+ put_pic %(.Lpic_idx - 1)
+ .noaltmacro
+ .endif
ELF .size \name, . - \name
.endfunc
.purgem endfunc
@@ -106,8 +113,44 @@ ELF .size \name, . - \name
#endif
.endm
+.macro put_pic num
+ put_pic_\num
+.endm
+
+.macro do_def_pic num, val, label
+ .macro put_pic_\num
+ .if \num
+ .altmacro
+ put_pic %(\num - 1)
+ .noaltmacro
+ .endif
+\label: .word \val
+ .purgem put_pic_\num
+ .endm
+.endm
+
+.macro def_pic val, label
+ .altmacro
+ do_def_pic %.Lpic_idx, \val, \label
+ .noaltmacro
+ .set .Lpic_idx, .Lpic_idx + 1
+.endm
+
+.macro ldpic rd, val, indir=0
+ ldr \rd, .Lpicoff\@
+.Lpic\@:
+ .if \indir
+ ldr \rd, [pc, \rd]
+ .else
+ add \rd, pc, \rd
+ .endif
+ def_pic \val - (.Lpic\@ + (8 >> CONFIG_THUMB)), .Lpicoff\@
+.endm
+
.macro movrel rd, val
-#if HAVE_ARMV6T2 && !CONFIG_PIC && !defined(__APPLE__)
+#if CONFIG_PIC
+ ldpic \rd, \val
+#elif HAVE_ARMV6T2 && !defined(__APPLE__)
movw \rd, #:lower16:\val
movt \rd, #:upper16:\val
#else
@@ -115,6 +158,34 @@ ELF .size \name, . - \name
#endif
.endm
+.macro movrelx rd, val, gp
+#if CONFIG_PIC && defined(__ELF__)
+ .ifnb \gp
+ .if .Lpic_gp
+ .unreq gp
+ .endif
+ gp .req \gp
+ ldpic gp, _GLOBAL_OFFSET_TABLE_
+ .elseif !.Lpic_gp
+ gp .req r12
+ ldpic gp, _GLOBAL_OFFSET_TABLE_
+ .endif
+ .set .Lpic_gp, 1
+ ldr \rd, .Lpicoff\@
+ ldr \rd, [gp, \rd]
+ def_pic \val(GOT), .Lpicoff\@
+#elif CONFIG_PIC && defined(__APPLE__)
+ ldpic \rd, .Lpic\@, indir=1
+ .non_lazy_symbol_pointer
+.Lpic\@:
+ .indirect_symbol \val
+ .word 0
+ .text
+#else
+ movrel \rd, \val
+#endif
+.endm
+
.macro ldr_pre rt, rn, rm:vararg
A ldr \rt, [\rn, \rm]!
T add \rn, \rn, \rm