mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
build: move SafeStack tests to meson
This disables the old behavior of detecting SafeStack from environment CFLAGS. SafeStack is now enabled purely based on the configure arguments. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
34f983d86f
commit
721fa5e563
4 changed files with 32 additions and 73 deletions
26
meson.build
26
meson.build
|
@ -211,6 +211,31 @@ if get_option('prefer_static')
|
|||
qemu_ldflags += get_option('b_pie') ? '-static-pie' : '-static'
|
||||
endif
|
||||
|
||||
# Compiles if SafeStack *not* enabled
|
||||
safe_stack_probe = '''
|
||||
int main(void)
|
||||
{
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(safe_stack)
|
||||
#error SafeStack Enabled
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}'''
|
||||
if get_option('safe_stack') != not cc.compiles(safe_stack_probe)
|
||||
safe_stack_arg = get_option('safe_stack') ? '-fsanitize=safe-stack' : '-fno-sanitize=safe-stack'
|
||||
if get_option('safe_stack') != not cc.compiles(safe_stack_probe, args: safe_stack_arg)
|
||||
error(get_option('safe_stack') \
|
||||
? 'SafeStack not supported by your compiler' \
|
||||
: 'Cannot disable SafeStack')
|
||||
endif
|
||||
qemu_cflags += safe_stack_arg
|
||||
qemu_ldflags += safe_stack_arg
|
||||
endif
|
||||
if get_option('safe_stack') and config_host['CONFIG_COROUTINE_BACKEND'] != 'ucontext'
|
||||
error('SafeStack is only supported with the ucontext coroutine backend')
|
||||
endif
|
||||
|
||||
if get_option('sanitizers')
|
||||
if cc.has_argument('-fsanitize=address')
|
||||
qemu_cflags = ['-fsanitize=address'] + qemu_cflags
|
||||
|
@ -1951,6 +1976,7 @@ config_host_data.set('CONFIG_OPENGL', opengl.found())
|
|||
config_host_data.set('CONFIG_PROFILER', get_option('profiler'))
|
||||
config_host_data.set('CONFIG_RBD', rbd.found())
|
||||
config_host_data.set('CONFIG_RDMA', rdma.found())
|
||||
config_host_data.set('CONFIG_SAFESTACK', get_option('safe_stack'))
|
||||
config_host_data.set('CONFIG_SDL', sdl.found())
|
||||
config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
|
||||
config_host_data.set('CONFIG_SECCOMP', seccomp.found())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue