aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ppc/asm.S
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-09-25 12:53:44 +0100
committerMans Rullgard <mans@mansr.com>2011-09-25 17:27:48 +0100
commit6e4a35ced96cdf31a9d3bd82fd147554750af839 (patch)
tree6c6c4ca05858757f2f5e1047f91e76a2bf45d591 /libavcodec/ppc/asm.S
parent4568c2bf975e51d843bf1ff6ac06060a8a6291b3 (diff)
downloadffmpeg-6e4a35ced96cdf31a9d3bd82fd147554750af839.tar.gz
ppc: fix 32-bit PIC build
On 32-bit ppc, the GOT pointer must be loaded manually. This adds a "get_got" assembler macro to compute the GOT address. The "movrel" macro is updated to take an additional parameter containing the GOT address since no register is reserved for this purpose on ppc32. These changes have no effect on ppc64 builds. Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec/ppc/asm.S')
-rw-r--r--libavcodec/ppc/asm.S19
1 files changed, 16 insertions, 3 deletions
diff --git a/libavcodec/ppc/asm.S b/libavcodec/ppc/asm.S
index 5cbbf97b64..4d4285b6d3 100644
--- a/libavcodec/ppc/asm.S
+++ b/libavcodec/ppc/asm.S
@@ -44,10 +44,13 @@ X(\name):
L(\name):
.endm
-.macro movrel rd, sym
+.macro movrel rd, sym, gp
ld \rd, \sym@got(r2)
.endm
+.macro get_got rd
+.endm
+
#else /* ARCH_PPC64 */
#define PTR .int
@@ -65,15 +68,25 @@ X(\name):
\name:
.endm
-.macro movrel rd, sym
+.macro movrel rd, sym, gp
#if CONFIG_PIC
- lwz \rd, \sym@got(r2)
+ lwz \rd, \sym@got(\gp)
#else
lis \rd, \sym@ha
la \rd, \sym@l(\rd)
#endif
.endm
+.macro get_got rd
+#if CONFIG_PIC
+ bcl 20, 31, .Lgot\@
+.Lgot\@:
+ mflr \rd
+ addis \rd, \rd, _GLOBAL_OFFSET_TABLE_ - .Lgot\@@ha
+ addi \rd, \rd, _GLOBAL_OFFSET_TABLE_ - .Lgot\@@l
+#endif
+.endm
+
#endif /* ARCH_PPC64 */
#if HAVE_IBM_ASM