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, From patchwork Tue Sep 27 00:23:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 1479 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp75139wrt; Mon, 26 Sep 2022 17:24:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FHYWhCiLrq96grvFLbs2IHx8Z0kz46C7oaj/34H/cqyUXcgAI3Iy6p369skJgnRQm/5oI X-Received: by 2002:a17:907:a4a:b0:77b:c1b2:479a with SMTP id be10-20020a1709070a4a00b0077bc1b2479amr21147295ejc.109.1664238294562; Mon, 26 Sep 2022 17:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664238294; cv=none; d=google.com; s=arc-20160816; b=yH5EdHb7aSWczP2gog9J6sGfwC7kuRAAxQeFELjs1DGVt8ExXKpGcCRL3LYKjFPT3V h9DZWf6Kn7TCLG/epC0ksCPutvNUE93MzPP8dJFVjKlpkUAoSlA2cC/HqMqcncRb/Vcz d1O2Hzl6wsmtz9+seyr91/cqkhP2CVxA+OTschne46ldb++RGCo+Z1siTH05yVoueQKd PY0X+jZs/94tOwIQbgiZrTudnQgaP9JgXZYE6TWI1KGdb+nnRxGxOU0gc63783a/CHTp 1o/RhAmZA90c5hT99nAEz0B3YGfOot+Jw31H1p86fOyIHSnRkQpSukyGat9+/6o31Rv/ a2Cw== 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=gvNQkd9/I2DyDVfLkpsC1bhzrF+t5oSm8omK3PEzgxc=; b=XmhVRcFsz+aFrnhwPUPtHcEb1mhTROsL3XR66OqnkdapJEbUWJCE6Fp8PH18Up3l+5 AOjOE+MV0dXGMiYjSenJ2WSTlbzsW14MeEDlWc+1yA6z9vwSod2GnpOZeYYt11IeS+wt adQyM4AD4Ni4cIaormxGuSkfVmMRJrr1JURXl/6QIV36+CkvsyoBG5lqQtSTRK7VblKj N5zwI2ajPDbylRqtxeLiGm0CbNQSRhKes7/At8PG0JWLoVkI3YXET3fCx5xs89Yy4JBc 64NcYdkmr0KJ5wyxRU3jCEMeMOluiOCQ37aDr0HpIfme7vPajDHm4DaDgbTR8n7T6u/R muDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=QnFKeXou; 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 hz5-20020a1709072ce500b00734c8b99826si1203428ejc.803.2022.09.26.17.24.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 17:24:54 -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=QnFKeXou; 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 69A943858299 for ; Tue, 27 Sep 2022 00:24:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 69A943858299 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664238281; bh=gvNQkd9/I2DyDVfLkpsC1bhzrF+t5oSm8omK3PEzgxc=; 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=QnFKeXouaK0kKGJzMzg6J7oBcOoOd59NwgSdlzzplVl0FzOY92ONAvkFd4mIJEz6U caUzscjceXd0QqfzaNp+cb1a0G9tivjHPD+NW546leRHQOTdWVlKQbFXRUbvDK/chH Aoa6ieT2++McUh8lxRHf9shLHpl8fzTX0zipMJzI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 42CAA3858D37 for ; Tue, 27 Sep 2022 00:23:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 42CAA3858D37 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28QNRQ0f005034 for ; Tue, 27 Sep 2022 00:23:43 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3junrxsgfk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 27 Sep 2022 00:23:42 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28R01G7v027643 for ; Tue, 27 Sep 2022 00:23:42 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3junrxsges-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 00:23:42 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28R0KCHt021111; Tue, 27 Sep 2022 00:23:40 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma06fra.de.ibm.com with ESMTP id 3jss5hta0v-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 28R0Nan61507876 (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 B8A46AE04D; 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 80B33AE045; 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 2/2] IBM zSystems: Define CODE_LABEL_BOUNDARY Date: Tue, 27 Sep 2022 02:23:34 +0200 Message-Id: <20220927002334.651057-3-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-GUID: Y9K2vWsN2AotYV26aOGpUzxxOP4r1yVD X-Proofpoint-ORIG-GUID: OEkutcKHcYEK-Nfi7c4A8FPo62NY3ohK 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 clxscore=1015 priorityscore=1501 mlxlogscore=999 mlxscore=0 spamscore=0 bulkscore=0 adultscore=0 impostorscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209260149 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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?1745080334131893118?= X-GMAIL-MSGID: =?utf-8?q?1745080334131893118?= Currently s390 emits the following sequence to store a frame_pc: a: .LASANPC0: lg %r1,.L5-.L4(%r13) la %r1,0(%r1,%r12) stg %r1,176(%r11) .L5: .quad .LASANPC0@GOTOFF The reason GOT indirection is used instead of larl is that gcc does not know that .LASANPC0, being a code label, is aligned on a 2-byte boundary, and larl can load only even addresses. Define CODE_LABEL_BOUNDARY in order to get rid of GOT indirection: larl %r1,.LASANPC0 stg %r1,176(%r11) gcc/ChangeLog: 2020-06-30 Ilya Leoshkevich * config/s390/s390.h (CODE_LABEL_BOUNDARY): Specify that s390 requires code labels to be aligned on a 2-byte boundary. gcc/testsuite/ChangeLog: 2019-06-30 Ilya Leoshkevich * gcc.target/s390/asan-no-gotoff.c: New test. --- gcc/config/s390/s390.h | 3 +++ gcc/testsuite/gcc.target/s390/asan-no-gotoff.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/asan-no-gotoff.c diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index be566215df2..7d078ce6868 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -368,6 +368,9 @@ extern const char *s390_host_detect_local_cpu (int argc, const char **argv); /* Allocation boundary (in *bits*) for the code of a function. */ #define FUNCTION_BOUNDARY 64 +/* Alignment required for a code label, in bits. */ +#define CODE_LABEL_BOUNDARY 16 + /* There is no point aligning anything to a rounder boundary than this. */ #define BIGGEST_ALIGNMENT 64 diff --git a/gcc/testsuite/gcc.target/s390/asan-no-gotoff.c b/gcc/testsuite/gcc.target/s390/asan-no-gotoff.c new file mode 100644 index 00000000000..f555e4e96f8 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/asan-no-gotoff.c @@ -0,0 +1,15 @@ +/* Test that ASAN labels are referenced without unnecessary indirections. */ + +/* { dg-do compile } */ +/* { dg-options "-fPIE -O2 -fsanitize=kernel-address --param asan-stack=1" } */ + +extern void c (int *); + +void a () +{ + int b; + c (&b); +} + +/* { dg-final { scan-assembler {\tlarl\t%r\d+,\.LASANPC\d+} } } */ +/* { dg-final { scan-assembler-not {\.LASANPC\d+@GOTOFF} } } */