In binutils 2.29, the behavior of the ADR instruction changed so that 1 is added to the address of a Thumb function (previously nothing was added). This allows the loaded address to be passed to a BLX instruction and the correct mode change will occur.
So that the behavior matches in binutils 2.29 and pre-2.29, use .eqv to pre-calculate the function address without the automatic +1 fixup. Then use these new symbols as the function addresses to be loaded. Fixes ticket 6571. Related binutils bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21458 Signed-off-by: James Cowgill <jcowg...@debian.org> --- v2: Forgot to include the "avcodec/arm" commit message prefix. libavcodec/arm/h264idct_neon.S | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/libavcodec/arm/h264idct_neon.S b/libavcodec/arm/h264idct_neon.S index 4f68bdb9f5..04b1ea583b 100644 --- a/libavcodec/arm/h264idct_neon.S +++ b/libavcodec/arm/h264idct_neon.S @@ -20,6 +20,18 @@ #include "libavutil/arm/asm.S" +# In binutils 2.29, the behavior of the ADR instruction changed so that 1 is +# added to the address of a Thumb function (previously nothing was added). +# +# These .eqv are used to pre-calculate the correct address with +CONFIG_THUMB so +# that ADR will work with both old and new versions binutils. +# +# See: https://sourceware.org/bugzilla/show_bug.cgi?id=21458 +.eqv eqv_ff_h264_idct_add_neon, X(ff_h264_idct_add_neon) + CONFIG_THUMB +.eqv eqv_ff_h264_idct_dc_add_neon, X(ff_h264_idct_dc_add_neon) + CONFIG_THUMB +.eqv eqv_ff_h264_idct8_add_neon, X(ff_h264_idct8_add_neon) + CONFIG_THUMB +.eqv eqv_ff_h264_idct8_dc_add_neon, X(ff_h264_idct8_dc_add_neon) + CONFIG_THUMB + function ff_h264_idct_add_neon, export=1 vld1.64 {d0-d3}, [r1,:128] vmov.i16 q15, #0 @@ -113,8 +125,8 @@ function ff_h264_idct_add16_neon, export=1 movne lr, #0 cmp lr, #0 ite ne - adrne lr, X(ff_h264_idct_dc_add_neon) + CONFIG_THUMB - adreq lr, X(ff_h264_idct_add_neon) + CONFIG_THUMB + adrne lr, eqv_ff_h264_idct_dc_add_neon + adreq lr, eqv_ff_h264_idct_add_neon blx lr 2: subs ip, ip, #1 add r1, r1, #32 @@ -138,8 +150,8 @@ function ff_h264_idct_add16intra_neon, export=1 cmp r8, #0 ldrsh r8, [r1] iteet ne - adrne lr, X(ff_h264_idct_add_neon) + CONFIG_THUMB - adreq lr, X(ff_h264_idct_dc_add_neon) + CONFIG_THUMB + adrne lr, eqv_ff_h264_idct_add_neon + adreq lr, eqv_ff_h264_idct_dc_add_neon cmpeq r8, #0 blxne lr subs ip, ip, #1 @@ -166,8 +178,8 @@ function ff_h264_idct_add8_neon, export=1 cmp r8, #0 ldrsh r8, [r1] iteet ne - adrne lr, X(ff_h264_idct_add_neon) + CONFIG_THUMB - adreq lr, X(ff_h264_idct_dc_add_neon) + CONFIG_THUMB + adrne lr, eqv_ff_h264_idct_add_neon + adreq lr, eqv_ff_h264_idct_dc_add_neon cmpeq r8, #0 blxne lr add r12, r12, #1 @@ -388,8 +400,8 @@ function ff_h264_idct8_add4_neon, export=1 movne lr, #0 cmp lr, #0 ite ne - adrne lr, X(ff_h264_idct8_dc_add_neon) + CONFIG_THUMB - adreq lr, X(ff_h264_idct8_add_neon) + CONFIG_THUMB + adrne lr, eqv_ff_h264_idct8_dc_add_neon + adreq lr, eqv_ff_h264_idct8_add_neon blx lr 2: subs r12, r12, #4 add r1, r1, #128 -- 2.14.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel