diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-22 05:55:40 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-22 05:55:40 +0000 |
commit | f89175bba36ff9b93ac3212da63c86af97ccd018 (patch) | |
tree | 36352461df132eef6f972e42a369651f69061d37 /gcc/cfgexpand.c | |
parent | 894e49ede85a55968e8cc7cc75e13b34d20cd553 (diff) | |
download | gcc-f89175bba36ff9b93ac3212da63c86af97ccd018.tar.gz |
PR middle-end/60281
* asan.c (asan_emit_stack_protection): Force the base to align to
appropriate bits if STRICT_ALIGNMENT. Set shadow_mem align to
appropriate bits if STRICT_ALIGNMENT.
* cfgexpand.c (expand_stack_vars): Set base_align appropriately
when asan is on.
(expand_used_vars): Leave a space in the stack frame for alignment
if STRICT_ALIGNMENT.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209554 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r-- | gcc/cfgexpand.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index f2fd5fc92a9..78eca25f493 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1013,10 +1013,19 @@ expand_stack_vars (bool (*pred) (size_t), struct stack_vars_data *data) if (data->asan_base == NULL) data->asan_base = gen_reg_rtx (Pmode); base = data->asan_base; + + if (!STRICT_ALIGNMENT) + base_align = crtl->max_used_stack_slot_alignment; + else + base_align = MAX (crtl->max_used_stack_slot_alignment, + GET_MODE_ALIGNMENT (SImode) + << ASAN_SHADOW_SHIFT); } else - offset = alloc_stack_frame_space (stack_vars[i].size, alignb); - base_align = crtl->max_used_stack_slot_alignment; + { + offset = alloc_stack_frame_space (stack_vars[i].size, alignb); + base_align = crtl->max_used_stack_slot_alignment; + } } else { @@ -1845,6 +1854,11 @@ expand_used_vars (void) = alloc_stack_frame_space (redzonesz, ASAN_RED_ZONE_SIZE); data.asan_vec.safe_push (prev_offset); data.asan_vec.safe_push (offset); + /* Leave space for alignment if STRICT_ALIGNMENT. */ + if (STRICT_ALIGNMENT) + alloc_stack_frame_space ((GET_MODE_ALIGNMENT (SImode) + << ASAN_SHADOW_SHIFT) + / BITS_PER_UNIT, 1); var_end_seq = asan_emit_stack_protection (virtual_stack_vars_rtx, |