return asan_shadow_offset_value;
}
+/* Returns Asan shadow offset has been set. */
+bool
+asan_shadow_offset_set_p ()
+{
+ return asan_shadow_offset_computed;
+}
+
alias_set_type asan_shadow_set = -1;
/* Pointer types to 1, 2 or 4 byte integers in shadow memory. A separate
extern bool set_asan_shadow_offset (const char *);
+extern bool asan_shadow_offset_set_p ();
+
extern void set_sanitized_sections (const char *);
extern bool asan_sanitize_stack_p (void);
/* Address Sanitizer needs porting to each target architecture. */
if ((flag_sanitize & SANITIZE_ADDRESS)
- && (!FRAME_GROWS_DOWNWARD || targetm.asan_shadow_offset == NULL))
+ && !FRAME_GROWS_DOWNWARD)
{
warning_at (UNKNOWN_LOCATION, 0,
"%<-fsanitize=address%> and %<-fsanitize=kernel-address%> "
flag_sanitize &= ~SANITIZE_ADDRESS;
}
+ if ((flag_sanitize & SANITIZE_USER_ADDRESS)
+ && targetm.asan_shadow_offset == NULL)
+ {
+ warning_at (UNKNOWN_LOCATION, 0,
+ "%<-fsanitize=address%> not supported for this target");
+ flag_sanitize &= ~SANITIZE_ADDRESS;
+ }
+
+ if ((flag_sanitize & SANITIZE_KERNEL_ADDRESS)
+ && (targetm.asan_shadow_offset == NULL
+ && param_asan_stack
+ && !asan_shadow_offset_set_p ()))
+ {
+ warning_at (UNKNOWN_LOCATION, 0,
+ "%<-fsanitize=kernel-address%> with stack protection "
+ "is not supported without %<-fasan-shadow-offset=%> "
+ "for this target");
+ flag_sanitize &= ~SANITIZE_ADDRESS;
+ }
+
/* Do not use IPA optimizations for register allocation if profiler is active
or patchable function entries are inserted for run-time instrumentation
or port does not emit prologue and epilogue as RTL. */