From patchwork Thu Feb 22 16:01:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 204841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp35793dyb; Thu, 22 Feb 2024 08:02:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXnnoMx98NzCGYUAlD1vXDAhn8Y0z0F0ToHIiQDkgy3vlobUi5VwQ4gQmq+WGqP/dWdhLb8EZiIQ97lxHIAldDpBS/nAA== X-Google-Smtp-Source: AGHT+IGxwTZs/4IzmydMrDkwXnMCk0Ce5h/wrAgEwja13JBepGK+5j1Fa5wa51y+7K1kqygcoB+R X-Received: by 2002:a05:6000:2c2:b0:33d:6fe4:aeaa with SMTP id o2-20020a05600002c200b0033d6fe4aeaamr6699810wry.2.1708617769407; Thu, 22 Feb 2024 08:02:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708617769; cv=pass; d=google.com; s=arc-20160816; b=xRCxTxYBf2tAUwLvTtw3xg2Rw8985Id9+7KNUrTb13NNQ1wcJ1oFSYHCWlCGNC2TTQ v+FXpYnul6iOTG5MUtItQ0b9TSGxoHLC/o9GVSXOtqFmKuDjDADU5Q67UPIJHq4+01zz EuxurgRkFvnIBnFZIaCTdW6tTWvgKfS0GJ//HSCT4mqWefTRfEvpES8qI4OhiOFo0qy+ O3Lapu61k+l1+VSgh2yuQaZhXBc9XtDCeqHjOFb9CDJ3rV7cqBiJF1nZY3+lp7NBXwzK NARSfp/AgAZmfvuwsqG5nG4tirIetz0gdlWUldsFJoZWqXeej9RuS/WPkGASRZP12u8G ClaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to: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:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=wRnD3F/ysqseFk35pOE9oqFrPxI2Dl5W5BpCn9AlUDQ=; fh=vTbGg4wY0rLaolKO+EtTu7rlJzNAP3iHbUH+MVoijcQ=; b=hHEbEYkVbzXxM0A4J6R6/6kpTgc1sYdLSh8ehyI8WLEtHYzMYMl3OOhSUd5zLtZMHu 4n+T7JR4jegE7jO/4RN/U5XulQe63FAVNQPCHSIj77Yp1zuWTNLrjM4Eq/cjzyxout2G dwZ+sGdQOUNtAfSP0av1iLNE1d+273KMSER0B3U2aNrBImyo5IVcVQE3dYcn+bV57tzt OwcYCiADwmTKyYeuch7YK27L/u4YUe5IIoxvQm46sUosMxOU8Ja/SvgMVhSjr5G7kvHS jxxOS8syt5RWMI2EjC9M27dqDAe+LeOrVTI7Q2CYxF2elbRwkgB2iSS5u7WDlXxc4IFs N6kQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=BHjSkLKP; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d15-20020adff84f000000b0033cf7b58f3dsi7914167wrq.849.2024.02.22.08.02.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 08:02:49 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=BHjSkLKP; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CFCFD3858295 for ; Thu, 22 Feb 2024 16:02:46 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 644973858422 for ; Thu, 22 Feb 2024 16:01:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 644973858422 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 644973858422 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708617722; cv=none; b=p0FjkI+Io+nk+KM/S+LMpwuLSPO8XLQPNnZyVAhq8ypm4NFbXfbPI9HMANIs0zwAnuOPEqRAf3h4bjKsdR0Vd8W6Syml52lochHfqi6CsNKzPP3YE8YN1B4RJGnP/vnUx8JGp2hKLdRQ2szLXM4qq3hedmc1R1n5In4pryv/ez8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708617722; c=relaxed/simple; bh=JRz4ULfhIu/Mm8u4MWX9wOAttcCOSsulFK48696Ni4U=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ksWg6GJrSbDArenB4FL+FdXLTyNPfgCg+azCo4BTeRBxYYUd5icJ40SgX4FGaoW86lGnjU8SsKFUBzzxQ199pJKIaz619ykRZ/81T8veWOOV6rPxN/Ifqe0XIHzH2Fl3lgVRCLvDcoIU8Icp6PIGw8O1mMIcIBzJGxwXivw3p4U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MFuDGq026822; Thu, 22 Feb 2024 16:01:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=wRnD3F/ysqseFk35pOE9oqFrPxI2Dl5W5BpCn9AlUDQ=; b=BHjSkLKPX2iDqbbuZJr1JP34tJeVEiL1nNqoNZquljvKF67m4WuZgZ8xQFI1VRKS0nYp HemX+45ud8pCrJR4X2SJ8hGRwOcfoYTxcUSoOiApTnA5UQbYPYZ0n7PiCdpZedQiqB5O skZK8rmTx81qlDR4LCnc7yLHti4pSSCbj55674p2Ur/YxtmKkdgl4zcGtNPA6yvMcAkb h7gMSK/MtVH1dbrX3JBndXMZSoaNc9h77HHiyTuKZPH0ZniJCsZn6q1rBRp1neSXcLVg p8nw/J3OudzXZIP97R6W1uvI4lm3uyVsoGyRCnpnAp2zX9u6PkDy56QxDfrtvUwKT2+q KQ== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3we94x8jtm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 16:01:33 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41MDpIFp003596; Thu, 22 Feb 2024 16:01:32 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wb74tyg44-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 16:01:32 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41MG1RF234669070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 16:01:29 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 04C532006A; Thu, 22 Feb 2024 16:01:27 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8B1B20070; Thu, 22 Feb 2024 16:01:26 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 22 Feb 2024 16:01:26 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Indu Bhagat Cc: Jens Remus , Andreas Krebbel Subject: [PATCH 6/9] gas: Skip SFrame FDE if CFI specifies non-FP/SP base register Date: Thu, 22 Feb 2024 17:01:20 +0100 Message-Id: <20240222160123.2554459-7-jremus@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240222160123.2554459-1-jremus@linux.ibm.com> References: <20240222160123.2554459-1-jremus@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: KPqHQCryNPj3eXgPrVv3V_jne8Nkh1Vx X-Proofpoint-ORIG-GUID: KPqHQCryNPj3eXgPrVv3V_jne8Nkh1Vx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_11,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 mlxscore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220127 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791615585732812363 X-GMAIL-MSGID: 1791615585732812363 Do not generate SFrame FDE if DWARF CFI directives .cfi_def_cfa or .cfi_def_cfa_register specify a base register number other than the architecture-specific stack-pointer (SP) or frame-pointer (FP) register numbers. This also causes the assembler to print a warning message, so that skipping of the SFrame FDE does not occur silently. gas/ * gen-sframe.c: Skip SFrame generation if CFI specifies non-FP/SP base register. Reviewed-by: Andreas Krebbel Signed-off-by: Jens Remus --- Notes (jremus): Without this patch the assembler would erroneously generate bad SFrame information for the s390-specific SFrame error test cases 1 and 2, that get introduced by patch "s390: Initial support to generate .sframe from CFI directives in assembler". gas/gen-sframe.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c index d35baaac54b2..1269b2b77c54 100644 --- a/gas/gen-sframe.c +++ b/gas/gen-sframe.c @@ -986,7 +986,11 @@ sframe_xlate_do_def_cfa (struct sframe_xlate_ctx *xlate_ctx, get_dw_fde_start_addrS (xlate_ctx->dw_fde)); } /* Define the current CFA rule to use the provided register and - offset. */ + offset. However, if the register is not FP/SP, skip creating + SFrame stack trace info for the function. */ + if (cfi_insn->u.r != SFRAME_CFA_SP_REG + && cfi_insn->u.r != SFRAME_CFA_FP_REG) + return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */ sframe_fre_set_cfa_base_reg (cur_fre, cfi_insn->u.ri.reg); sframe_fre_set_cfa_offset (cur_fre, cfi_insn->u.ri.offset); cur_fre->merge_candidate = false; @@ -1004,9 +1008,14 @@ sframe_xlate_do_def_cfa_register (struct sframe_xlate_ctx *xlate_ctx, struct sframe_row_entry *last_fre = xlate_ctx->last_fre; /* Get the scratchpad FRE. This FRE will eventually get linked in. */ struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre; + gas_assert (cur_fre); /* Define the current CFA rule to use the provided register (but to - keep the old offset). */ + keep the old offset). However, if the register is not FP/SP, + skip creating SFrame stack trace info for the function. */ + if (cfi_insn->u.r != SFRAME_CFA_SP_REG + && cfi_insn->u.r != SFRAME_CFA_FP_REG) + return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */ sframe_fre_set_cfa_base_reg (cur_fre, cfi_insn->u.ri.reg); sframe_fre_set_cfa_offset (cur_fre, last_fre->cfa_offset); cur_fre->merge_candidate = false;