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

Nico Weber git at videolan.org
Thu Apr 19 17:20:31 CEST 2012


ffmpeg | branch: master | Nico Weber <thakis at chromium.org> | Tue Apr 17 11:26:01 2012 -0700| [a4a88fd42c934b729f689be790b55df061ded1f8] | committer: Michael Niedermayer

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 at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a4a88fd42c934b729f689be790b55df061ded1f8
---

 libavutil/x86/x86inc.asm |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index 7e389d0..6b39f23 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=



More information about the ffmpeg-cvslog mailing list