[FFmpeg-devel] [PATCH] Fix broken osx powerpc build

Pavel Koshevoy pkoshevoy at gmail.com
Tue Jul 12 07:43:52 EEST 2016


This patch does not apply against current master.

I've attached an alternative patch that works for me on osx ppc.
I can't test my patch with clang, can someone else do it?

Pavel.


On 07/11/2016 07:56 PM, Jing Yu wrote:
> Add #ifdef __APPLE__ to wrap around non-standard assembly code to make it compatible with old platform.
>
> Is it ok for trunk?
> Thanks!
>
> ---
>   libavcodec/ppc/asm.S         |  4 ++++
>   libavcodec/ppc/fft_altivec.S | 32 ++++++++++++++++++++++++++++++++
>   2 files changed, 36 insertions(+)
>
> diff --git a/libavcodec/ppc/asm.S b/libavcodec/ppc/asm.S
> index 700aa0d..baf68b0 100644
> --- a/libavcodec/ppc/asm.S
> +++ b/libavcodec/ppc/asm.S
> @@ -53,7 +53,11 @@ L(\name):
>   .endm
>   
>   .macro movrel rd, sym, gp
> +#ifdef __APPLE__
> +    ld      \rd, \sym at got(r2)
> +#else
>       ld      \rd, \sym at got(2)
> +#endif
>   .endm
>   
>   .macro get_got rd
> diff --git a/libavcodec/ppc/fft_altivec.S b/libavcodec/ppc/fft_altivec.S
> index e0149a4..a6e144d 100644
> --- a/libavcodec/ppc/fft_altivec.S
> +++ b/libavcodec/ppc/fft_altivec.S
> @@ -354,14 +354,24 @@ fft_data:
>   .macro fft_calc interleave
>   extfunc ff_fft_calc\interleave\()_altivec
>       mflr    r0
> +#ifdef __APPLE__
> +    stp     r0, 2*PS(r1)
> +    stpu    r1, -(160+16*PS)(r1)
> +#else
>       stp     r0, 2*PS(1)
>       stpu    r1, -(160+16*PS)(1)
> +#endif
>       get_got r11
>       addi    r6, r1, 16*PS
>       stvm    r6, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29
>       mfvrsave r0
> +#ifdef __APPLE__
> +    stw     r0, 15*PS(r1)
> +    li      r6, 0xfffffffc
> +#else
>       stw     r0, 15*PS(1)
>       li      r6, -4  #0xfffffffc
> +#endif
>       mtvrsave r6
>   
>       movrel  r6, fft_data, r11
> @@ -372,7 +382,11 @@ extfunc ff_fft_calc\interleave\()_altivec
>       movrel  r12, X(ff_cos_tabs), r11
>   
>       movrel  r6, fft_dispatch_tab\interleave\()_altivec, r11
> +#ifdef __APPLE__
> +    lwz     r3, 0(r3)
> +#else
>       lwz     r3, 0(3)
> +#endif
>       subi    r3, r3, 2
>       slwi    r3, r3, 2+ARCH_PPC64
>       lpx     r3, r3, r6
> @@ -382,10 +396,19 @@ extfunc ff_fft_calc\interleave\()_altivec
>   
>       addi    r6, r1, 16*PS
>       lvm     r6, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29
> +#ifdef __APPLE__
> +    lwz     r6, 15*PS(r1)
> +#else
>       lwz     r6, 15*PS(1)
> +#endif
>       mtvrsave r6
> +#ifdef __APPLE__
> +    lp      r1, 0(r1)
> +    lp      r0, 2*PS(r1)
> +#else
>       lp      r1, 0(1)
>       lp      r0, 2*PS(1)
> +#endif
>       mtlr    r0
>       blr
>   .endm
> @@ -393,15 +416,24 @@ extfunc ff_fft_calc\interleave\()_altivec
>   .macro DECL_FFT suffix, bits, n, n2, n4
>   fft\n\suffix\()_altivec:
>       mflr  r0
> +#ifdef __APPLE__
> +    stp   r0,PS*(\bits-3)(r1)
> +#else
>       stp   r0,PS*(\bits-3)(1)
> +#endif
>       bl    fft\n2\()_altivec
>       addi2 r3,\n*4
>       bl    fft\n4\()_altivec
>       addi2 r3,\n*2
>       bl    fft\n4\()_altivec
>       addi2 r3,\n*-6
> +#ifdef __APPLE__
> +    lp    r0,PS*(\bits-3)(r1)
> +    lp    r4,\bits*PS(r12)
> +#else
>       lp    r0,PS*(\bits-3)(1)
>       lp    r4,\bits*PS(12)
> +#endif
>       mtlr  r0
>       li    r5,\n/16
>       b     fft_pass\suffix\()_altivec

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Restore-compatibility-with-powerpc-apple-darwin9-gcc.patch
Type: text/x-patch
Size: 2977 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160711/b05dd00d/attachment.bin>


More information about the ffmpeg-devel mailing list