Bug 1538455 - Use the default stack alignment in windows x64 for libdav1d. r=TD-Linux

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alex Chronopoulos 2019-03-27 20:46:11 +00:00
Родитель 574b9b89ea
Коммит 56a5006aee
3 изменённых файлов: 21 добавлений и 28 удалений

Просмотреть файл

@ -25,7 +25,9 @@ CFLAGS += [
'-I%s/dist/include/dav1d/' % TOPOBJDIR,
]
# Store the stack alignment that will be used.
stack_alignment = 0
# Attaching config.asm file
if CONFIG['CPU_ARCH'] == 'x86':
# Default stack alignment can be 4 bytes.
@ -40,29 +42,21 @@ if CONFIG['CPU_ARCH'] == 'x86':
CFLAGS += ['-mstack-alignment=16']
elif CONFIG['CC_TYPE'] == 'gcc':
CFLAGS += ['-mpreferred-stack-boundary=4']
if CONFIG['CPU_ARCH'] == 'x86_64':
elif CONFIG['CPU_ARCH'] == 'x86_64':
# Default stack aligment is 16 bytes.
stack_alignment = 16
if CONFIG['OS_TARGET'] == 'Darwin':
ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/osx/' % TOPSRCDIR]
elif CONFIG['OS_TARGET'] == 'WINNT':
ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/' % TOPSRCDIR]
ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/win/' % TOPSRCDIR]
elif CONFIG['OS_TARGET'] == 'Android':
error('Platform %s is not expected' % CONFIG['OS_TARGET'])
else:
# The rest of the platforms are all Linux flavors
# Linux,OpenBSD,NetBSD,FreeBSD,DragonFly,SunOS
ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/linux/' % TOPSRCDIR]
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']
else:
error('Cpu arch %s is not expected' % CONFIG['CPU_ARCH'])
# Set the macro here instead of config.h
if stack_alignment == 0:

Просмотреть файл

@ -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

Просмотреть файл

@ -51,23 +51,11 @@ if CONFIG['MOZ_DAV1D_ASM']:
CFLAGS += ['-mpreferred-stack-boundary=4']
for ep in entrypoint_source_files:
SOURCES[ep].flags += ['-mincoming-stack-boundary=2']
# The default stack alignment in x86_64 is 16 bytes. On all Linux flavors the
# default is used due to crashes with 32 bytes stack alignment.
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']
else:
elif CONFIG['CPU_ARCH'] == 'x86_64':
# The default stack alignment in x86_64 is 16 bytes.
stack_alignment = 16
else:
error('Cpu arch %s is not expected' % CONFIG['CPU_ARCH'])
# Set the macro here instead of config.h
if stack_alignment == 0: