summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2019-02-15 21:40:24 +0000
committerDongkyun Son <dongkyun.s@samsung.com>2019-07-22 12:15:08 +0000
commit1f34038093e95f5e302bf8f010e3efec921c69d5 (patch)
tree72cd9c5d105670ba7e3b2d9781ec3b680022e592
parent9c821914467fa884a0b3b57fe2fa93a5dc71136b (diff)
downloadlinaro-gcc-1f34038093e95f5e302bf8f010e3efec921c69d5.tar.gz
linaro-gcc-1f34038093e95f5e302bf8f010e3efec921c69d5.tar.bz2
linaro-gcc-1f34038093e95f5e302bf8f010e3efec921c69d5.zip
* asan.c (asan_emit_stack_protection): Use full-sized mask to align
the base address on 64-bit strict-alignment platforms. (cherry picked from 724165bd22886d1fa486513c1b695302b307726e) Change-Id: I52f5266e8336b7959b655226ae8619afc35b2692 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268949 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/asan.c12
2 files changed, 12 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ffa65a3abef..ecad014e0a5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-02-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * asan.c (asan_emit_stack_protection): Use full-sized mask to align
+ the base address on 64-bit strict-alignment platforms.
+
2019-02-12 Eric Botcazou <ebotcazou@adacore.com>
* asan.c (asan_expand_mark_ifn): Take into account the alignment of
diff --git a/gcc/asan.c b/gcc/asan.c
index b32dbc950b7..ae83c695548 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1256,13 +1256,15 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb,
base_align_bias = ((asan_frame_size + alignb - 1)
& ~(alignb - HOST_WIDE_INT_1)) - asan_frame_size;
}
+
/* Align base if target is STRICT_ALIGNMENT. */
if (STRICT_ALIGNMENT)
- base = expand_binop (Pmode, and_optab, base,
- gen_int_mode (-((GET_MODE_ALIGNMENT (SImode)
- << ASAN_SHADOW_SHIFT)
- / BITS_PER_UNIT), Pmode), NULL_RTX,
- 1, OPTAB_DIRECT);
+ {
+ const HOST_WIDE_INT align
+ = (GET_MODE_ALIGNMENT (SImode) / BITS_PER_UNIT) << ASAN_SHADOW_SHIFT;
+ base = expand_binop (Pmode, and_optab, base, gen_int_mode (-align, Pmode),
+ NULL_RTX, 1, OPTAB_DIRECT);
+ }
if (use_after_return_class == -1 && pbase)
emit_move_insn (pbase, base);