Skip to content

Commit

Permalink
[meson] Move definition of cflags_custom_stack_protector to x86_64 se…
Browse files Browse the repository at this point in the history
…ction

Since most of the flags defined in cflags_custom_stack_protector are
x86-specific, move the whole definition to an x86_64-specific section.

Signed-off-by: Stefan Berger <[email protected]>
  • Loading branch information
stefanberger authored and mkow committed Jul 27, 2021
1 parent 4e13a27 commit 5e1b8f3
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,19 @@ subdir('Scripts')
# Not all compilers support mstack-protector-guard, so use stack protector only if supported.
# Graphene-custom stack protector uses the canary stored in the TCB (same for both in LibOS and PAL)
# at offset 0x8.
cflags_custom_stack_protector = [
'-fstack-protector-strong',
'-mstack-protector-guard=tls',
'-mstack-protector-guard-reg=%gs',
'-mstack-protector-guard-offset=8',
]
if host_machine.cpu_family() == 'x86_64'
cflags_custom_stack_protector = [
'-fstack-protector-strong',
'-mstack-protector-guard=tls',
'-mstack-protector-guard-reg=%gs',
'-mstack-protector-guard-offset=8',
]
else
cflags_custom_stack_protector = [
'-fstack-protector-strong',
]
endif

if not cc.has_multi_arguments(cflags_custom_stack_protector)
cflags_custom_stack_protector = '-fno-stack-protector'
endif
Expand Down

0 comments on commit 5e1b8f3

Please sign in to comment.