Bug 1515933 - Configure 16 bytes stack alignment on Linux x86_64 dav1d builds. r=TD-Linux
authorAlex Chronopoulos <achronop@gmail.com>
Thu, 24 Jan 2019 02:43:58 +0000
changeset 515234 2a87e6d6e05038586c1a39bfa996e4a4af0588f7
parent 515233 1fce91651f4385b00e99a76338c2ee4e475b1adf
child 515235 a3bfdc6d05af5dbf4b09451b477a402b4b3b813a
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTD-Linux
bugs1515933
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1515933 - Configure 16 bytes stack alignment on Linux x86_64 dav1d builds. r=TD-Linux Differential Revision: https://phabricator.services.mozilla.com/D17346
media/libdav1d/asm/moz.build
media/libdav1d/asm/x86_64/linux/config.asm
media/libdav1d/config.h
media/libdav1d/moz.build
--- a/media/libdav1d/asm/moz.build
+++ b/media/libdav1d/asm/moz.build
@@ -23,23 +23,24 @@ CFLAGS += [
 
 # This is Linux only for now
 
 # Attaching config.asm file
 if CONFIG['CPU_ARCH'] == 'x86':
     ASFLAGS += ['-I%s/media/libdav1d/asm/x86_32/' % TOPSRCDIR]
 
 if CONFIG['CPU_ARCH'] == 'x86_64':
-    # Change the default stack aligment (16) to 32
-    if CONFIG['CC_TYPE'] == 'clang':
-        CFLAGS += ['-mstack-alignment=32']
-    elif CONFIG['CC_TYPE'] == 'gcc':
-        CFLAGS += ['-mpreferred-stack-boundary=5']
-
-    if CONFIG['OS_TARGET'] == 'Darwin':
+    if CONFIG['OS_TARGET'] == 'Linux':
+        ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/linux/' % TOPSRCDIR]
+    elif CONFIG['OS_TARGET'] == 'Darwin':
+        # Change the default stack aligment (16) to 32
+        if CONFIG['CC_TYPE'] == 'clang':
+            CFLAGS += ['-mstack-alignment=32']
+        elif CONFIG['CC_TYPE'] == 'gcc':
+            CFLAGS += ['-mpreferred-stack-boundary=5']
         ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/osx/' % TOPSRCDIR]
     else:
         ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/' % TOPSRCDIR]
 
 if CONFIG['CPU_ARCH'] in ('x86', 'x86_64'):
     SOURCES += [
         '../../../third_party/dav1d/src/x86/cpu.c',
     ]
new file mode 100644
--- /dev/null
+++ b/media/libdav1d/asm/x86_64/linux/config.asm
@@ -0,0 +1,11 @@
+; Autogenerated by the Meson build system.
+; Do not edit, your changes will be lost.
+
+%define ARCH_X86_32 0
+
+%define ARCH_X86_64 1
+
+%define PIC 1
+
+%define STACK_ALIGNMENT 16
+
--- a/media/libdav1d/config.h
+++ b/media/libdav1d/config.h
@@ -57,13 +57,14 @@
 // build, so we do not really care.
 #define HAVE_UNISTD_H 1
 
 // Important when asm is enabled
 #if defined(__APPLE__)
 #  define PREFIX 1
 #endif
 
-#if ARCH_X86_32 == 1 && defined(__linux__) && !defined(__ANDROID__)
+#if (ARCH_x86_32 == 1 || ARCH_X86_64 == 1) && defined(__linux__) && \
+    !defined(__ANDROID__)
 #  define STACK_ALIGNMENT 16
 #else
 #  define STACK_ALIGNMENT 32
 #endif
--- a/media/libdav1d/moz.build
+++ b/media/libdav1d/moz.build
@@ -19,30 +19,20 @@ EXPORTS.dav1d += [
 ]
 
 # entrypoint source files
 SOURCES += [
     '../../third_party/dav1d/src/lib.c',
     '../../third_party/dav1d/src/thread_task.c',
 ]
 
-# Enable ASM on Linux for now.
+# Enable ASM build only on Linux for now.
 if CONFIG['OS_TARGET'] == 'Linux' and (CONFIG['CPU_ARCH'] in ('x86', 'x86_64')):
     # Default stack aligment is 16 bytes
     DIRS += ['asm']
-    if CONFIG['CPU_ARCH'] == 'x86_64':
-        # Update stack aligment to 32 bytes
-        if CONFIG['CC_TYPE'] == 'clang':
-            CFLAGS += ['-mstack-alignment=32']
-            SOURCES['../../third_party/dav1d/src/lib.c'].flags += ['-mstackrealign']
-            SOURCES['../../third_party/dav1d/src/thread_task.c'].flags += ['-mstackrealign']
-        elif CONFIG['CC_TYPE'] == 'gcc':
-            CFLAGS += ['-mpreferred-stack-boundary=5']
-            SOURCES['../../third_party/dav1d/src/lib.c'].flags += ['-mincoming-stack-boundary=4']
-            SOURCES['../../third_party/dav1d/src/thread_task.c'].flags += ['-mincoming-stack-boundary=4']
 
 # common sources
 SOURCES += [
     '../../third_party/dav1d/src/cdf.c',
     '../../third_party/dav1d/src/cpu.c',
     '../../third_party/dav1d/src/data.c',
     '../../third_party/dav1d/src/decode.c',
     '../../third_party/dav1d/src/dequant_tables.c',