xtensa: enable address sanitizer

2017-12-05  Max Filippov  <jcmvbkbc@gmail.com>

	Backport from mainline
	2017-12-05  Max Filippov  <jcmvbkbc@gmail.com>
	* config/xtensa/xtensa.c (xtensa_asan_shadow_offset): New
	function.
	(TARGET_ASAN_SHADOW_OFFSET): New macro definition.
	* config/xtensa/xtensa.h (FRAME_GROWS_DOWNWARD): Set to 1 if
	ASAN is enabled.

From-SVN: r255422
This commit is contained in:
Max Filippov 2017-12-05 14:31:41 +00:00 committed by Max Filippov
parent 6c118c0f70
commit d888144028
3 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,13 @@
2017-12-05 Max Filippov <jcmvbkbc@gmail.com>
Backport from mainline
2017-12-05 Max Filippov <jcmvbkbc@gmail.com>
* config/xtensa/xtensa.c (xtensa_asan_shadow_offset): New
function.
(TARGET_ASAN_SHADOW_OFFSET): New macro definition.
* config/xtensa/xtensa.h (FRAME_GROWS_DOWNWARD): Set to 1 if
ASAN is enabled.
2017-12-05 Max Filippov <jcmvbkbc@gmail.com>
Backport from mainline

View File

@ -176,6 +176,7 @@ static bool xtensa_member_type_forces_blk (const_tree,
machine_mode mode);
static void xtensa_conditional_register_usage (void);
static unsigned HOST_WIDE_INT xtensa_asan_shadow_offset (void);
@ -304,6 +305,9 @@ static void xtensa_conditional_register_usage (void);
#undef TARGET_CONDITIONAL_REGISTER_USAGE
#define TARGET_CONDITIONAL_REGISTER_USAGE xtensa_conditional_register_usage
#undef TARGET_ASAN_SHADOW_OFFSET
#define TARGET_ASAN_SHADOW_OFFSET xtensa_asan_shadow_offset
struct gcc_target targetm = TARGET_INITIALIZER;
@ -4337,4 +4341,12 @@ enum reg_class xtensa_regno_to_class (int regno)
return regno_to_class[regno];
}
/* Implement TARGET_ASAN_SHADOW_OFFSET. */
static unsigned HOST_WIDE_INT
xtensa_asan_shadow_offset (void)
{
return HOST_WIDE_INT_UC (0x10000000);
}
#include "gt-xtensa.h"

View File

@ -460,7 +460,8 @@ enum reg_class
#define STACK_GROWS_DOWNWARD 1
#define FRAME_GROWS_DOWNWARD flag_stack_protect
#define FRAME_GROWS_DOWNWARD (flag_stack_protect \
|| (flag_sanitize & SANITIZE_ADDRESS) != 0)
/* Offset within stack frame to start allocating local variables at. */
#define STARTING_FRAME_OFFSET \