[v5,1/2] asan: specify alignment for LASANPC labels
Checks
Commit Message
gcc/ChangeLog:
2020-06-30 Ilya Leoshkevich <iii@linux.ibm.com>
* asan.cc (asan_emit_stack_protection): Use CODE_LABEL_BOUNDARY.
* defaults.h (CODE_LABEL_BOUNDARY): New macro.
* doc/tm.texi: Document CODE_LABEL_BOUNDARY.
* doc/tm.texi.in: Likewise.
---
gcc/asan.cc | 1 +
gcc/defaults.h | 5 +++++
gcc/doc/tm.texi | 4 ++++
gcc/doc/tm.texi.in | 4 ++++
4 files changed, 14 insertions(+)
@@ -1960,6 +1960,7 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb,
DECL_INITIAL (decl) = decl;
TREE_ASM_WRITTEN (decl) = 1;
TREE_ASM_WRITTEN (id) = 1;
+ SET_DECL_ALIGN (decl, CODE_LABEL_BOUNDARY);
emit_move_insn (mem, expand_normal (build_fold_addr_expr (decl)));
shadow_base = expand_binop (Pmode, lshr_optab, base,
gen_int_shift_amount (Pmode, ASAN_SHADOW_SHIFT),
@@ -1455,4 +1455,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
typedef TARGET_UNIT target_unit;
#endif
+/* Alignment required for a code label, in bits. */
+#ifndef CODE_LABEL_BOUNDARY
+#define CODE_LABEL_BOUNDARY BITS_PER_UNIT
+#endif
+
#endif /* ! GCC_DEFAULTS_H */
@@ -1075,6 +1075,10 @@ to a value equal to or larger than @code{STACK_BOUNDARY}.
Alignment required for a function entry point, in bits.
@end defmac
+@defmac CODE_LABEL_BOUNDARY
+Alignment required for a code label, in bits.
+@end defmac
+
@defmac BIGGEST_ALIGNMENT
Biggest alignment that any data type can require on this machine, in
bits. Note that this is not the biggest alignment that is supported,
@@ -971,6 +971,10 @@ to a value equal to or larger than @code{STACK_BOUNDARY}.
Alignment required for a function entry point, in bits.
@end defmac
+@defmac CODE_LABEL_BOUNDARY
+Alignment required for a code label, in bits.
+@end defmac
+
@defmac BIGGEST_ALIGNMENT
Biggest alignment that any data type can require on this machine, in
bits. Note that this is not the biggest alignment that is supported,