Index: configure
===================================================================
--- configure	(revision 25128)
+++ configure	(working copy)
@@ -2372,6 +2372,7 @@
         strip="lxlite"
         ln_s="cp -f"
         add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
+        objformat="aout"
         SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
         FFSERVERLDFLAGS=""
         LIBSUF="_s.a"
@@ -2588,16 +2589,29 @@
 
     check_asm bswap '"bswap %%eax" ::: "%eax"'
 
-    YASMFLAGS="-f $objformat"
+    yasmdefines=""
+    enabled     pic           && append yasmdefines "-DPIC"
+    test -n "$extern_prefix"  && append yasmdefines "-DPREFIX"
+
+    YASMFLAGS="-f $objformat $yasmdefines"
     enabled     x86_64        && append YASMFLAGS "-m amd64"
-    enabled     pic           && append YASMFLAGS "-DPIC"
-    test -n "$extern_prefix"  && append YASMFLAGS "-DPREFIX"
     case "$objformat" in
         elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
     esac
     if ! disabled_any asm mmx yasm; then
-        check_yasm "pabsw xmm0, xmm0" && enable yasm ||
-            die "yasm not found, use --disable-yasm for a crippled build"
+        check_yasm "pabsw xmm0, xmm0" && enable yasm
+        if ! enabled yasm ; then
+            yasmexe="nasm"
+            if enabled x86_64 ; then
+                case "$objformat" in
+                    elf)   objformat=elf64 ;;
+                    win32) objformat=win64 ;;
+                esac
+            fi
+            YASMFLAGS="-f $objformat $yasmdefines"
+            check_yasm "pabsw xmm0, xmm0" && enable yasm ||
+                die "yasm not found, use --disable-yasm for a crippled build"
+        fi
     fi
 
     case "$cpu" in
Index: libavcodec/x86/fft_mmx.asm
===================================================================
--- libavcodec/x86/fft_mmx.asm	(revision 25128)
+++ libavcodec/x86/fft_mmx.asm	(working copy)
@@ -71,7 +71,7 @@
     %1
 %endmacro
 
-section .text align=16
+SECTION_TEXT
 
 %macro T2_3DN 4 ; z0, z1, mem0, mem1
     mova     %1, %3
@@ -154,9 +154,9 @@
     mova     m1, %3 ; wim
     mova     m3, m5
     mulps    m2, m0 ; r2*wre
-IF%1 mova    m6, Z(6)
+IF%1 mova    m6, Z2(6)
     mulps    m3, m1 ; i2*wim
-IF%1 mova    m7, Z(7)
+IF%1 mova    m7, Z2(7)
     mulps    m4, m1 ; r2*wim
     mulps    m5, m0 ; i2*wre
     addps    m2, m3 ; r2*wre + i2*wim
@@ -183,14 +183,14 @@
     mova     m4, m6
     subps    m6, m5 ; r3
     addps    m5, m4 ; r1
-    mova   Z(6), m6
+    mova  Z2(6), m6
     mova   Z(2), m5
     mova     m2, Z(3)
     addps    m3, m0 ; t6
     subps    m2, m1 ; i3
     mova     m7, Z(1)
     addps    m1, Z(3) ; i1
-    mova   Z(7), m2
+    mova  Z2(7), m2
     mova   Z(3), m1
     mova     m4, m7
     subps    m7, m3 ; i2
@@ -208,9 +208,9 @@
     mova     m3, m5
     mova     m1, [wq+o1q] ; wim
     mulps    m2, m0 ; r2*wre
-    mova     m6, Z(6) ; r3
+    mova     m6, Z2(6) ; r3
     mulps    m3, m1 ; i2*wim
-    mova     m7, Z(7) ; i3
+    mova     m7, Z2(7) ; i3
     mulps    m4, m1 ; r2*wim
     mulps    m5, m0 ; i2*wre
     addps    m2, m3 ; r2*wre + i2*wim
@@ -237,14 +237,14 @@
     mova     m4, m6
     subps    m6, m5 ; r3
     addps    m5, m4 ; r1
-IF%1 mova  Z(6), m6
+IF%1 mova Z2(6), m6
 IF%1 mova  Z(2), m5
     mova     m2, Z(3)
     addps    m3, m0 ; t6
     subps    m2, m1 ; i3
     mova     m7, Z(1)
     addps    m1, Z(3) ; i1
-IF%1 mova  Z(7), m2
+IF%1 mova Z2(7), m2
 IF%1 mova  Z(3), m1
     mova     m4, m7
     subps    m7, m3 ; i2
@@ -262,8 +262,8 @@
     mova     m2, Z(4)
     mova   Z(2), m5
     mova   Z(3), m4
-    mova   Z(6), m6
-    mova   Z(7), m0
+    mova  Z2(6), m6
+    mova  Z2(7), m0
     mova     m5, m1 ; r0
     mova     m4, m2 ; r2
     unpcklps m1, m3
@@ -287,6 +287,7 @@
 %define mova movaps
 
 %define Z(x) [r0+mmsize*x]
+%define Z2(x) [r0+mmsize*x]
 
 align 16
 fft4_sse:
@@ -326,8 +327,8 @@
     mova   Z(2), m2
     mova   Z(3), m3
     T4_SSE   m4, m5, m6
-    mova     m6, Z(6)
-    mova     m7, Z(7)
+    mova     m6, Z2(6)
+    mova     m7, Z2(7)
     T4_SSE   m6, m7, m0
     PASS_SMALL 0, [cos_16], [cos_16+16]
     ret
@@ -358,8 +359,8 @@
     T4_3DN   m0, m1, m2, m3, m4, m5
     mova   Z(0), m0
     mova   Z(2), m2
-    T2_3DN   m4, m5, Z(4), Z(5)
-    T2_3DN   m6, m7, Z(6), Z(7)
+    T2_3DN   m4, m5,  Z(4),  Z(5)
+    T2_3DN   m6, m7, Z2(6), Z2(7)
     pswapd   m0, m5
     pswapd   m2, m7
     pxor     m0, [ps_m1p1]
@@ -370,7 +371,7 @@
     pfmul    m7, [ps_root2]
     T4_3DN   m1, m3, m5, m7, m0, m2
     mova   Z(5), m5
-    mova   Z(7), m7
+    mova  Z2(7), m7
     mova     m0, Z(0)
     mova     m2, Z(2)
     T4_3DN   m0, m2, m4, m6, m5, m7
@@ -380,12 +381,12 @@
     mova   Z(1), m5
     mova   Z(2), m2
     mova   Z(3), m7
-    PUNPCK   m4, Z(5), m5
-    PUNPCK   m6, Z(7), m7
+    PUNPCK   m4,  Z(5), m5
+    PUNPCK   m6, Z2(7), m7
     mova   Z(4), m4
     mova   Z(5), m5
-    mova   Z(6), m6
-    mova   Z(7), m7
+    mova  Z2(6), m6
+    mova  Z2(7), m7
     ret
 %endmacro
 
@@ -405,7 +406,8 @@
 FFT48_3DN _3dn
 
 
-%define Z(x) [zq + o1q*(x&6)*((x/6)^1) + o3q*(x/6) + mmsize*(x&1)]
+%define Z(x) [zq + o1q*(x&6) + mmsize*(x&1)]
+%define Z2(x) [zq + o3q + mmsize*(x&1)]
 
 %macro DECL_PASS 2+ ; name, payload
 align 16
Index: libavcodec/x86/dsputil_yasm.asm
===================================================================
--- libavcodec/x86/dsputil_yasm.asm	(revision 25128)
+++ libavcodec/x86/dsputil_yasm.asm	(working copy)
@@ -28,7 +28,7 @@
 pb_zzzz3333zzzzbbbb: db -1,-1,-1,-1,3,3,3,3,-1,-1,-1,-1,11,11,11,11
 pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13
 
-section .text align=16
+SECTION_TEXT
 
 %macro PSWAPD_SSE 2
     pshufw %1, %2, 0x4e
Index: libavcodec/x86/x86inc.asm
===================================================================
--- libavcodec/x86/x86inc.asm	(revision 25128)
+++ libavcodec/x86/x86inc.asm	(working copy)
@@ -62,11 +62,22 @@
     %elifidn __OUTPUT_FORMAT__,macho
         SECTION .text align=%1
         fakegot:
+    %elifidn __OUTPUT_FORMAT__,aout
+        section .text
     %else
         SECTION .rodata align=%1
     %endif
 %endmacro
 
+; aout does not support align=
+%macro SECTION_TEXT 0-1 16
+    %ifidn __OUTPUT_FORMAT__,aout
+        SECTION .text
+    %else
+        SECTION .text align=%1
+    %endif
+%endmacro
+
 %ifdef WIN64
     %define PIC
 %elifndef ARCH_X86_64
