From patchwork Mon Jun 24 14:23:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 92796 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8C1143846089 for ; Tue, 25 Jun 2024 02:09:04 +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 1FCDA384AB7D for ; Tue, 25 Jun 2024 02:08:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1FCDA384AB7D 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 1FCDA384AB7D 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=1719281300; cv=none; b=h1bllSlXJBqUBIWPnubTZwunodWYb/gvLC0qeiCmfBLrpIIb1hVEjN3ALSloai/JjrZCSd/zVtxzM3vWgWI2YcyjnDvka46uXiR1IjZ8EFNDVBVXlSYEKE4pWeOS1XSBoDLO6xOyM7JOetUCKj8uoifvZDkodmo81guZO2NlJLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719281300; c=relaxed/simple; bh=grkfOpsEMZpAeLGixOqy4ysT6ZyfJC6uCqwbmZrYuIo=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=obsWknG6S1jyNptQcl2BpicIw5iHXl69gPZEeAD9KumqM5hA7wDr32N0VlENsfe/NsafXi9avZ4psy3tj1YXHKh5yJdzhrSALdSNjI3dkDUl+qhX+TrpHfVa04L8SJauFTy56s4eWIMWL33wnEeKLN0T++Avfok4yZmuq61DktI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45OELfE5031419; Mon, 24 Jun 2024 14:27:07 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=R3Acxo4IZU42D Kfli8vQ+dwL9Rv8j23bko9i8sEerdw=; b=We+dNbV0Y/FP8LYnkm5IJNozX8E+T Gjhwz6mqC7aDXGeRgqeQKEhHsFT5FB8vJAhrqdqhJVx1zOL8un4szE6/b1zYUH7j JqQGhxrCKTTAr8UzYetGoWXNu3kiDTU7NXEHlOPbgHS8hdVGvHbDDe9wg4lagkev sPHd3AQfDLLTIHktGyOVrIf1NF1EIj9Jn+IgChC+Zq50NIq6fLWQkO3mCcq+48Nu lY3iK1l4lxggt1l8xcEdspGJlkWcQnhWemEkyCuM0kqMhoz94zTVy6ENr2aYtow2 w2PnN5Z0dkvqGT+rkxlYfW98+ryJQ2QRL8/1yM4TD9Cp7lVe7pZ2gIvuQ== 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 3yya59g2tk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2024 14:27:06 +0000 (GMT) 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 45OC8nAK018132; Mon, 24 Jun 2024 14:23:45 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yx8xu1eu2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Jun 2024 14:23:45 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45OENenj53477706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jun 2024 14:23:42 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 91A8E20074; Mon, 24 Jun 2024 14:23:38 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 842FA20073; Mon, 24 Jun 2024 14:23:38 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 24 Jun 2024 14:23:38 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Indu Bhagat Cc: Jens Remus , Andreas Krebbel Subject: [PATCH v4 11/15] gas: Skip SFrame FDE if .cfi_window_save Date: Mon, 24 Jun 2024 16:23:30 +0200 Message-Id: <20240624142334.3283823-12-jremus@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240624142334.3283823-1-jremus@linux.ibm.com> References: <20240624142334.3283823-1-jremus@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -vc3DY3-6VQluwHpgXMHoyPEvokMPDS- X-Proofpoint-ORIG-GUID: -vc3DY3-6VQluwHpgXMHoyPEvokMPDS- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-24_11,2024-06-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406240115 X-Spam-Status: No, score=-12.3 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 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+patchwork=sourceware.org@sourceware.org CFI opcode DW_CFA_AARCH64_negate_ra_state is multiplexed with DW_CFA_GNU_window_save. Process DW_CFA_AARCH64_negate_ra_state on AArch64. Skip generation of SFrame FDE otherwise with the following warning message: skipping SFrame FDE; .cfi_window_save gas/ * gen-sframe.c: Skip SFrame FDE if .cfi_window_save. Reviewed-by: Indu Bhagat Signed-off-by: Jens Remus --- Notes (jremus): Changes v3 -> v4: - Change warning message text to the following for consistency: skipping SFrame FDE; .cfi_window_save Changes v2 -> v3: - New patch. The intention is to skip all "unknown" CFI opcodes, which SFrame does not explicitly handle. DW_CFA_GNU_window_save seems to be handled only for the AArch64-specific multiplexed DW_CFA_AARCH64_negate_ra_state. The logic could be changed to be dependent on TC_AARCH64 at build-time instead of sframe_get_abi_arch() at run-time. gas/gen-sframe.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c index c29c407cc86f..2222d768799f 100644 --- a/gas/gen-sframe.c +++ b/gas/gen-sframe.c @@ -1256,12 +1256,12 @@ sframe_xlate_do_restore (struct sframe_xlate_ctx *xlate_ctx, return SFRAME_XLATE_OK; } -/* Translate DW_CFA_GNU_window_save into SFrame context. +/* Translate DW_CFA_AARCH64_negate_ra_state into SFrame context. Return SFRAME_XLATE_OK if success. */ static int -sframe_xlate_do_gnu_window_save (struct sframe_xlate_ctx *xlate_ctx, - struct cfi_insn_data *cfi_insn ATTRIBUTE_UNUSED) +sframe_xlate_do_aarch64_negate_ra_state (struct sframe_xlate_ctx *xlate_ctx, + struct cfi_insn_data *cfi_insn ATTRIBUTE_UNUSED) { struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre; @@ -1273,6 +1273,25 @@ sframe_xlate_do_gnu_window_save (struct sframe_xlate_ctx *xlate_ctx, return SFRAME_XLATE_OK; } +/* Translate DW_CFA_GNU_window_save into SFrame context. + DW_CFA_AARCH64_negate_ra_state is multiplexed with DW_CFA_GNU_window_save. + Return SFRAME_XLATE_OK if success. */ + +static int +sframe_xlate_do_gnu_window_save (struct sframe_xlate_ctx *xlate_ctx, + struct cfi_insn_data *cfi_insn) +{ + unsigned char abi_arch = sframe_get_abi_arch (); + + /* Translate DW_CFA_AARCH64_negate_ra_state into SFrame context. */ + if (abi_arch == SFRAME_ABI_AARCH64_ENDIAN_BIG + || abi_arch == SFRAME_ABI_AARCH64_ENDIAN_LITTLE) + return sframe_xlate_do_aarch64_negate_ra_state (xlate_ctx, cfi_insn); + + as_warn (_("skipping SFrame FDE; .cfi_window_save")); + return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */ +} + /* Returns the DWARF call frame instruction name or fake CFI name for the specified CFI opcode, or NULL if the value is not recognized. */