From patchwork Fri Feb 23 17:07:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 205530 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp720437dyb; Fri, 23 Feb 2024 09:10:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXM+mkLl1U4QH318R1Qd6OwU8wGepnOwNdB9dU3kXjTtCQnxWdieJaGGRAxoGrTyupe/QwLHXjFPCigfftWFKJjlksODg== X-Google-Smtp-Source: AGHT+IHw5A5/F3Lf6cy/xiXyeG2DS/eUYNjWx3K9pUbrwMqWMmjlpSOQ0/EwNHptgzp3iczHCaED X-Received: by 2002:a05:620a:389c:b0:787:3274:fbb2 with SMTP id qp28-20020a05620a389c00b007873274fbb2mr440700qkn.48.1708708226230; Fri, 23 Feb 2024 09:10:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708708226; cv=pass; d=google.com; s=arc-20160816; b=AXL9OwCEN2TDyMJs3MG3JqBFBkUfc7ruBheGM3QIcT8J4JfP8urnJJMs94q6E55IdY jGgeUUdDv/XtaDIcVbgmzHFtgFnUqp1bx1ib/YtvOpxlD7g4UgwLaq7P3AoHcNPOYod/ KLXnOSrn4mr+2xwY0tK7YntV0WFo7L/JV0UPycXi4cyzaHjHEgVsm2audWq35nh7AgB2 ixVYgVHZLwFopEdQbyMGJsl4BUdkTDj0VXD9T6xrHtzH2x28d4Bu8SLbW1NoHWhYPHMy iJFTcfhJC3Lu+OOxVrV0XLi56agohpJG2G1pWdvtqMKAvq3Lcrh/cvTFB/ktKSgep9GK oSlQ== 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=uEgA3DGFpMCU943dgFOOLiwqA6Q7Gs7Tpd1KJEcQeecSm/MRoMorDo8F+XSFRcyfCx BpZmg908F7IWIrDLGPjJdSLA8K/RRnODvx8X7TVYoSdr2pBT4eXMcjy5SDCG5soAaAgS M7tgeDvS/xE0tjvGI2o0pMK9QZQADwVQUpEYXV3S9Hd72kvdFbTFM10x6PtTGq2N/you 7V/7dzIZI8JUa+bAO85FF7IffLZul0m1cYW3kJ3DzIPLHFBEw/1s4s6mkM12jCZ3oiLj qiD8E1YFAirUUvdIxYKW2JmzLF6LI1p7ljQTzp7iCsWpi374/LQ3dxmkMZk5i15Ery7k juJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="RUw/aQTT"; 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 qs20-20020a05620a395400b007871951e0bfsi17681814qkn.451.2024.02.23.09.10.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:10:26 -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="RUw/aQTT"; 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 1704F3857C4D for ; Fri, 23 Feb 2024 17:10:15 +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 ED46E3858413 for ; Fri, 23 Feb 2024 17:08:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED46E3858413 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 ED46E3858413 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=1708708099; cv=none; b=wxvqdaBYIBs46Q2DEXQ8ohFaxD4taC5TeWzkpHXAhy0dc7kzONLNIP0YdLBAwIWEHXzF8ru6VqxhdpMlLBmq56bUqoJoZmOE6qMRHmb7GN3pZ9eYRtETuNJlQU6wRdg3HAOo+vXnvi6nSOwxctwvawX2hhhlkWmF9GjP5wXXfZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708099; c=relaxed/simple; bh=mpgJ/nsuUVudbftEpkk92AQBTn+iF31OBTw1utA3uFg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=PZsO2lCuCrSYPbHDZ9dERcKuvcS4FHmAdRP2mc0jw9Q3WZldZToTOUaP5vXqY6LnF1OqrmrO4HdbQOmEZwzQnaf6lYeoRcySE39mWHws1qzfCM+l3RcFt9FXRvUWtcdEF0NDAz95B83Q4yhSPgPYwKyEVxP6mmqPeUpDmEdJwcY= 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 41NH2DT5003997; Fri, 23 Feb 2024 17:08:11 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=RUw/aQTTVQTBo2fN1d+DnFTQ7W15gzRlvVfDHIwgcLE5AMrc8UFvI+0TjpsWhDVsopGk sY26wB9S3GIUD2BUao6Hxe6Sh3Fc+63MBWYcmS5ASTLERFopr3kXY5sgQo3DLchgHvKV RIr2xRwuT8w1GxocXHihGV9T0E1iy2ZGbYk5vgy/AbC7LfxEgKMktUuIVfFFOPM0RFe/ Q8BJLpcYIVk910nERK7YCLOWBYHD5iScvy4Me2yTwUW8TIwuy/oXEtQEZQTasZk7wKPc Py4sGtjLERatlPi2wOnyS0Xn8XOPDa67Ht9cFvMzsIqObAK2qmD+ItBTBeGB+YopNBis lQ== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3weydh88em-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:10 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41NGaeeO013492; Fri, 23 Feb 2024 17:08:09 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wb7h0y0kn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:09 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41NH83IX65601902 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Feb 2024 17:08:05 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A821D20063; Fri, 23 Feb 2024 17:08:03 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81A3D20067; Fri, 23 Feb 2024 17:08:03 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 23 Feb 2024 17:08:03 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Indu Bhagat Cc: Jens Remus , Andreas Krebbel Subject: [PATCH v2 5/9] gas: Print DWARF call frame insn name in SFrame warning message Date: Fri, 23 Feb 2024 18:07:56 +0100 Message-Id: <20240223170800.3993092-6-jremus@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240223170800.3993092-1-jremus@linux.ibm.com> References: <20240223170800.3993092-1-jremus@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: I9mSAqnNmFfhz7OVTyhJz0t18Wq-MIXm X-Proofpoint-ORIG-GUID: I9mSAqnNmFfhz7OVTyhJz0t18Wq-MIXm 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-23_03,2024-02-23_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 impostorscore=0 spamscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402230125 X-Spam-Status: No, score=-12.6 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: 1791710437236012108 X-GMAIL-MSGID: 1791710437236012108 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 #...