summaryrefslogtreecommitdiff
path: root/libavutil/x86/x86inc.asm
diff options
context:
space:
mode:
Diffstat (limited to 'libavutil/x86/x86inc.asm')
-rw-r--r--libavutil/x86/x86inc.asm60
1 files changed, 49 insertions, 11 deletions
diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index c167057921..971d210848 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -60,19 +60,38 @@
; and x264's strides are all positive), but is not guaranteed by the ABI.
; Name of the .rodata section.
-; Kludge: Something on OS X fails to align .rodata even given an align attribute,
-; so use a different read-only section.
%macro SECTION_RODATA 0-1 16
- %ifidn __OUTPUT_FORMAT__,macho64
- SECTION .text align=%1
- %elifidn __OUTPUT_FORMAT__,macho
- SECTION .text align=%1
- fakegot:
- %elifidn __OUTPUT_FORMAT__,aout
+ ; Kludge: Something on OS X fails to align .rodata even given an align
+ ; attribute, so use a different read-only section. This has been fixed in
+ ; yasm 0.8.0 and nasm 2.6.
+ %ifdef __YASM_VERSION_ID__
+ %if __YASM_VERSION_ID__ < 00080000h
+ %define NEED_MACHO_RODATA_KLUDGE
+ %endif
+ %elifdef __NASM_VERSION_ID__
+ %if __NASM_VERSION_ID__ < 02060000h
+ %define NEED_MACHO_RODATA_KLUDGE
+ %endif
+ %endif
+
+ %ifidn __OUTPUT_FORMAT__,aout
section .text
%else
- SECTION .rodata align=%1
+ %ifndef NEED_MACHO_RODATA_KLUDGE
+ SECTION .rodata align=%1
+ %else
+ %ifidn __OUTPUT_FORMAT__,macho64
+ SECTION .text align=%1
+ %elifidn __OUTPUT_FORMAT__,macho
+ SECTION .text align=%1
+ fakegot:
+ %else
+ SECTION .rodata align=%1
+ %endif
+ %endif
%endif
+
+ %undef NEED_MACHO_RODATA_KLUDGE
%endmacro
; aout does not support align=
@@ -97,7 +116,11 @@
%endif
; Always use long nops (reduces 0x90 spam in disassembly on x86_32)
+; Not supported by NASM (except via smartalign package + ALIGNMODE k8,
+; however that fails when used together with the -M option)
+%ifdef __YASM_VER__
CPU amdnop
+%endif
; Macros to eliminate most code duplication between x86_32 and x86_64:
; Currently this works only for leaf functions which load all their arguments
@@ -142,10 +165,10 @@ CPU amdnop
%define r%1mp %2
%elif ARCH_X86_64 ; memory
%define r%1m [rsp + stack_offset + %6]
- %define r%1mp qword r %+ %1m
+ %define r%1mp qword r %+ %1 %+ m
%else
%define r%1m [esp + stack_offset + %6]
- %define r%1mp dword r %+ %1m
+ %define r%1mp dword r %+ %1 %+ m
%endif
%define r%1 %2
%endmacro
@@ -488,9 +511,19 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
; Appends cpuflags to the function name if cpuflags has been specified.
%macro cglobal 1-2+ ; name, [PROLOGUE args]
%if %0 == 1
+ ; HACK: work around %+ broken with empty SUFFIX for nasm 2.09.10
+ %ifndef cpuname
+ cglobal_internal %1
+ %else
cglobal_internal %1 %+ SUFFIX
+ %endif
%else
+ ; HACK: work around %+ broken with empty SUFFIX for nasm 2.09.10
+ %ifndef cpuname
+ cglobal_internal %1, %2
+ %else
cglobal_internal %1 %+ SUFFIX, %2
+ %endif
%endif
%endmacro
%macro cglobal_internal 1-2+
@@ -767,7 +800,12 @@ INIT_XMM
; Append cpuflags to the callee's name iff the appended name is known and the plain name isn't
%macro call 1
+ ; HACK: work around %+ broken with empty SUFFIX for nasm 2.09.10
+ %ifndef cpuname
+ call_internal %1, %1
+ %else
call_internal %1, %1 %+ SUFFIX
+ %endif
%endmacro
%macro call_internal 2
%xdefine %%i %1