On Sat, Sep 24, 2011 at 9:09 AM, Mans Rullgard <[email protected]> wrote: > 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 registers is reserved for this purpose on ppc32. > These changes have no effect on ppc64 builds. > > Signed-off-by: Mans Rullgard <[email protected]> > --- > libavcodec/ppc/asm.S | 17 ++++++++++++++--- > libavcodec/ppc/fft_altivec_s.S | 7 ++++--- > 2 files changed, 18 insertions(+), 6 deletions(-) > > diff --git a/libavcodec/ppc/asm.S b/libavcodec/ppc/asm.S > index 5cbbf97..4914ea8 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,23 @@ 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 > + bcl 20, 31, .Lgot\@ > +.Lgot\@: > + mflr \rd > + addis \rd, \rd, _GLOBAL_OFFSET_TABLE_ - .Lgot\@@ha > + addi \rd, \rd, _GLOBAL_OFFSET_TABLE_ - .Lgot\@@l > +.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 > -- > 1.7.6.1 > > _______________________________________________ > libav-devel mailing list > [email protected] > https://lists.libav.org/mailman/listinfo/libav-devel >
Cool. This seems to jive with what I was reading last night. I thought r2 was supposed to be already set up as the GOT pointer though? This code appears to suggest otherwise. -- Sean _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
