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>
This commit is contained in:
Mans Rullgard 2011-09-25 12:53:44 +01:00
parent 4568c2bf97
commit 6e4a35ced9
2 changed files with 20 additions and 6 deletions

View File

@ -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

View File

@ -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