Bug 1535631 - Use 16 byte stack alignment on dav1d in OSX. r=TD-Linux

Differential Revision: https://phabricator.services.mozilla.com/D24382

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alex Chronopoulos 2019-03-21 19:43:15 +00:00
parent 388044686f
commit 30586d8fe5
4 changed files with 25 additions and 21 deletions

View File

@ -25,6 +25,9 @@ CFLAGS += [
'-I%s/dist/include/dav1d/' % TOPOBJDIR,
]
# Default stack aligment is 16 bytes.
stack_alignment = 16
# Attaching config.asm file
if CONFIG['CPU_ARCH'] == 'x86':
if CONFIG['OS_TARGET'] == 'WINNT':
@ -42,13 +45,17 @@ if CONFIG['CPU_ARCH'] == 'x86_64':
else:
error('Platform %s is not expected' % CONFIG['OS_TARGET'])
if CONFIG['OS_TARGET'] in ('Darwin', 'WINNT'):
# Change the default stack alignment (16) to 32
if CONFIG['OS_TARGET'] == 'WINNT':
# Change the default stack alignment (16) to 32 bytes.
stack_alignment = 32
if CONFIG['CC_TYPE'] == 'clang':
CFLAGS += ['-mstack-alignment=32']
elif CONFIG['CC_TYPE'] == 'gcc':
CFLAGS += ['-mpreferred-stack-boundary=5']
# Set the macro here instead of config.h
DEFINES['STACK_ALIGNMENT'] = stack_alignment
if CONFIG['CPU_ARCH'] in ('x86', 'x86_64'):
SOURCES += [
'../../../third_party/dav1d/src/x86/cpu.c',

View File

@ -9,5 +9,5 @@
%define PREFIX 1
%define STACK_ALIGNMENT 32
%define STACK_ALIGNMENT 16

View File

@ -52,13 +52,6 @@
# define PREFIX 1
#endif
#if ARCH_x86_32 == 1 || \
(ARCH_X86_64 == 1 && defined(__linux__) && !defined(__ANDROID__))
# define STACK_ALIGNMENT 16
#else
# define STACK_ALIGNMENT 32
#endif
#if defined(_WIN32) || defined(__CYGWIN__)
// _WIN32_WINNT 0x0601 is set in global macros
# define UNICODE 1

View File

@ -30,18 +30,22 @@ SOURCES += [f for f in entrypoint_source_files]
DEFINES['DAV1D_API'] = ''
if CONFIG['MOZ_DAV1D_ASM']:
# Default stack alignment is 16 bytes
# Default stack alignment is 16 bytes.
stack_alignment = 16
DIRS += ['asm']
if CONFIG['OS_TARGET'] in ('WINNT', 'Darwin') and CONFIG['CPU_ARCH'] == 'x86_64':
# Update stack alignment to 32 bytes
if CONFIG['CC_TYPE'] == 'clang':
CFLAGS += ['-mstack-alignment=32']
for ep in entrypoint_source_files:
SOURCES[ep].flags += ['-mstackrealign']
elif CONFIG['CC_TYPE'] == 'gcc':
CFLAGS += ['-mpreferred-stack-boundary=5']
for ep in entrypoint_source_files:
SOURCES[ep].flags += ['-mincoming-stack-boundary=4']
if CONFIG['OS_TARGET'] == 'WINNT' and CONFIG['CPU_ARCH'] == 'x86_64':
stack_alignment = 32
# Update stack alignment to 32 bytes.
if CONFIG['CC_TYPE'] == 'clang':
CFLAGS += ['-mstack-alignment=32']
for ep in entrypoint_source_files:
SOURCES[ep].flags += ['-mstackrealign']
elif CONFIG['CC_TYPE'] == 'gcc':
CFLAGS += ['-mpreferred-stack-boundary=5']
for ep in entrypoint_source_files:
SOURCES[ep].flags += ['-mincoming-stack-boundary=4']
# Set the macro here instead of config.h
DEFINES['STACK_ALIGNMENT'] = stack_alignment
if CONFIG['OS_TARGET'] == 'Linux':
# For fuzzing, We only support building on Linux currently.