shithub: dav1d

Download patch

ref: 8f7af99687533d15a9b5d16abc7b9d7b0cd4dcd0
parent: 68e844aa1bb005a8ae21ebb0513cc03df1330f85
author: Henrik Gramner <[email protected]>
date: Thu May 9 09:47:08 EDT 2019

build: Use -mcmodel=small on 64-bit Windows

GCC (MinGW) uses -mcmodel=medium by default which results in somewhat
inefficient code, and there's no benefit for us in using that.

--- a/meson.build
+++ b/meson.build
@@ -81,6 +81,8 @@
 # Arguments in test_args will be used even on feature tests
 test_args = []
 
+optional_arguments = []
+
 # Define _POSIX_C_SOURCE to POSIX.1–2001 (IEEE Std 1003.1-2001)
 test_args  += '-D_POSIX_C_SOURCE=200112L'
 add_project_arguments('-D_POSIX_C_SOURCE=200112L', language: 'c')
@@ -96,10 +98,12 @@
         cdata.set('fseeko', '_fseeki64')
         cdata.set('ftello', '_ftelli64')
     endif
-endif
 
-# On Windows, we use a compatibility layer to emulate pthread
-if host_machine.system() == 'windows'
+    if (host_machine.cpu_family() == 'x86_64' and cc.get_id() == 'gcc')
+        optional_arguments += '-mcmodel=small'
+    endif
+
+    # On Windows, we use a compatibility layer to emulate pthread
     thread_dependency = []
     thread_compat_dep = declare_dependency(sources : files('src/win32/thread.c'))
 else
@@ -176,7 +180,7 @@
 # Compiler flags that should be set
 # But when the compiler does not supports them
 # it is not an error and silently tolerated
-optional_arguments = [
+optional_arguments += [
   '-Wundef',
   '-Werror=vla',
   '-Wno-maybe-uninitialized',