[FFmpeg-cvslog] ppc: fix 32-bit PIC build
Mans Rullgard
git at videolan.org
Mon Sep 26 00:01:19 CEST 2011
ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sun Sep 25 12:53:44 2011 +0100| [6e4a35ced96cdf31a9d3bd82fd147554750af839] | committer: Mans Rullgard
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 at mansr.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6e4a35ced96cdf31a9d3bd82fd147554750af839
---
libavcodec/ppc/asm.S | 19 ++++++++++++++++---
libavcodec/ppc/fft_altivec_s.S | 7 ++++---
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/libavcodec/ppc/asm.S b/libavcodec/ppc/asm.S
index 5cbbf97..4d4285b 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 at 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 at got(r2)
+ lwz \rd, \sym at got(\gp)
#else
lis \rd, \sym at ha
la \rd, \sym at 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
diff --git a/libavcodec/ppc/fft_altivec_s.S b/libavcodec/ppc/fft_altivec_s.S
index ab33900..958d7df 100644
--- a/libavcodec/ppc/fft_altivec_s.S
+++ b/libavcodec/ppc/fft_altivec_s.S
@@ -353,6 +353,7 @@ extfunc ff_fft_calc\interleave\()_altivec
mflr r0
stp r0, 2*PS(r1)
stpu r1, -(160+16*PS)(r1)
+ get_got r11
addi r6, r1, 16*PS
stvm r6, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29
mfvrsave r0
@@ -360,14 +361,14 @@ extfunc ff_fft_calc\interleave\()_altivec
li r6, 0xfffffffc
mtvrsave r6
- movrel r6, fft_data
+ movrel r6, fft_data, r11
lvm r6, v14, v15, v16, v17, v18, v19, v20, v21
lvm r6, v22, v23, v24, v25, v26, v27, v28, v29
li r9, 16
- movrel r12, X(ff_cos_tabs)
+ movrel r12, X(ff_cos_tabs), r11
- movrel r6, fft_dispatch_tab\interleave\()_altivec
+ movrel r6, fft_dispatch_tab\interleave\()_altivec, r11
lwz r3, 0(r3)
subi r3, r3, 2
slwi r3, r3, 2+ARCH_PPC64
More information about the ffmpeg-cvslog
mailing list