From patchwork Tue Sep 27 00:23:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 1478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp75126wrt; Mon, 26 Sep 2022 17:24:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4G/rvm//jd8oacmmaRLk3bJz65QGdmuWYo5BqZHO4JrE1Yr4dcG+GTC3u7p39t1sao7Isg X-Received: by 2002:a05:6402:540d:b0:450:bda7:f76e with SMTP id ev13-20020a056402540d00b00450bda7f76emr25211079edb.249.1664238290395; Mon, 26 Sep 2022 17:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664238290; cv=none; d=google.com; s=arc-20160816; b=i2MdGZ4EeuQSibf87bEz9JD+sEMFrydtPPxaxBfMolBgqn4YJcc8yd4CTlKoT5pLpK JOAQY8QWlF6+0w3SqFA03rg3iXZkqJ2cqZaMNMV7ibHPFRgUPl3ra9ckLHWA+7u+i+JD Fb3BaQSUMuQIFnxcXEJVpIN9JUnsvMUvluvnEolVs4npe+e6S43Eu+L6NarK3H0rMZkt 4KA47L7xYiMLgPaQFx2FWnA7WbQXPx3MBQ0OtGAAFXQOh5kUNNIY/ePPXklluhzPeGQo heC2K35MrFJY7iM1n70/jTakVW+t6lEKaeJYo7yH2oZCY4PtL+reyScP68L3eXAODx5F DwVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=zk1uAokqDfftWvWauoSXssdkCp8cgI0zRXNaqBRSaxs=; b=pYUpCm1n7Ck2opm+erboN2dvYB81IgPxYmakMPWWk/Jzz56OyS4JXmgGO3PfcN1VD3 Xg7sQMJRW0bXmqmSOFzmfUd8sKgYKaeWc8K2BdUfghHqrQPEBRYV9xX/+sersgq11FL4 57szbPlLuOALT1DLNMZ7T2c62FY9O0UtbdWvDDQBKtfEoLBnHiWGnPdgqsLfQnHoOOn9 8SirxlIggqFcTWZU+2Ai8JmBe2mweB6ho+NukKVan50OJnzgP3Xd9AyV85tyuTXU8RrS JkPiFcM8aYNeOVt9mRWxg5Etc1csJSJRpf/57V7bV5Tlo3lQi8+B6M7AmNNx+zRKkg+Q /Clg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=nyiQj13Q; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id hr36-20020a1709073fa400b007829feac6cfsi1636631ejc.976.2022.09.26.17.24.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 17:24:50 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=nyiQj13Q; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C86273858028 for ; Tue, 27 Sep 2022 00:24:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C86273858028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664238278; bh=zk1uAokqDfftWvWauoSXssdkCp8cgI0zRXNaqBRSaxs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=nyiQj13QJVgVLdmu/svYDzEqrKGwFMr+1ZQDg/VVKC+gQPshMfM80TkvPQjUUcVYw ZdZqtT0ESuHskPxm3jRbZezHZhO/Q4OiFJwPCF9A7YVXZfcTCroBWERqnWItcQsP+4 kL8a8ii9gyd1Q2r8a9UAAjoz/+Xx0X7mrvw8lNS0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 7D9E33858C52 for ; Tue, 27 Sep 2022 00:23:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7D9E33858C52 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28QLuIUE002925 for ; Tue, 27 Sep 2022 00:23:42 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jumefujq8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 27 Sep 2022 00:23:41 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28QNpHqj014079 for ; Tue, 27 Sep 2022 00:23:41 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jumefujpq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 00:23:41 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28R0LbIR003328; Tue, 27 Sep 2022 00:23:39 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 3jssh9b2tj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 00:23:39 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28R0Naiw1049148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Sep 2022 00:23:36 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6DB6EAE04D; Tue, 27 Sep 2022 00:23:36 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35662AE045; Tue, 27 Sep 2022 00:23:36 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.171.90.176]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 27 Sep 2022 00:23:36 +0000 (GMT) To: Jakub Jelinek Subject: [PATCH v5 1/2] asan: specify alignment for LASANPC labels Date: Tue, 27 Sep 2022 02:23:33 +0200 Message-Id: <20220927002334.651057-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220927002334.651057-1-iii@linux.ibm.com> References: <20220927002334.651057-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: xGpyEAlBZzVmaFF7Q65rAVyfJ7zPznGz X-Proofpoint-GUID: m-ogY8qHjy9K5TdK0barAUVRqzUDhQFp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-26_11,2022-09-22_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 spamscore=0 impostorscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209260149 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ilya Leoshkevich via Gcc-patches From: Ilya Leoshkevich Reply-To: Ilya Leoshkevich Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745080329544479018?= X-GMAIL-MSGID: =?utf-8?q?1745080329544479018?= gcc/ChangeLog: 2020-06-30 Ilya Leoshkevich * 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(+) diff --git a/gcc/asan.cc b/gcc/asan.cc index 8276f12cc69..62f50ee769b 100644 --- a/gcc/asan.cc +++ b/gcc/asan.cc @@ -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), diff --git a/gcc/defaults.h b/gcc/defaults.h index 953605c1627..52a471cf08e 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -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 */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 858bfb80cec..cc588ee23b5 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -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, diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 21b849ea32a..a0b725b0685 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -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,