]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Enable -mlam=u57 by default when compiled with -fsanitize=hwaddress.
authorliuhongt <hongtao.liu@intel.com>
Tue, 23 Jan 2024 06:21:58 +0000 (14:21 +0800)
committerliuhongt <hongtao.liu@intel.com>
Thu, 25 Jan 2024 04:42:37 +0000 (12:42 +0800)
gcc/ChangeLog:

* config/i386/i386-options.cc (ix86_option_override_internal):
Enable -mlam=u57 by default when compiled with
-fsanitize=hwaddress.

gcc/config/i386/i386-options.cc

index b6f634e9a3232e7b9cdb76ec87aa39b3cacc1d55..e66a58ed9260981b7bf90b5ba6411e600c516991 100644 (file)
@@ -2189,6 +2189,15 @@ ix86_option_override_internal (bool main_args_p,
       && opts->x_ix86_abi != DEFAULT_ABI)
     error ("%<-mabi=%s%> not supported with %<-fsanitize=thread%>", abi_name);
 
+  /* Hwasan is supported with lam_u57 only.  */
+  if (opts->x_flag_sanitize & SANITIZE_HWADDRESS)
+    {
+      if (ix86_lam_type == lam_u48)
+       warning (0, "%<-mlam=u48%> is not compatible with Hardware-assisted "
+                "AddressSanitizer, override to %<-mlam=u57%>");
+      ix86_lam_type = lam_u57;
+    }
+
   /* For targets using ms ABI enable ms-extensions, if not
      explicit turned off.  For non-ms ABI we turn off this
      option.  */