Commit 8f7af996 authored by Henrik Gramner's avatar Henrik Gramner Committed by Henrik Gramner

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.
parent 68e844aa
Pipeline #6858 passed with stages
in 6 minutes and 40 seconds
...@@ -81,6 +81,8 @@ cdata.set10('CONFIG_LOG', get_option('logging')) ...@@ -81,6 +81,8 @@ cdata.set10('CONFIG_LOG', get_option('logging'))
# Arguments in test_args will be used even on feature tests # Arguments in test_args will be used even on feature tests
test_args = [] test_args = []
optional_arguments = []
# Define _POSIX_C_SOURCE to POSIX.1–2001 (IEEE Std 1003.1-2001) # Define _POSIX_C_SOURCE to POSIX.1–2001 (IEEE Std 1003.1-2001)
test_args += '-D_POSIX_C_SOURCE=200112L' test_args += '-D_POSIX_C_SOURCE=200112L'
add_project_arguments('-D_POSIX_C_SOURCE=200112L', language: 'c') add_project_arguments('-D_POSIX_C_SOURCE=200112L', language: 'c')
...@@ -96,10 +98,12 @@ if host_machine.system() == 'windows' ...@@ -96,10 +98,12 @@ if host_machine.system() == 'windows'
cdata.set('fseeko', '_fseeki64') cdata.set('fseeko', '_fseeki64')
cdata.set('ftello', '_ftelli64') cdata.set('ftello', '_ftelli64')
endif endif
endif
# On Windows, we use a compatibility layer to emulate pthread if (host_machine.cpu_family() == 'x86_64' and cc.get_id() == 'gcc')
if host_machine.system() == 'windows' optional_arguments += '-mcmodel=small'
endif
# On Windows, we use a compatibility layer to emulate pthread
thread_dependency = [] thread_dependency = []
thread_compat_dep = declare_dependency(sources : files('src/win32/thread.c')) thread_compat_dep = declare_dependency(sources : files('src/win32/thread.c'))
else else
...@@ -176,7 +180,7 @@ endif ...@@ -176,7 +180,7 @@ endif
# Compiler flags that should be set # Compiler flags that should be set
# But when the compiler does not supports them # But when the compiler does not supports them
# it is not an error and silently tolerated # it is not an error and silently tolerated
optional_arguments = [ optional_arguments += [
'-Wundef', '-Wundef',
'-Werror=vla', '-Werror=vla',
'-Wno-maybe-uninitialized', '-Wno-maybe-uninitialized',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment