[FFmpeg-devel] [RFC/HACK] textrel-free x86_64 fft_mmx.asm
Reimar Döffinger
Reimar.Doeffinger
Tue Nov 17 01:10:53 CET 2009
On Mon, Nov 16, 2009 at 07:47:44PM +0000, Loren Merritt wrote:
> On Tue, 10 Nov 2009, Reimar D?ffinger wrote:
>
> > I'm sure it can be made at least a bit less ugly, this is my first
> > attempt at both that kind of thing and yasm.
>
> fft_call%3%2 is unnecessary. If I thought the patch were a good idea, I
> would make things relative to start-of-section ($$) instead of another
> symbol.
I admit that is also (besides not knowing about $$) a remnant of when I
didn't know there's no RIP-relative register call.
While I find the patch not that ugly, I understand the scepticism, since
there is no real _need_ for it.
Here is a updated variant which also moves the define outside the macro.
Of course it might be more consistent to call the define FUNC_GLOBAL
and add a CALL_GLOBAL macro to generate the lea/add/call (except that
the "GLOBAL" name just seems rather confusing to me).
Index: fft_mmx.asm
===================================================================
--- fft_mmx.asm (revision 20544)
+++ fft_mmx.asm (working copy)
@@ -419,18 +419,23 @@
%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:
@@ -462,6 +467,10 @@
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
More information about the ffmpeg-devel
mailing list