From patchwork Thu Feb 22 16:01:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 204842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp36744dyb; Thu, 22 Feb 2024 08:03:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV1y9J79APhP4cjvOP7r/9BvNXZWshM4kxeQWk7KuvotVKsWZdhUpDxG6NWRLLN9K/1bDnkennilmbZb6VptIcpyCaCxA== X-Google-Smtp-Source: AGHT+IHuqY1IFyXc/sMy5LYWpe8LYDs7o+LYXM5fhw3+CO7/Nw5uySzZ5F1rfXakd6xYVKBYnGRs X-Received: by 2002:a05:6214:2624:b0:68f:6410:99d7 with SMTP id gv4-20020a056214262400b0068f641099d7mr14656348qvb.64.1708617825910; Thu, 22 Feb 2024 08:03:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708617825; cv=pass; d=google.com; s=arc-20160816; b=fyXm5DR9r5T+kvXE2ijJ2974aTUNFj7SJsRF94fUwrrxB/IETNx/JprfPYVotdYZjg /r27HkhDyfZDY4V44/lE7LcpWR3Sb/TrCEkP1WSWFpee3u3GjDbAwLGuYf4VWuVy3lDm 4qIQEU61GE7WEoqkyb88YSdcB40GZeJ25QRjfSOVsrkkA8RnGsKYG8XXubo5eVJCTjJ4 iny/EDJXsQlGboi4BZjaw+zv35hUvv2I+pmWWLgzGMi3vA9+NksZHtwmpu2YT91mZHHR 6NECb35ga48yclyiW9PO3Ijz0DzYfMi2CIx5NtAhpju33nJ7//PQOK2Nd0fuopoIE+WO VdMg== 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=h4cDKDwpj0p1o2IOVxdM1TYODj0Hcqr1m/3zD78wvys=; fh=vTbGg4wY0rLaolKO+EtTu7rlJzNAP3iHbUH+MVoijcQ=; b=VU5+Z4DCGS6fucECmTwbAven4RxudQgCntzl/PnAndfYGmYTRaZFtwyWNYK07N5rXk fq+kh85F23DgKxeYP3jLL4nquHvzx2pYdyX5TPhJ4ZR5FoUFOGLJ5gt8cUpGnq+1vQT0 dnuP8z6I/BVeiAyncC+yM+DU557NwK9VppyFSqwMo9A8lxVQpsDWYZg2N7avxfhUF7sc Sy3P3C6hT9EB/BSWS6DaYWsX7sYRtau4DiGW81ZtXJeTH4nvMDOuDwmHVcAr3cgvR6se 5/BOu4SkvDyEZA3h0FUImyVISEsW34DR0UUhAwVxQkWnMoAyT468UtI0DfSVrBPKtS5t INKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=B93edId1; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id j2-20020a05621419c200b0068fa742692asi3560875qvc.577.2024.02.22.08.03.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 08:03:45 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=B93edId1; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 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 6E82E3858D34 for ; Thu, 22 Feb 2024 16:03:45 +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 2C953385841C for ; Thu, 22 Feb 2024 16:01:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C953385841C 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 2C953385841C 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=1708617719; cv=none; b=gom5TxVR3BCHCwpDD3Sw/5uXKziHCg3e6cfrpgezOXd5mFfSwpXFlcwrAwcnCPOGBAeTYu7wvidR3yxARBqq83BbPOFghK7z9y9i15fx2ruy6KDnnKUt4r3bLjAk3jgs662PZMSssDW/QWzsvrOe9AI+W5g/20TBosiVqNYvEwk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708617719; c=relaxed/simple; bh=mpgJ/nsuUVudbftEpkk92AQBTn+iF31OBTw1utA3uFg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=gOchfEjtEb/ZVAsI0E8QEkSQZPXsEufjRy5bPAtblwwUis29IscMXETuZKRhTRKuXLAaz5fcVaa6NnvNtlaUsJReZp5dLvQ4tzcTIzCRo8/JIg0rADDtlafUtnyyeJuNJxLXEA3uZYIUoRocjb/omuvphKJcF8+D2k70s7yshAQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MFvD0N032057; Thu, 22 Feb 2024 16:01:35 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=h4cDKDwpj0p1o2IOVxdM1TYODj0Hcqr1m/3zD78wvys=; b=B93edId1T1QzLSJE9RyGE5TFK0vJkUAq/gACdiTPL2xE77R0ADkPdDvLDA4FDVb+d1pg hN3mN5kt46XUdjnZHP0V+XPHjcbf7njRMeIxUYWEamLc7AdQQrO603/+oKtqlu6vCHLt 9LJq5wPjx4OK+HvYK09ScvlGYwEuql2vgyK/I7lCWDZnZ2ic/Sd3JOISXFxPETLMxKpS r9fKBeT8yzxoLLxUsbHOFXACdk3RM1Yf6DFWWzLvhnph6Vvg612CjY1PleVLub2dRGnp Oq+x8JYDLvVwAbhuvFj5GzuxXn3uovRUZKKoNqtOaORpQOQepXigB2QDUoEJ15fF7cVe lg== 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 3we9c0082t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 16:01:34 +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 41ME8RV7003624; Thu, 22 Feb 2024 16:01:33 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wb74tyg46-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 16:01:33 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41MG1Sbt59572542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 16:01:30 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D12772004E; Thu, 22 Feb 2024 16:01:26 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B0FED2006A; 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 5/9] gas: Print DWARF call frame insn name in SFrame warning message Date: Thu, 22 Feb 2024 17:01:19 +0100 Message-Id: <20240222160123.2554459-6-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-ORIG-GUID: YJ8oYeHihZMbrXcckkICgPCMQFTJxLND X-Proofpoint-GUID: YJ8oYeHihZMbrXcckkICgPCMQFTJxLND 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 mlxscore=0 priorityscore=1501 mlxlogscore=999 phishscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 adultscore=0 malwarescore=0 bulkscore=0 impostorscore=0 suspectscore=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: 1791615645516113161 X-GMAIL-MSGID: 1791615645516113161 SFrame generation prints the DWARF call frame instruction opcode in hexadecimal. Leverage get_DW_CFA_name to additionally print the DWARF call frame instruction name in human readable form, while also respecting fake CFI types. Use "(unknown)", if the DWARF call frame instruction name is not known. This changes the following assembler SFrame generation warning message as follows: Old: Warning: skipping SFrame FDE due to DWARF CFI op 0x New: Warning: skipping SFrame FDE due to DWARF CFI op (0x) gas/ * gen-sframe.c (sframe_get_cfi_name): New function to get the DWARF call frame instruction name for a DWARF call frame instruction opcode. (sframe_do_cfi_insn): Use sframe_get_cfi_name to print the DWARF call frame instruction name for the DWARF call frame instruction opcode in the warning message. gas/testsuite/ * gas/cfi-sframe/common-empty-1.d: Update expected SFrame warning message text for DWARF call frame insn name. * gas/cfi-sframe/common-empty-2.d: Likewise. * gas/cfi-sframe/cfi-sframe-s390-err-1.l: Likewise. * gas/cfi-sframe/cfi-sframe-s390-err-2.l: Likewise. * gas/cfi-sframe/cfi-sframe-s390-err-3.l: Likewise. * gas/cfi-sframe/cfi-sframe-s390-err-4.l: Likewise. Reviewed-by: Andreas Krebbel Signed-off-by: Jens Remus --- gas/gen-sframe.c | 49 ++++++++++++++++++- gas/testsuite/gas/cfi-sframe/common-empty-1.d | 2 +- gas/testsuite/gas/cfi-sframe/common-empty-2.d | 2 +- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c index 75781fc8ccbd..d35baaac54b2 100644 --- a/gas/gen-sframe.c +++ b/gas/gen-sframe.c @@ -1197,6 +1197,46 @@ sframe_xlate_do_gnu_window_save (struct sframe_xlate_ctx *xlate_ctx, return SFRAME_XLATE_OK; } +/* Returns the DWARF call frame instruction name or fake CFI name for the + specified CFI opcode, or NULL if the value is not recognized. */ + +static const char * +sframe_get_cfi_name (int cfi_opc) +{ + const char *cfi_name; + + switch (cfi_opc) + { + /* Fake CFI type; outside the byte range of any real CFI insn. */ + /* See gas/dw2gencfi.h. */ + case CFI_adjust_cfa_offset: + cfi_name = "CFI_adjust_cfa_offset"; + break; + case CFI_return_column: + cfi_name = "CFI_return_column"; + break; + case CFI_rel_offset: + cfi_name = "CFI_rel_offset"; + break; + case CFI_escape: + cfi_name = "CFI_escape"; + break; + case CFI_signal_frame: + cfi_name = "CFI_signal_frame"; + break; + case CFI_val_encoded_addr: + cfi_name = "CFI_val_encoded_addr"; + break; + case CFI_label: + cfi_name = "CFI_label"; + break; + default: + cfi_name = get_DW_CFA_name (cfi_opc); + } + + return cfi_name; +} + /* Process CFI_INSN and update the translation context with the FRE information. @@ -1272,7 +1312,14 @@ sframe_do_cfi_insn (struct sframe_xlate_ctx *xlate_ctx, /* An error here will cause no SFrame FDE later. Warn the user because this will affect the overall coverage and hence, asynchronicity. */ if (err) - as_warn (_("skipping SFrame FDE due to DWARF CFI op %#x"), op); + { + const char *cfi_name = sframe_get_cfi_name (op); + + if (!cfi_name) + cfi_name = _("(unknown)"); + as_warn (_("skipping SFrame FDE due to DWARF CFI op %s (%#x)"), + cfi_name, op); + } return err; } diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-1.d b/gas/testsuite/gas/cfi-sframe/common-empty-1.d index 125612ff841f..d7756302b559 100644 --- a/gas/testsuite/gas/cfi-sframe/common-empty-1.d +++ b/gas/testsuite/gas/cfi-sframe/common-empty-1.d @@ -1,5 +1,5 @@ #as: --gsframe -#warning: skipping SFrame FDE due to DWARF CFI op 0xa +#warning: skipping SFrame FDE due to DWARF CFI op DW_CFA_remember_state \(0xa\) #objdump: --sframe=.sframe #name: Uninteresting cfi directives generate an empty SFrame section #... diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-2.d b/gas/testsuite/gas/cfi-sframe/common-empty-2.d index 59328fc1033f..20282c7854e8 100644 --- a/gas/testsuite/gas/cfi-sframe/common-empty-2.d +++ b/gas/testsuite/gas/cfi-sframe/common-empty-2.d @@ -1,5 +1,5 @@ #as: --gsframe -#warning: skipping SFrame FDE due to DWARF CFI op 0xe +#warning: skipping SFrame FDE due to DWARF CFI op DW_CFA_def_cfa_offset \(0xe\) #objdump: --sframe=.sframe #name: SFrame supports only FP/SP based CFA #...