[SCM] libav/experimental: Make the jump-table section-relative for x86_64 with PIC enabled. This allows to get rid of the macho64 specific hack that moves them to rodata (with worse cache behaviour) and avoids textrels which e.g. Gentoo does not allow for x86_64 libraries.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:59:02 UTC 2013


The following commit has been merged in the experimental branch:
commit 3d05c1fbec5cd6c9622b8b2021f00d4a8dc8f5a4
Author: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
Date:   Sat Jan 30 19:26:47 2010 +0000

    Make the jump-table section-relative for x86_64 with PIC enabled.
    This allows to get rid of the macho64 specific hack that moves them
    to rodata (with worse cache behaviour) and avoids textrels which
    e.g. Gentoo does not allow for x86_64 libraries.
    
    Originally committed as revision 21551 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm
index 26bd748..9cb0ae1 100644
--- a/libavcodec/x86/fft_mmx.asm
+++ b/libavcodec/x86/fft_mmx.asm
@@ -419,18 +419,23 @@ DECL_PASS pass_interleave_3dn, PASS_BIG 0
 %define pass_3dn2 pass_3dn
 %define pass_interleave_3dn2 pass_interleave_3dn
 
+%ifdef PIC
+%define SECTION_REL - $$
+%else
+%define SECTION_REL
+%endif
 
 %macro DECL_FFT 2-3 ; nbits, cpu, suffix
-%xdefine list_of_fft fft4%2, fft8%2
+%xdefine list_of_fft fft4%2 SECTION_REL, fft8%2 SECTION_REL
 %if %1==5
-%xdefine list_of_fft list_of_fft, fft16%2
+%xdefine list_of_fft list_of_fft, fft16%2 SECTION_REL
 %endif
 
 %assign n 1<<%1
 %rep 17-%1
 %assign n2 n/2
 %assign n4 n/4
-%xdefine list_of_fft list_of_fft, fft %+ n %+ %3%2
+%xdefine list_of_fft list_of_fft, fft %+ n %+ %3%2 SECTION_REL
 
 align 16
 fft %+ n %+ %3%2:
@@ -448,10 +453,6 @@ fft %+ n %+ %3%2:
 %endrep
 %undef n
 
-%ifidn __OUTPUT_FORMAT__,macho64
-section .rodata
-%endif
-
 align 8
 dispatch_tab%3%2: pointer list_of_fft
 
@@ -462,6 +463,10 @@ section .text
 cglobal fft_dispatch%3%2, 2,5,8, z, nbits
     lea r2, [dispatch_tab%3%2 GLOBAL]
     mov r2, [r2 + (nbitsq-2)*gprsize]
+%ifdef PIC
+    lea r3, [$$ GLOBAL]
+    add r2, r3
+%endif
     call r2
     RET
 %endmacro ; DECL_FFT

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list