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} } } */