From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2078) id A7D243858D28; Thu, 25 Jan 2024 04:42:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7D243858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706157778; bh=ncPXGne0DDE1Nbbb609LVu03tMyHHg+8u1YKevdNIt8=; h=From:To:Subject:Date:From; b=LMmd+N9DeIJ2vlHtrrFjtvqZ9rQZDfwnBP4qvcdVWfCFC1CLpL+1px5PVXBgtbMDo 1Z7xqCYwFgbSZ5jy77SCh1laSJTIeSsrRIw2N4FcPp2M0pwpB0/GjScWMDlPqL+foZ 70Ipkr2jFFJGpp2rNUWXQk3KAtYlZaMrxIWxWX68= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: hongtao Liu To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8410] Enable -mlam=u57 by default when compiled with -fsanitize=hwaddress. X-Act-Checkin: gcc X-Git-Author: liuhongt X-Git-Refname: refs/heads/master X-Git-Oldrev: 025b8f5eb71d1b774eb0bd44876093aab853b899 X-Git-Newrev: 73f0a1a70c22e4d117ece7ddfa53661bb74137d4 Message-Id: <20240125044258.A7D243858D28@sourceware.org> Date: Thu, 25 Jan 2024 04:42:58 +0000 (GMT) List-Id: https://gcc.gnu.org/g:73f0a1a70c22e4d117ece7ddfa53661bb74137d4 commit r14-8410-g73f0a1a70c22e4d117ece7ddfa53661bb74137d4 Author: liuhongt Date: Tue Jan 23 14:21:58 2024 +0800 Enable -mlam=u57 by default when compiled with -fsanitize=hwaddress. gcc/ChangeLog: * config/i386/i386-options.cc (ix86_option_override_internal): Enable -mlam=u57 by default when compiled with -fsanitize=hwaddress. Diff: --- gcc/config/i386/i386-options.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index b6f634e9a32..e66a58ed926 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -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. */