1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

Remove .rodata alignment kludge for Mach-O if a recent enough yasm is used.

Yasm was fixed in its r2161 and yasm 0.8.0 (Apr 2010) contained this fix.
Nasm was fixed in 2.06 (Jun 2009):
https://groups.google.com/group/alt.lang.asm/browse_thread/thread/fcc85bbc3745d893

I tested with yasm  0.7.99 and yasm 1.2.0.7, where this works fine.

I also tested with nasm. The nasm shipping with Xcode is too old to understand
ffmpeg's assembly, before and after the patch. Nasm 2.10 fails to compile
fft_mmx.asm on trunk with

  libavcodec/x86/fft_mmx.asm:88: panic: section ".text" has already been specified with alignment 32, conflicts with new alignment of 16

but builds fine if I change the two alignment "16"s in x86inc.asm to "32". With this patch,
nasm 2.10 fails with

  libavcodec/x86/fft_mmx.asm:39: panic: section ".rodata" has already been specified with alignment 32, conflicts with new alignment of 16

instead, but again builds fine with s/16/32/.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Nico Weber 2012-04-17 11:26:01 -07:00 committed by Michael Niedermayer
parent b4043ef504
commit a4a88fd42c

View File

@ -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=