1
From ecda54a640a7de55274ad2a86d58d0b483097aac Mon Sep 17 00:00:00 2001
2
From: Mans Rullgard <mans@mansr.com>
3
Date: Sun, 25 Sep 2011 12:53:44 +0100
4
Subject: [PATCH 68/70] ppc: fix 32-bit PIC build
6
On 32-bit ppc, the GOT pointer must be loaded manually.
7
This adds a "get_got" assembler macro to compute the
8
GOT address. The "movrel" macro is updated to take an
9
additional parameter containing the GOT address since
10
no register is reserved for this purpose on ppc32.
11
These changes have no effect on ppc64 builds.
13
Signed-off-by: Mans Rullgard <mans@mansr.com>
14
(cherry picked from commit 6e4a35ced96cdf31a9d3bd82fd147554750af839)
16
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
18
libavcodec/ppc/asm.S | 19 ++++++++++++++++---
19
libavcodec/ppc/fft_altivec_s.S | 7 ++++---
20
2 files changed, 20 insertions(+), 6 deletions(-)
22
diff --git a/libavcodec/ppc/asm.S b/libavcodec/ppc/asm.S
23
index 5cbbf97..4d4285b 100644
24
--- a/libavcodec/ppc/asm.S
25
+++ b/libavcodec/ppc/asm.S
26
@@ -44,10 +44,13 @@ X(\name):
30
-.macro movrel rd, sym
31
+.macro movrel rd, sym, gp
38
#else /* ARCH_PPC64 */
41
@@ -65,15 +68,25 @@ X(\name):
45
-.macro movrel rd, sym
46
+.macro movrel rd, sym, gp
48
- lwz \rd, \sym@got(r2)
49
+ lwz \rd, \sym@got(\gp)
61
+ addis \rd, \rd, _GLOBAL_OFFSET_TABLE_ - .Lgot\@@ha
62
+ addi \rd, \rd, _GLOBAL_OFFSET_TABLE_ - .Lgot\@@l
66
#endif /* ARCH_PPC64 */
69
diff --git a/libavcodec/ppc/fft_altivec_s.S b/libavcodec/ppc/fft_altivec_s.S
70
index ab33900..958d7df 100644
71
--- a/libavcodec/ppc/fft_altivec_s.S
72
+++ b/libavcodec/ppc/fft_altivec_s.S
73
@@ -353,6 +353,7 @@ extfunc ff_fft_calc\interleave\()_altivec
76
stpu r1, -(160+16*PS)(r1)
79
stvm r6, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29
81
@@ -360,14 +361,14 @@ extfunc ff_fft_calc\interleave\()_altivec
86
+ movrel r6, fft_data, r11
87
lvm r6, v14, v15, v16, v17, v18, v19, v20, v21
88
lvm r6, v22, v23, v24, v25, v26, v27, v28, v29
91
- movrel r12, X(ff_cos_tabs)
92
+ movrel r12, X(ff_cos_tabs), r11
94
- movrel r6, fft_dispatch_tab\interleave\()_altivec
95
+ movrel r6, fft_dispatch_tab\interleave\()_altivec, r11
98
slwi r3, r3, 2+ARCH_PPC64