From patchwork Fri Feb 23 17:07:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 205528 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp719720dyb; Fri, 23 Feb 2024 09:09:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU+R+2KIstTmg5KG8VBD3zItabol4davSNHYj8Av+YbVkglrWcGM0aTUVQwSxVopsrgtmGF+ljpEmRhfWgUzZZF3pkl8w== X-Google-Smtp-Source: AGHT+IHUj7vnhyx8NN2Ewq/HLM9MQZAjdzO2iuo44VTjrbUqVd6RN23G4+hPDl3pRHoIpIosg9Cc X-Received: by 2002:ac8:5bd6:0:b0:42e:68ff:e4be with SMTP id b22-20020ac85bd6000000b0042e68ffe4bemr508904qtb.13.1708708169259; Fri, 23 Feb 2024 09:09:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708708169; cv=pass; d=google.com; s=arc-20160816; b=tLbjivMtXdELupIh4uUDPQ0ypLEHTzZgCG61zbBFP1Z26T9xKHsr2XZ7u4l0BRLgp6 xn+6UmECVJZN9DelVEo4RHDqLtb+Zv3BZrsSfjIiBb8A3qzqnIx/tV3aUE5W3YhaW6ul 4QHj0NBz1OZQjzcZgUcAyAN2vBasAqfU9TR89X5Ga8UDH3Ts55xYmTyIOQ9hIN/43pvP caaql3MI0MQoA+aCDIwRshRx58OKaakGHOyN/2XALd0P8S4/SV9rC0EMBRB9zwxYK9Qw JFRh++TJBneG3zB36DDZD7+VkBCh2RfgTf+eZH35V9LvDiPNXXF8bQuLVsuarto0Vuyq s8zw== 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=o2q9HywUExNqrEjKbid0Z82Vo4n2Y7c4InWCzKhBRaY=; fh=iklzwOpoW46Q8uIjUdllYpVL9ypPiHdrvfOwLf3ltuY=; b=GbIjNEVw8gwXKKeAqd499lKK8NDsJSESvATWFhC8nrSXnC2oNTaLeFPVlGWywoVnCs ROiPrImekzZ39dlZB/DV2Nfzre36w9X/afdPggHV6GXL1YStw91xByz1hAlfVHKI3j5W iSz+eDRKu4PDaeCcrkrqvNNwU0EHJgFKGJSv9TDSyhu4P4AL3X/eISULTTlXo1QgPaVV WN/OpmYRdFVMlZLzXBLQj0MtbzU9IAShy+wp7BBsSyfzjhKLXxUla0oCSkPwGGR3HCEH et8hvJI5vJkdxbci0LVNhg9vE+fyv8HaAX0tgNkvJHI+rielPEI9hoxiU4bRgvFeFIqL uwCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="rPl9X1g/"; 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 y19-20020a05622a121300b0042da6c0be7esi16849215qtx.196.2024.02.23.09.09.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:09:29 -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="rPl9X1g/"; 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 A09E7385828A for ; Fri, 23 Feb 2024 17:09:28 +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 D22123858407 for ; Fri, 23 Feb 2024 17:08:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D22123858407 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 D22123858407 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=1708708101; cv=none; b=WUX/MBC+7Z+lYb6atkFxdrHDWRckZqInbuzSOfOE8tLsI3RQxYNRNgUTDQi9Yzg9hKHqy97JtiTWkJtdt2r4q//xoLPdzquyde845ZMRRTgExLzrELNAePKs5UigiDLEfoptX2wmKNEcL+04IaDZEtsU5DWgUE/FM+UYPuG0r3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708101; c=relaxed/simple; bh=dWegxbZMNk3TOUBIgL+XEE0mKlP01k3F7NU/ABRem/Q=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=lgEch6Wf/ivTNUuPy5MefgCxRmzWl/rQ4/9i00OxaKpDJTfwvwsfYRcTeN8qj38aXwO1uiZend2yE2ijjipS7uuzEayiQhXTc/5ClAk7o1wkcFzaJDOLG17KRC5sa/YftVluVtKiCDPhgGzddsV8HPFeOneP3YMEAQv43vmhr/k= 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.17.1.19/8.17.1.19) with ESMTP id 41NGvSBf012064; 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=o2q9HywUExNqrEjKbid0Z82Vo4n2Y7c4InWCzKhBRaY=; b=rPl9X1g/3TnY2x19sJcsLEvv+RiJ9XiOVg4nlk5ywIHKOsGOy2xO4a5IgJeYOAMihJIZ 1GSk6zHjBRwOYndZPUGLje5838ERpGLwjrHn8S50MdyBrSZFBa+gBQA9upnSYHFSzuIB u+aiDuZjNEVcUXChlAXidxBHuapskrYtlqItsKdL7MiPjuEqTcalYMgqiIvG5W3/QYLu 0pSQyzL0AgTaSvtaE3T2UFvd0rV358z9sDYutAy0k0V0xrQHTPpBoxBYXClrbJ8UYRtG TJTkz1C+xgELp/8MPkD+r8OTx6ciexUaOQ8Kb+cIDMytIEzfDQhsM4c99IIv3J62VTC/ JQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3weyb60aws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:10 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41NGvkvf012732; Fri, 23 Feb 2024 17:08:10 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3weyb60aw3-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 (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41NGxLLn009507; Fri, 23 Feb 2024 17:08:08 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wb84pxs1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:08 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41NH822L39977528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Feb 2024 17:08:04 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B072B2004E; Fri, 23 Feb 2024 17:08:02 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CA362004D; Fri, 23 Feb 2024 17:08:02 +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:02 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Indu Bhagat Cc: Jens Remus , Andreas Krebbel , Jan Beulich , Jan Hubicka , Andreas Jaeger , "H.J. Lu" Subject: [PATCH v2 1/9] x86: Remove unused SFrame CFI RA register variable Date: Fri, 23 Feb 2024 18:07:52 +0100 Message-Id: <20240223170800.3993092-2-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: SbHBet0RIsGfYLJDJzP396ZiXnVvk4Wi X-Proofpoint-ORIG-GUID: yC3wY8w6esLIMPYZRTyy7wG5Ahzr9Y8Y 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 priorityscore=1501 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402230125 X-Spam-Status: No, score=-12.7 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: 1791710377294655273 X-GMAIL-MSGID: 1791710377294655273 gas/ * config/tc-i386.c: Remove unused SFrame CFI RA register variable. Reviewed-by: Andreas Krebbel Signed-off-by: Jens Remus --- gas/config/tc-i386.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index c56ca4a2b4b8..1a6fd52f229a 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -627,7 +627,6 @@ static int shared = 0; unsigned int x86_sframe_cfa_sp_reg; /* The other CFA base register for SFrame stack trace info. */ unsigned int x86_sframe_cfa_fp_reg; -unsigned int x86_sframe_cfa_ra_reg; #endif From patchwork Fri Feb 23 17:07:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 205523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp718778dyb; Fri, 23 Feb 2024 09:08:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWwbnpIVRhL+6n66/RSVGGLUlXPJLvZ5X56qm0CZOEiPZE5l26fy/ztYN6NZm1912Iw+KTiRvdCVq+iG621DhT1+L6XqA== X-Google-Smtp-Source: AGHT+IEJW71sVWJXLaGNsDg4lW4SSejB41QUCLsgbGmbPH3kTvcF6zSPk7gArWFnXW/Hdx2koOPh X-Received: by 2002:a05:620a:444c:b0:787:ab73:7054 with SMTP id w12-20020a05620a444c00b00787ab737054mr492032qkp.53.1708708102827; Fri, 23 Feb 2024 09:08:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708708102; cv=pass; d=google.com; s=arc-20160816; b=YxXM3VFdf4/GU6kZh1k+f7LtukF61HdZMxWBaIi3uo3ZfoenNNRPQ1yQ+94tz+NXA2 tx9NbEqeaaEqKef/bgpujUlff8OC1QuxUnPQN/Wa4wuSskWjEEZHTnesu+51ifeIwj9v cJycCXqyocbMEGdcZ83BTTaZzhhGNhjLkgIaJMGVPBrHT/6a14yVUVCQ9QvEkOMfKAXx 2mFyCxtK3RALFBuPt0z6CvQYPQjwHrsr5yS5CXNj+Hiknzsas0MuY2RRRluj42AXez+0 EV/Nvhbrt53TvPX+Qw8L6OshuxCv8pN0p8aDiffvsnAh1qnOntut/rvCZIJMGTV1BeeD Zulg== 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=AzafolOOTGI80OAri5UAi8tYOnbCQqarpYBAnQYFpho=; fh=xzEBZrwKMP5oGYG1oABGV7dpV5/1pQwD40SCh/bfkgM=; b=FzrOa/1og3rOwUA7QWxvngaI6sPsctjAQE6+I8xUFAl2wMUIDJVEpnv4sAfF77z8gd m1bz9E6tLnMS5E6fYGHpSVBZM+l526hB0+1gYRskwB2h6lcx3ufKhZGSsWgzq1I43NDV mVh4KcGvRVJyKhQ2Sa5XJuiKLgT4jAY7fpmlWnFk+Up5dLeSCQvjo9UmQAIqLQ9K2U6U e2glpc3abByB/k7xzQQMktQYVzhk8MA0JdTe6SvjzpP+CfrHqDGt3qHl9HijddPNmGWN iBF7NAJeC9Y69gMWQy/cXsCFV0wF+jyTMQ5X4Kk4WXPnQr3PhgGKu7PSEZKoNpVlkcSr 82RQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=mQEkcND6; 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 bi1-20020a05620a318100b00787af54b088si2133595qkb.238.2024.02.23.09.08.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:08:22 -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=mQEkcND6; 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 6ACB6385829A for ; Fri, 23 Feb 2024 17:08:22 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id E92AD3858C62 for ; Fri, 23 Feb 2024 17:08:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E92AD3858C62 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 E92AD3858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708094; cv=none; b=idmqkLtTS0Gz+NjlZJ4TqkdoIDZbmY1i8UWTr1A1MfrONSSk47sF/34wUWq11pdw0+wS5CpyGW/lP6ukUaEF+sUOXJYvgGop7TXUNq9qL04jG7z0SWGlaUUL256bpGEvCnlt/LM5wJG8+OPASsLx8hpGF9asjrwLlX35gnjOu+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708094; c=relaxed/simple; bh=cypcZEil3iJ78dzfXmT+I1JFrihonK0qFRIqNJ0Kf4g=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=GdgBX/dW2gy6QS9v69aG0ZPWzcO7v4VuduZe4opgoef9g2upwZkA+Yjc43oMYkmyGSzk2RfvkEvsn1QrApeE362kUZUluzaFIzCrChtW+hcL1HHJaIZRlisgF1up5aIe0EpoA5vwQDxcnVh2KnK8aXflfARPFHJAIe8y5IeGKfk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41NGuRLv027765; Fri, 23 Feb 2024 17:08:09 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=AzafolOOTGI80OAri5UAi8tYOnbCQqarpYBAnQYFpho=; b=mQEkcND6ggVcji0pTeOfJlArzSrucvAezEJYi43Fdgoe2loBJ2BkESjEOguRP7cRTpIx rvmPjZIenogOWNa51tCFO0jYWegTu1twIKPmQUtVmx0VyTbnrln+eAi73ldMgwe2VxO2 4aiViFhkTeDL1QnJjUcuAuKy9TRb6LPIa5wiWI2fYTWhLAvzNvGAWAnxcbUw3g2Llh6R 0zh31gbPgcMrU1I8XUdLVDV8VALu6d6dVwsu6b6G3BtqmgS/l2PHRKLr4stwuCdbBvh5 oXsfMdCwSCEEsXq00K9lz+/oLNuE9RWU3v6mFKa64xoxW9edhe9diK2wZrCfzEfTK773 LQ== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wexyu0s3v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:09 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41NFhmJk031135; Fri, 23 Feb 2024 17:08:08 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wb9bmebs9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:08 +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 41NH83TR19464754 (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 EA84D2004D; Fri, 23 Feb 2024 17:08:02 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BA22F2004F; Fri, 23 Feb 2024 17:08:02 +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:02 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Indu Bhagat Cc: Jens Remus , Andreas Krebbel , Richard Earnshaw , Marcus Shawcroft Subject: [PATCH v2 2/9] aarch64: Align SFrame terminology in comments to specs and x86 Date: Fri, 23 Feb 2024 18:07:53 +0100 Message-Id: <20240223170800.3993092-3-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: 5BDlL3doCdRttFRrfBgW10lk8CX5TmZv X-Proofpoint-ORIG-GUID: 5BDlL3doCdRttFRrfBgW10lk8CX5TmZv 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 malwarescore=0 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 suspectscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402230124 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, 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: 1791710307756761561 X-GMAIL-MSGID: 1791710307756761561 Use the term "frame pointer" (FP) instead of "base pointer". This aligns with the terminology used in the SFrame specification. Additionally it helps not to confuse "base-pointer register" with the term "BASE_REG" used in the specification to denote either the SP or FP register. While at it align the frame-pointer and return address register comments to the x86 AMD64 ones. gas/ * config/tc-aarch64.h: Align SFrame terminology in comments to specs and x86 AMD64. Reviewed-by: Andreas Krebbel Signed-off-by: Jens Remus --- Notes (jremus): This patch can be dropped, if subsequent patch "sframe: Enhance comments for SFRAME_CFA_*_REG macros" gets accepted. gas/config/tc-aarch64.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h index 1b8badad9fdc..599d78db7908 100644 --- a/gas/config/tc-aarch64.h +++ b/gas/config/tc-aarch64.h @@ -271,11 +271,11 @@ extern bool aarch64_support_sframe_p (void); extern unsigned int aarch64_sframe_cfa_sp_reg; #define SFRAME_CFA_SP_REG aarch64_sframe_cfa_sp_reg -/* The base-pointer register number for CFA stack trace info. */ +/* The frame-pointer register number for SFrame stack trace info. */ extern unsigned int aarch64_sframe_cfa_fp_reg; #define SFRAME_CFA_FP_REG aarch64_sframe_cfa_fp_reg -/* The return address register number for CFA stack trace info. */ +/* The return address register number for SFrame stack trace info. */ extern unsigned int aarch64_sframe_cfa_ra_reg; #define SFRAME_CFA_RA_REG aarch64_sframe_cfa_ra_reg From patchwork Fri Feb 23 17:07:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 205527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp719413dyb; Fri, 23 Feb 2024 09:09:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXXecH7K0IamR0oHTzxnmLKGC/AybnzIgZpjX93c7aoEHr7VuZuJJAiqfVm1i83FNwPdSusKFGCT29TdtKyxDRaOaoKQQ== X-Google-Smtp-Source: AGHT+IGXSSYeU787gUMmkAVMaB9Mf3JPHQws8PTOwx3C7ShpM7F1TEiT7c7kspyB7pFx1pEus3aB X-Received: by 2002:a05:6808:2085:b0:3c1:6cdc:8d5a with SMTP id s5-20020a056808208500b003c16cdc8d5amr584317oiw.7.1708708146271; Fri, 23 Feb 2024 09:09:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708708146; cv=pass; d=google.com; s=arc-20160816; b=hKQUZoXbhAUmmkhGoPO+y4L1J/UR7VbSUH7yJLLl93oN4HDVk8ZK6sSKen9ULIrDDo ZSyq0iXP3EXA1p2utFz/E6YtZOQzVliD3AT/kR3Rh1/JKg25e3YTv+aaGJRqyrivuO0L J82Y7J1wxc9s0b1Q512JCe7Yh/HfpCycDdyOHXIQvS8ef/mh973O9JX24M3IbkDYheyz n6/bjDlx6ur0sPkZbGGi9V+L3M2hZpUnlF62C2fdHoB8/K5TYqvOHu0an1fg3JSdU6uZ 3Gbp3AEb7V4QvpP+CEIkvIP87gRd5xtegFCpfpUfBXlJFgjC6I2WGkEtTy+c7FEwkDhJ M+BA== 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=GypbcTQIy25CX5gPMRphgOG4e6hOvVz4ax1zNFV0ogE=; fh=lETL1m2ywGQah3zWJUkKUJG6qExUwxTjGOjnfKMxcDM=; b=Ayi/Q3gaI59Nlh3IumwjmDZGE4J6Z0GT+bhLmMbO+eqPBuvwSeQQdWWD66xPc7SwXD klEoJdrxgdn5FR8wfAbhi3muGGB3y5XPIr1xsgMQAEhKvKQA8rNF54UhLg+m0GeZAqjz D2Igj8waP4bAog5tCjL4yjhtnYPYGX09FL8kP0zS+2sb0URG6jsZQhmuPgIxEWKy+c5Y /5P2YRkYYZ9NCKwP52kn+eMY3cg1Ep+Br38FVqEaO1bwKWDJgJPsbaVI0FqU+RCnjIqN odebsKHhWyieZO5uEDDJy91DJse3MQYtFjNBsuHcO4yBToZSLRmd1yi6yUV2Jg5YThP9 zl+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Mw8gCS0X; 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 jx11-20020a0562142b0b00b0068f69aed8d0si11605715qvb.361.2024.02.23.09.09.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:09:06 -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=Mw8gCS0X; 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 C598238582BF for ; Fri, 23 Feb 2024 17:09:03 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id F04953858282 for ; Fri, 23 Feb 2024 17:08:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F04953858282 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 F04953858282 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708097; cv=none; b=U49ggOjA2jo7CUbGpwqn6TYtU5OaHN9tv9aTSh2jbV6ELW1dSDqALAZE17eVb3daTdbF9kRbnNFDPVaTLAQKeilRU3xRCoMtDreBHrCTCDdZWoyQKskw23idW2VYEuXOaN0gCyF8PFjJFOtDEUQ3o9J4gyKsDikd8l4BNGFvmtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708097; c=relaxed/simple; bh=viVN2lR23R35KjDRBZKfVgt2VyYqSAZ9Pz6sdCnjb/U=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=dr3MuS50X1uOCw85uumg7OZM6ddmoCRXBE35Z/qnGBeK1o0QvUaKru8QYKO33wADRfTpsz5c6Km/ZTH+++IDKY8nqnFIx9x2YDuCzT/ZrGL6ceg5ZRommfYad/2gHsWFof6a9GREo/g2H3If0CXYEGU8fIy/j1QlFwgs/ooDFgs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41NGfl2H023461; 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=GypbcTQIy25CX5gPMRphgOG4e6hOvVz4ax1zNFV0ogE=; b=Mw8gCS0Xnl93xcnv2D6kCurOWw/lasfwE4BwVzUOr2oCwGsY+wY8NUEunwqwwIREpeeJ kmi3yN1tNrNPWm7nUntqkW1LNG8kW45TBQDphsxkBHGz1odnI7iGg2mkY8NpVw+aRhyS 7xE+X46+wllJvqPA7PtWSuBj7BIlAr+WsUE4TbvyLkps9Nl6H8x0sL0Jfk5ft0LZlBSI Pab7QGtqOt3Z9PfFwA/KZY3h1/rf5w+lx4JDJ80jXJuKFsal/CjWA8Xpd0rxjQM3+o7e MH8U5vOef/YJDONnpmGrJ7ci3BkwbM2JNDBmWfJ40F/jPAIKxI01FzbxF26gRIrJkEev tw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wexwe96ar-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:10 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41NGgUOw025481; Fri, 23 Feb 2024 17:08:09 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wexwe969q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:09 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41NG7e50014416; Fri, 23 Feb 2024 17:08:08 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wb9u367kt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:08 +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 41NH836243188552 (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 42D102004F; 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 003B52005A; 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:02 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Indu Bhagat Cc: Jens Remus , Andreas Krebbel , Richard Earnshaw , Marcus Shawcroft , Jan Beulich , Jan Hubicka , Andreas Jaeger , "H.J. Lu" Subject: [PATCH v2 3/9] sframe: Enhance comments for SFRAME_CFA_*_REG macros Date: Fri, 23 Feb 2024 18:07:54 +0100 Message-Id: <20240223170800.3993092-4-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: tRVIjj6e3FGC1rdhB712duwA1i3m7_oI X-Proofpoint-ORIG-GUID: hINkiPcMHZcS6AlRD4Ot6-8kNqjeogc5 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_02,2024-02-23_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 adultscore=0 clxscore=1015 phishscore=0 bulkscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402230124 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: 1791710353492012801 X-GMAIL-MSGID: 1791710353492012801 Specify what the SFRAME_CFA_*_REG register numbers are used for: - SP (stack pointer): CFA tracking - FP (frame pointer): CFA and FP tracking - RA (return address): RA tracking gas/ * config/tc-aarch64.h: Enhance comments for SFRAME_CFA_*_REG macros. * config/tc-i386.h: Likewise. Reviewed-by: Andreas Krebbel Signed-off-by: Jens Remus --- gas/config/tc-aarch64.h | 6 +++--- gas/config/tc-i386.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h index 599d78db7908..59c9b5a09ec0 100644 --- a/gas/config/tc-aarch64.h +++ b/gas/config/tc-aarch64.h @@ -267,15 +267,15 @@ extern void aarch64_after_parse_args (void); extern bool aarch64_support_sframe_p (void); #define support_sframe_p aarch64_support_sframe_p -/* The stack-pointer register number for SFrame stack trace info. */ +/* The stack-pointer register number for CFA tracking. */ extern unsigned int aarch64_sframe_cfa_sp_reg; #define SFRAME_CFA_SP_REG aarch64_sframe_cfa_sp_reg -/* The frame-pointer register number for SFrame stack trace info. */ +/* The frame-pointer register number for CFA and FP tracking. */ extern unsigned int aarch64_sframe_cfa_fp_reg; #define SFRAME_CFA_FP_REG aarch64_sframe_cfa_fp_reg -/* The return address register number for SFrame stack trace info. */ +/* The return address register number for RA tracking. */ extern unsigned int aarch64_sframe_cfa_ra_reg; #define SFRAME_CFA_RA_REG aarch64_sframe_cfa_ra_reg diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index b93799a3b48c..0d6fb002166f 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -440,11 +440,11 @@ extern bool x86_scfi_callee_saved_p (uint32_t dw2reg_num); extern bool x86_support_sframe_p (void); #define support_sframe_p x86_support_sframe_p -/* The stack-pointer register number for SFrame stack trace info. */ +/* The stack-pointer register number for CFA tracking. */ extern unsigned int x86_sframe_cfa_sp_reg; #define SFRAME_CFA_SP_REG x86_sframe_cfa_sp_reg -/* The frame-pointer register number for SFrame stack trace info. */ +/* The frame-pointer register number for CFA and FP tracking. */ extern unsigned int x86_sframe_cfa_fp_reg; #define SFRAME_CFA_FP_REG x86_sframe_cfa_fp_reg From patchwork Fri Feb 23 17:07:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 205529 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp720181dyb; Fri, 23 Feb 2024 09:10:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUva3mg5PM22kxusDmMK3BIe16fCa6KUzajy9oixDeBvpBCZ+Hr7HdBmFyxGwzNpKAGDUHFeS4HyqHcwn36PSHOVBOFWg== X-Google-Smtp-Source: AGHT+IHoxwNFBJO82AWo3FHcO0wOBsFcKz7wd/KltPOoOL/qLKw4LmplIvpTQnBhPLNf7+DwsnoZ X-Received: by 2002:a25:f309:0:b0:dc6:bcb3:5d8e with SMTP id c9-20020a25f309000000b00dc6bcb35d8emr404567ybs.20.1708708204945; Fri, 23 Feb 2024 09:10:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708708204; cv=pass; d=google.com; s=arc-20160816; b=Vw/XAI42OoZ9i0Gl3YTH2gvvCODgGjTiW/+OHnsjK1PQg//PGzEaRTDYcDODE40VpX Va0Eey+XyyqjqUN5I8GJ6Cb63vTvC3VK473d2IEj4y7uHPBX8ikV7lr3sUvi7MENFcG/ +fe+OPqOyFiOcxrmHOEOpcHD6kEQZiFG8sYlBvbOebPVdbx6hjRPIJ51ZoqgInPfJBtc X5k7QpYxE0MSTunK6ZY73kgqCsHgUNpvACz5dy1k2VG7Xg8DsBlGmDdMMCKo4bgIgjyk hmN/WHrqDEKTbzLik38O+9rwD8riFu5s9kzzU4fkDfNZxrrVHhQDdhzaWnX32vYYErIW woLg== 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=Ad8xJAzqS1DPoYRKJ6LuMwtTTIxsdGFgYnVjfBJItFY=; fh=vTbGg4wY0rLaolKO+EtTu7rlJzNAP3iHbUH+MVoijcQ=; b=H4GR0j4YAcAVQWsOv7AlDsTA0KNQ0onZ1imQTEn/1gylyngl+1zlx+K9yYfWoE7QuK xCuNy5vxyq1fJMOO+ZUN6nuJoYk8LgdlT6a9Igg/KMilCH7GdaGoEYyBJ52Aw7eVVAv7 EoOBct/3R4fBVaDztbud4xsIWKy72sMlD4fEyk2uAs6nkwDNCn4rZz//kLhxaWs4yp0v w0VVGM5EIFoG6nk83bzmgMrXsa113S3jIzW1zkgSpiaIJ7wxU44El4kmUcXPkIdodghw V82SMvY/xFdRInoAdzQrrQKdx1rykubGATnmAIjuGl2Pfa/7ayqUtTz61wBR031GMFzz H60Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Yd5xJntc; 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 i15-20020ac84f4f000000b0042c3cf7282csi14765646qtw.537.2024.02.23.09.10.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:10:04 -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=Yd5xJntc; 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 830A138582A8 for ; Fri, 23 Feb 2024 17:09:57 +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 55D643858C66 for ; Fri, 23 Feb 2024 17:08:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 55D643858C66 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 55D643858C66 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=1708708095; cv=none; b=tZbln+wDVbhln53M/zAxrEs2w7n9k5YfP0sVv60mke5+Hz/3cyj+4layd7qIZDDhIwq8nuYJ5J6pVzkPVulHfOkAinP9FoMpEj2BdHkSrTLGfHh8091gaSB0caCAcddKjqRuEomzIHZ6gmqp45vncsDass7+Y5PtTrWtOPJx1Zs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708095; c=relaxed/simple; bh=glMSLSfLK8RNzTUsWI/VSdrueF7WjyT4C9QhmYh4Hv4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=OTfgTC4B9UihX9WR5z/3NeU/WspNfRA5UzGtYA5ATqcNHi1xnNybB4cAuWgUm991j5m2VVFCFHjb9CrETI4OeE1pJg6cGN5eb/+dH1zyN3ov6AxpKEb80oWt30v07fGfMc1FTaOSQ7K9HDsTeiPf7gutPHNKgtCxQ4pQ/qSgHnA= 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.17.1.19/8.17.1.19) with ESMTP id 41NGvUd0012186; Fri, 23 Feb 2024 17:08:10 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=Ad8xJAzqS1DPoYRKJ6LuMwtTTIxsdGFgYnVjfBJItFY=; b=Yd5xJntcWy/0gPcPT6ZLgIngnr0PD7vaIoj6kTC9xB89a2NjYe49W3y8qr5KXKzCuw2u PsZ++YhoHy4dB9N61gJ7TnP4CKmexIcH5orAW6vI3bZOfXj6tu8oYPVwF8RNtiUtcusq MtuXCAVKNBjbZH8PmwCZeqsy1e21XS0kPXVjYFV0in1hcP3u5UQLs4OMYF2PppXcouVe P9nX/O18G3yLDiWebIzxOYoPUy2od/yH7MjIuYzlxreohP9CSG98vNFu424hQuHT+ElG IkUjiBP5TcorMAzbbENyxR4toPTvPxxR9yVnXcgBG+88laMyZnNmAfVDhE6tx0icEULJ rg== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3weyb60awb-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 (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41NH47PK009547; Fri, 23 Feb 2024 17:08:09 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wb84pxs1p-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 41NH83fX27591354 (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 7861520065; 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 4C2F420063; 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 4/9] readelf/objdump: Dump SFrame CFA fixed FP and RA offsets Date: Fri, 23 Feb 2024 18:07:55 +0100 Message-Id: <20240223170800.3993092-5-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: KH2ZavOVZ4HUiQNsdbrYl5uckzLyZa-_ X-Proofpoint-ORIG-GUID: KH2ZavOVZ4HUiQNsdbrYl5uckzLyZa-_ 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 priorityscore=1501 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1015 mlxscore=0 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: 1791710414520586026 X-GMAIL-MSGID: 1791710414520586026 The SFrame format allows architectures to specify fixed offsets from the CFA, if any, from which the frame pointer (FP) and/or return address (RA) may be recovered. These offsets are stored in the SFrame header. For instance the SFrame generation in the assembler for x86 AMD64 specifies a fixed offset from the CFA, from which the return address (RA) may be recovered. When dumping the SFrame header, for instance in readelf/objdump with option --sframe, do also dump the specified fixed offsets from the CFA, if any, from which the frame pointer (FP) and return address (RA) may be recovered. Update the common SFrame test case verification patterns to allow for the optional dumping of the CFA fixed FP/RA offsets. Update the x86- specific SFrame and SCFI test case verification patterns to require a CFA fixed RA offset of -8. libsframe: * sframe-dump.c: Dump CFA fixed FP and RA offsets. gas/testsuite/ * gas/cfi-sframe/cfi-sframe-common-1.d: Test for optional fixed FP and RA offsets. * gas/cfi-sframe/cfi-sframe-common-2.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-3.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-4.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-5.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-6.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-7.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-8.d: Likewise. * gas/cfi-sframe/cfi-sframe-x86_64-1.d: Test for fixed RA offset. * gas/cfi-sframe/common-empty-1.d: Test for optional fixed FP and RA offsets. * gas/cfi-sframe/common-empty-2.d: Likewise. * gas/cfi-sframe/common-empty-3.d: Likewise. * gas/scfi/x86_64/scfi-cfi-sections-1.d: Test for SFrame fixed RA offset. * gas/scfi/x86_64/scfi-dyn-stack-1.d: Likewise. Reviewed-by: Andreas Krebbel Signed-off-by: Jens Remus --- gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d | 2 ++ gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d | 2 ++ gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d | 2 ++ gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d | 2 ++ gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d | 2 ++ gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d | 2 ++ gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d | 2 ++ gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d | 2 ++ gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d | 1 + gas/testsuite/gas/cfi-sframe/common-empty-1.d | 2 ++ gas/testsuite/gas/cfi-sframe/common-empty-2.d | 2 ++ gas/testsuite/gas/cfi-sframe/common-empty-3.d | 2 ++ gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d | 2 ++ gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d | 2 ++ libsframe/sframe-dump.c | 10 ++++++++++ 15 files changed, 37 insertions(+) diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d index 32577f31860e..5f4ae00747de 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d @@ -8,6 +8,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 1 Num FREs: 1 diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d index 3e3f74dbe424..ded8c450a942 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d @@ -8,6 +8,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 1 Num FREs: 1 diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d index 6430d463a891..d23fd9790f63 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d @@ -8,6 +8,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 1 Num FREs: 1 diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d index 319ff96cce2a..ca559bd0a029 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d @@ -8,6 +8,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 1 Num FREs: 3 diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d index 82d34973ddde..ee82053e13db 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d @@ -8,6 +8,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 1 Num FREs: 3 diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d index fe6917c70800..9d54b98552bf 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d @@ -8,6 +8,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 1 Num FREs: 3 diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d index 39724d9cdf19..2b7fe3aec8f4 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d @@ -8,6 +8,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 1 Num FREs: 3 diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d index c0a0e627fad9..d654e1d0bcd4 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d @@ -8,6 +8,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 1 Num FREs: 2 diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d index ae36c21b3b7c..c8b5e6adfea0 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d @@ -8,6 +8,7 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE + CFA fixed RA offset: \-8 Num FDEs: 1 Num FREs: 4 diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-1.d b/gas/testsuite/gas/cfi-sframe/common-empty-1.d index b133b15b051d..125612ff841f 100644 --- a/gas/testsuite/gas/cfi-sframe/common-empty-1.d +++ b/gas/testsuite/gas/cfi-sframe/common-empty-1.d @@ -9,6 +9,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 0 Num FREs: 0 diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-2.d b/gas/testsuite/gas/cfi-sframe/common-empty-2.d index c5bc8594f1b7..59328fc1033f 100644 --- a/gas/testsuite/gas/cfi-sframe/common-empty-2.d +++ b/gas/testsuite/gas/cfi-sframe/common-empty-2.d @@ -9,6 +9,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 0 Num FREs: 0 diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-3.d b/gas/testsuite/gas/cfi-sframe/common-empty-3.d index df0b19ee1bd1..5914c620760d 100644 --- a/gas/testsuite/gas/cfi-sframe/common-empty-3.d +++ b/gas/testsuite/gas/cfi-sframe/common-empty-3.d @@ -8,6 +8,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 0 Num FREs: 0 diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d index 5962980256c1..b0cf8f4f5212 100644 --- a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d @@ -8,6 +8,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 1 Num FREs: 5 diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d index b51546af1494..4a449957187b 100644 --- a/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d +++ b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d @@ -9,6 +9,8 @@ Contents of the SFrame section .sframe: Version: SFRAME_VERSION_2 Flags: NONE +#? CFA fixed FP offset: \-?\d+ +#? CFA fixed RA offset: \-?\d+ Num FDEs: 1 Num FREs: 4 diff --git a/libsframe/sframe-dump.c b/libsframe/sframe-dump.c index 42a086a5691f..493d052ce91f 100644 --- a/libsframe/sframe-dump.c +++ b/libsframe/sframe-dump.c @@ -47,6 +47,8 @@ dump_sframe_header (sframe_decoder_ctx *sfd_ctx) uint8_t flags; char *flags_str; const char *ver_str = NULL; + int8_t cfa_fixed_fp_offset; + int8_t cfa_fixed_ra_offset; const sframe_header *header = &(sfd_ctx->sfd_header); /* Prepare SFrame section version string. */ @@ -82,12 +84,20 @@ dump_sframe_header (sframe_decoder_ctx *sfd_ctx) else strcpy (flags_str, "NONE"); + /* CFA fixed FP and RA offsets. */ + cfa_fixed_fp_offset = header->sfh_cfa_fixed_fp_offset; + cfa_fixed_ra_offset = header->sfh_cfa_fixed_ra_offset; + const char* subsec_name = "Header"; printf ("\n"); printf (" %s :\n", subsec_name); printf ("\n"); printf (" Version: %s\n", ver_str); printf (" Flags: %s\n", flags_str); + if (cfa_fixed_fp_offset != SFRAME_CFA_FIXED_FP_INVALID) + printf (" CFA fixed FP offset: %d\n", cfa_fixed_fp_offset); + if (cfa_fixed_ra_offset != SFRAME_CFA_FIXED_RA_INVALID) + printf (" CFA fixed RA offset: %d\n", cfa_fixed_ra_offset); printf (" Num FDEs: %d\n", sframe_decoder_get_num_fidx (sfd_ctx)); printf (" Num FREs: %d\n", header->sfh_num_fres); 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 #... From patchwork Fri Feb 23 17:07:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 205524 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp718808dyb; Fri, 23 Feb 2024 09:08:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXX0QGRLDi8ycJSWY5ghv9OItDXTAyjJnLS3w+DDHgZ6mMPctf3XRs8uHk5xaEAOC74yDZuALPtggn4usuUDGedCppIRA== X-Google-Smtp-Source: AGHT+IHpo+eXOQcXtIaM6QdFYh7Nr7NWrfi6+F4c9JUbHdmoXV/mXo2sGUHwSm6lBwmqaHMjJrnW X-Received: by 2002:a05:620a:b12:b0:787:1c2f:b12e with SMTP id t18-20020a05620a0b1200b007871c2fb12emr386862qkg.50.1708708105167; Fri, 23 Feb 2024 09:08:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708708105; cv=pass; d=google.com; s=arc-20160816; b=Gi/0mKrSK4hrs+QAvIayYyrP5GKt9nAzHlMJUUu5Rxb8sJ/CZLY1hQ1RSOoH0zJnn5 oDrvJ+dUhT66wDGHoXWzFbejmK2LpWe+sUtLqycEvhu2pHGjlnMiJm65R0kHgBGcg4u7 idRXMHE86SO5xpQQAbjM58y1cHKx+isLYQ0MnN8/+3rE7od/ZRK7kZIXYjCcDAhQoZCl JjKS5TQusvmn1awJ+iGnV6kf/ed+4MU9eq0RQOxshpVvIYELr1zUPm78KZ+km4LgxHOM 6AfbtMFR4Y0Zn8/X89le9kLaiZ+CTW2H1WiUPU7Jr1CHu9Up2ej50t1rq+FqzZgLHMS2 d0vA== 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=qFr8JF3+fX9UpdSkT1btPRX0mDAbFLB3LEaGHefXqco=; fh=vTbGg4wY0rLaolKO+EtTu7rlJzNAP3iHbUH+MVoijcQ=; b=uh5qwM6dbSXi/8v6KI1aaH+uVVG8L9pmMSpI7Jesy7zwOQowX1k4y/YbLWUFXQr4hX XMuw202C1OYLANdk4zekWeCoyvV4iaHKpEhFPTQNl7Jksd23/rdHKh5RojJNM0VKdQAU ss0x7caH6uKaKDxwvkecSnFt2ORjgYYsfeGkEnZAIe0sfuvbB+ErVw8MzWWmO2vxqNQl Nc/TbBP/LDor0Ikqc1LEhcjfWfo5WDat2Q4TUzREovqW8XfEbnqRlwqeEib4cl1YOFFT +3Ne9rxSpcYMq9V+9X/q0j4Jmh8sJ7NKDIOTZnBPrfJ8IBzwVxyBEaZzGYAhLrnosnWv lAdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TPctXi3T; 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 bk28-20020a05620a1a1c00b00787a8cdf6dasi3106154qkb.66.2024.02.23.09.08.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:08:25 -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=TPctXi3T; 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 AF3E83858429 for ; Fri, 23 Feb 2024 17:08:24 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 037653858C50 for ; Fri, 23 Feb 2024 17:08:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 037653858C50 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 037653858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708095; cv=none; b=eRQ0XERNGmQxvduzGttTQ1t3+HraYZ6YK56IYpudjDbog9PLANS4XpEejxgvRYPQ7LiMGaY6WQcTEUV6WaIFPOiLfqdoly8QGD/oqjkTEG73Y0tYOmi/UhXLMtXV0cwX3H4zfuIsvumY78AHEMwlBtOupVOttEHCPa21zonb1WM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708095; c=relaxed/simple; bh=Cg33LcJSpUQtaANQu7Ko15+0gqIW2THxGap2LAEUUM8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ejaE0QBeIGkJRkq5CQ5UP79UOSGfsTSgaj5Vl/A8NQezs3aKVyE6PsvlBrh5IYgnds7pM89Ro8bheygh/T0EoI2Q/9ctr2NhSXm+yg2aeW2bjD4B10pYNKG/E5vUopkzN2tS6DSg+oCovIoC3+t4cSI6enDfDRwiXLyudbcMB9Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41NGuRLu027765; Fri, 23 Feb 2024 17:08:09 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=qFr8JF3+fX9UpdSkT1btPRX0mDAbFLB3LEaGHefXqco=; b=TPctXi3Th4iUZvakCUL7McrZdvz/1KxjPhzIs4kJO37ooaAZlLpUuFGeVMJN86Yb2C5i C+rH7y5uD2WVH/PWoFv5aUgzxePMe2YhrDSL/K7ge9589+Meo9qTlY0hEpnMmtduVpK3 7dpm7MG0yObJU+j5pbvfiL7JtU+2/qTVeO/3QUEIc5GO+47hbjlZ8TidWVWTZoXYaEqm WmnAxWu+iTawUflKMBfebE7WW/GijmrT8ATP6WOeww42/FhgDjjXMGaKKfnhCFtiReIs vGUeLIcPkxJx29kDupar+TTT+Kijwl6GhSxZPY8CoVPnhH+4FVpWgDnlG4/T3pUpzx0r Rw== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wexyu0s3f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:08 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41NH47PI009547; Fri, 23 Feb 2024 17:08:08 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wb84pxs1g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:07 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41NH84Om49545548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Feb 2024 17:08:06 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D83FF20043; 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 B1B6320069; 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 6/9] gas: Skip SFrame FDE if CFI specifies non-FP/SP base register Date: Fri, 23 Feb 2024 18:07:57 +0100 Message-Id: <20240223170800.3993092-7-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: I4f76OPZKKG0fWISczczcz1DThciOqeu X-Proofpoint-ORIG-GUID: I4f76OPZKKG0fWISczczcz1DThciOqeu 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 malwarescore=0 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 suspectscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402230124 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: 1791710309890641389 X-GMAIL-MSGID: 1791710309890641389 Do not generate SFrame FDE if DWARF CFI directives .cfi_def_cfa or .cfi_def_cfa_register specify a CFA 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. Update the generic ld SFrame test case to be architecture independent. Do not use CFI directive .cfi_def_cfa, as the specified CFA base register number is not a valid SP/FP register number on all architectures. An invalid SP/FP register number will now cause the assembler to print a warning message and skip SFrame FDE generation. Remove the offending CFI directive, that cannot be coded architecture- independent, as the test case requires SFrame information to be generated. This was reported by the Linaro-TCWG-CI for AArch64. gas/ * gen-sframe.c: Skip SFrame generation if CFI specifies non-FP/SP base register. ld/testsuite/ * ld-sframe/discard.s: Update generic SFrame test case to be architecture independent. Reviewed-by: Andreas Krebbel Signed-off-by: Jens Remus --- Notes (jremus): v1 -> v2: - Update generic SFrame test case to be architecture independent to resolve generic ld SFrame test case failure reported by Linaro-TCWG-CI for AArch64. It would fail similar on s390x. 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 +++++++++++-- ld/testsuite/ld-sframe/discard.s | 1 - 2 files changed, 11 insertions(+), 3 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; diff --git a/ld/testsuite/ld-sframe/discard.s b/ld/testsuite/ld-sframe/discard.s index a438b42bffa1..5591a50d486a 100644 --- a/ld/testsuite/ld-sframe/discard.s +++ b/ld/testsuite/ld-sframe/discard.s @@ -5,7 +5,6 @@ foo: .cfi_startproc .cfi_def_cfa_offset 16 - .cfi_def_cfa 7, 8 .cfi_endproc .globl _start From patchwork Fri Feb 23 17:07:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 205531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp720995dyb; Fri, 23 Feb 2024 09:11:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWRjcEPWMMJzRFcAVRq70+4YimKECDTtB/vs42LgAFSQJaPoDfKj5P5JNZLG3fyH74YZ27HmFCaA2iHBi3TSUdLZw0KRw== X-Google-Smtp-Source: AGHT+IHltmYG2nkoiSm1NfKJNriPEYuHttqcdmvYZqHFgS21Gg5Nzn7kPGrPqEtumewiU80PavSU X-Received: by 2002:ac8:7f0d:0:b0:42e:6787:c911 with SMTP id f13-20020ac87f0d000000b0042e6787c911mr368102qtk.51.1708708271703; Fri, 23 Feb 2024 09:11:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708708271; cv=pass; d=google.com; s=arc-20160816; b=eFcF1Z6NgPtt38ux4CQuMLOzngps6OkeKJUJil6tyFAcWW7hw86LLGx441s6zd9C2Y Ax47jlCOp8NZE2lzSXnMALpifQPzHKOypbdWguAXLvZ/0fKQIBaRA8zlIoqtL5TohhzZ ZiTOofHmyMr9ELBFee9zjkXJsZhrtirpWe9nMIwIUfsfYlLNqmbLZsIsE7+eOBIzkU90 jeT6Ns/nP65uitpwpHmqBw3QkzI1fT8OVaFfZGeS2NIHyJIHWxeOg/zxyaMuoAYRyJj7 AclR/zAJluX1z8ClCzDm6awjD/XGUUQcIRKg9xjWUKY/rM7x0dsffd1o997TNpcBkgh+ Dx4A== 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=xc0ac9H02FAYFCeJ/bKpc3sW7Bi4+/xiIRQP/uN96/Y=; fh=vTbGg4wY0rLaolKO+EtTu7rlJzNAP3iHbUH+MVoijcQ=; b=atUD4Hd4p9+7jf0YFY4SMdzoKItOmwuMVtGSjWTNXzjIM4vTy3+/1xles2UStkoiUb o84qPizdLOgVpQk1EsaPYKbvrkpklVjFWF1NXJZ12NqotXb5WmUH0PtlEbNaeidGfqbk qFvBAsuVHCiaEjFpvukNDHSubOtEB8MwRvCTDlTN06wSD4vAQjNUPygp3ufE6XpV/0Kl k7AHLgSzweKkAaKSeP/hNcjD+gmILBs6y84A73hS1U8wGLTwrvuxU4vs1SNLwrIkPdZY zIBU/Co3AlZlJXQIj3XU9nPqHj8KUK2gqih8UpNFCHZ1HCmiSD6zZQ+Zmj/AyzH0V4b9 2ptQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KDpWkJLE; 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 u12-20020a05622a010c00b0042e42a02531si5370900qtw.192.2024.02.23.09.11.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:11:11 -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=KDpWkJLE; 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 4FF5A3858282 for ; Fri, 23 Feb 2024 17:11:11 +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 7A7FD385841A for ; Fri, 23 Feb 2024 17:08:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7A7FD385841A 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 7A7FD385841A 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=QkiuZikOWijHdeUB+CQbEmeg2cMY1a6lrDpOAibes9yfhwwhbnj8gkBC3riT6hLV3S3elr/kXnk+GRYP602suMwIn7c9dshRd/ue41menF9APnMadK66PdhFdjVQecysvtUFySiZ/ZFsPN9/ftHWDEzUdx2l241NXtdkmJTJqSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708099; c=relaxed/simple; bh=8wXT1CTqqwfOVlzLDmsKJiYjkWRNBXZlnhJUrQQWVFg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=MzjeH5TgOJypyAEZbOnPOknpVvJeF+QZtYGK4S9iPXHVHWY3iMpqv/P0RHihGZ/uQeJGK/Hlhbaa8NGcfQT4M8cClqAV6a2P1oHwTGc32MTe6U33KT9/8jqvxkV+9MptQFmyCKuTi5RV0vx9CF1JFnIyncWhFb0awjtYI3r4sIk= 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.17.1.19/8.17.1.19) with ESMTP id 41NGvS9i012065; 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=xc0ac9H02FAYFCeJ/bKpc3sW7Bi4+/xiIRQP/uN96/Y=; b=KDpWkJLEKmLZ+7m7zLb4Y+Sd7oP56Wzso4IZm2pStPOEiHVIolbDXBKiLxolkR903N6d VZMQyDjSAu/DDxUCj2cdqd+bXPq2RZcUaqeyw8bWnhYKDWEDE+S5KN6Cd+fHaiB1jj+H KgoVGP43e/JsQMEzKqSPdp30ScHOZ00fNmnnVg9LiHqxMkye/5YdShlve1QwLH//x272 NCaYmJ+n9bXugGndQV9u32PSQz7/0rD84dpwZS3mN+r5qvJnybDKY7NefVor+BnBrYq0 JiWg39BCIv4rXtcpxzsJnkGYG5rjcBHR/xABwpXz7w6cf45qlTL/6we49z92kcuzdqmA Ww== 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 3weyb60awt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:11 +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 41NGaeeP013492; Fri, 23 Feb 2024 17:08:10 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wb7h0y0kr-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 smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41NH845b62849322 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Feb 2024 17:08:06 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 13F192005A; Fri, 23 Feb 2024 17:08:04 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E190C2006A; 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 7/9] gas: Warn if SFrame FDE is skipped due to non-default return column Date: Fri, 23 Feb 2024 18:07:58 +0100 Message-Id: <20240223170800.3993092-8-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: 6IAbCfbz3aCdkn0Hwca35uNXC2bzuzOe X-Proofpoint-ORIG-GUID: 6IAbCfbz3aCdkn0Hwca35uNXC2bzuzOe 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 priorityscore=1501 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1015 mlxscore=0 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: 1791710484929639496 X-GMAIL-MSGID: 1791710484929639496 Print a warning message if SFrame FDE is skipped due to a non-default DWARF return column (i.e. return address (RA) register number). This may be caused by the use of CFI directive .cfi_return_column with a non-default return address (RA) register number in the processed assembler source code. Warning: skipping SFrame FDE due to non-default DWARF return column gas/ * gen-sframe.c: Warn if SFrame FDE is skipped due to non-default DWARF return column. gas/testsuite/ * gas/cfi-sframe/common-empty-3.d: Update test case to expect for new warning message when SFrame FDE is skipped due to a non-default DWARF return column. 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 case 4, that gets introduced by patch "s390: Initial support to generate .sframe from CFI directives in assembler". gas/gen-sframe.c | 8 ++++++-- gas/testsuite/gas/cfi-sframe/common-empty-3.d | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c index 1269b2b77c54..28b49a2a8425 100644 --- a/gas/gen-sframe.c +++ b/gas/gen-sframe.c @@ -1345,7 +1345,10 @@ sframe_do_fde (struct sframe_xlate_ctx *xlate_ctx, /* If the return column is not RIP, SFrame format cannot represent it. */ if (xlate_ctx->dw_fde->return_column != DWARF2_DEFAULT_RETURN_COLUMN) - return SFRAME_XLATE_ERR_NOTREPRESENTED; + { + as_warn (_("skipping SFrame FDE due to non-default DWARF return column")); + return SFRAME_XLATE_ERR_NOTREPRESENTED; + } /* Iterate over the CFIs and create SFrame FREs. */ for (cfi_insn = dw_fde->data; cfi_insn; cfi_insn = cfi_insn->next) @@ -1355,7 +1358,8 @@ sframe_do_fde (struct sframe_xlate_ctx *xlate_ctx, if (err != SFRAME_XLATE_OK) { /* Skip generating SFrame stack trace info for the function if any - offending CFI is encountered by sframe_do_cfi_insn (). */ + offending CFI is encountered by sframe_do_cfi_insn (). Warning + message already printed by sframe_do_cfi_insn (). */ return err; /* Return the error code. */ } } diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-3.d b/gas/testsuite/gas/cfi-sframe/common-empty-3.d index 5914c620760d..d17521dd88ea 100644 --- a/gas/testsuite/gas/cfi-sframe/common-empty-3.d +++ b/gas/testsuite/gas/cfi-sframe/common-empty-3.d @@ -1,4 +1,5 @@ #as: --gsframe +#warning: skipping SFrame FDE due to non-default DWARF return column #objdump: --sframe=.sframe #name: SFrame supports only default return column #... From patchwork Fri Feb 23 17:07:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 205525 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp718923dyb; Fri, 23 Feb 2024 09:08:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXzLf0yP5UM+QLkQl9u5Q68nf4KoEHBIqOTuUMo4C3trUzUPlJe6FKDRKvDDV+BXetQFNJGFBdvgq2Fk6LDVhzOjFEp3A== X-Google-Smtp-Source: AGHT+IHGIiJtPm6ZAiaRESnPiQwxqviYCeW2emSexSdjs/WR7yEfT9c4ORl23WZLk/QzxdSK26ea X-Received: by 2002:a05:6214:418d:b0:68f:8927:ac6c with SMTP id ld13-20020a056214418d00b0068f8927ac6cmr570373qvb.20.1708708112354; Fri, 23 Feb 2024 09:08:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708708112; cv=pass; d=google.com; s=arc-20160816; b=gFmoScVYTFY9eHbaoSwPhcOrbaEo/EBbiwROr4lxn1xczNTEGA0h/8UmYtJO+FACIv jovceOqDfmfqAQ6gFu7ckl602s3EdCWTqzSvvkWmMnY+rhHsHPIx0X6KFc7QfXHenf2v ip3uH1HHbFEdKrkbyjK//3MraN1Z26z7FjZEdq2TW+q++iVfoRAAzMattYjaHI+lgWWS +AjOOoqd6kF3Gpshyz95GR3VyINLclm7NCV1A1BuCQAb+I7vryZY7NaHLKlf4vTics3W 7ucF6q1CWt1EO9AmNaRGEA1/QRHcO/P2iRuqNWvXb8wDH8LaiVP48Udc9RVsOeWQIPIo xjXQ== 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=pjLkNurtuZqK3UmzRB4cPL+fRNrhdZbHUtXdPgVxhbE=; fh=vTbGg4wY0rLaolKO+EtTu7rlJzNAP3iHbUH+MVoijcQ=; b=LiE16kggJ4uoA3A5TYBgGGZfker6WJzWKzbg2qvR6u0LoSC8E8ts+1tWt6p7Etj/oR gqSi6WhuyZjz1Lmwgk2OcofMV9OGntBHDGgXerQ7GEU+eJC2sS30mjB6eCal87A26QT3 +tSbzs3Flh1civwNrVNBMBkyj+eGnxWOrc65xKOhZsrQBP/yJ9t81gvEg6vLDrkCFJET A87c6pRTtD0iYzQCVUb+zah32QRi2CWkIqGwydZyR7WcYedo9P54ofaQzVXsAUiVOMw4 32RYuD8R/rd4RrUnyl+JkVRN/J6Hx7fP8cgy+HOdLZkysuLTWTxzff34O8bQO4S+ICnT Vlag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=hw6FPgEM; 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 q7-20020a056214194700b0068f8cc14838si9452142qvk.218.2024.02.23.09.08.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:08:32 -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=hw6FPgEM; 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 C51FF3858429 for ; Fri, 23 Feb 2024 17:08:31 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 63D1E3858C53 for ; Fri, 23 Feb 2024 17:08:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 63D1E3858C53 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 63D1E3858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708095; cv=none; b=ECIl3T05sRVjlo4qD4UGQj7z6afQ7ygc3kNUQNvOC0VjMRX+qmxPKrqDlsduIWUTQy2I7SP9Jse3Ghmeh80qDidlianZKp1wYKHcJ95PikLZlGwmXUqNWf+lsKZWK6Prt//+RDoPNryeLnbxwgSwZkVLdwZEbPJL0RClG9owb9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708095; c=relaxed/simple; bh=sw5Q0zk7GL31r+s4mEWOZTYgquU4J1c58tZJrJB6sy4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=crACPzd9y7wnL3qc/qyjPujOHWg4n3ObOIy3EEZR8cb5zz/WY5AanehBORL+If3CxYNHhAj6gag6Z656pHqiSr+jTxwiG+idylxr7BHTJ6csySH+O4J3NlRcz4i69XRcb7PZiu6EvoW6bspENugI+trV3DRyAYiwn7QqqUm/nao= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41NGk3qJ003947; 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=pjLkNurtuZqK3UmzRB4cPL+fRNrhdZbHUtXdPgVxhbE=; b=hw6FPgEME04lQGH2MqheMw8U2ZFJ/7LTstYNRuSph8c3qzJDnjdai/yfYYxJbq/ABWfc 8MZqxiIOVuPrQgVjFComRs9hhAkaNiaqYrS1cnNpGhiLylj/GygnV1pCd5h6cWIGf35B 6e3fm7YxRIpCKV0JGDevI+0eQXzL6G90rGJ7hvxcrEJwEMyH9yQpOT9GH4XkQzS0P0Dp 7w8lxWLe9j2bqLr+P1gS65sMq9h+spX7sjVuKynY/ikzfJwUqxwIioT5yohHlHG1r6Gj dwW5j9EXCWPmuTq1j7gPQ8eUg4hw6L45ryYEFvxHhZjdqgKYDiKzBGuVGnapk5xwoToB Ew== 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 3wexyu0s4h-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 (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 41NGEH53003615; Fri, 23 Feb 2024 17:08:09 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wb74u71x3-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 smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41NH84DL24838752 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Feb 2024 17:08:06 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 49ECB2006A; Fri, 23 Feb 2024 17:08:04 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DECD20069; Fri, 23 Feb 2024 17:08:04 +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:04 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Indu Bhagat Cc: Jens Remus , Andreas Krebbel Subject: [PATCH v2 8/9] gas: User readable warnings if SFrame FDE is not generated Date: Fri, 23 Feb 2024 18:07:59 +0100 Message-Id: <20240223170800.3993092-9-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: lNYOScEoeSf3n5mlTv9V5zfWyskkMcWC X-Proofpoint-ORIG-GUID: lNYOScEoeSf3n5mlTv9V5zfWyskkMcWC 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 malwarescore=0 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 suspectscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402230124 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: 1791710317650062502 X-GMAIL-MSGID: 1791710317650062502 The following generic warning message, which is printed whenever the assembler skips generation of SFrame FDE, is not very helpful for the user: skipping SFrame FDE due to DWARF CFI op (0x) Whenever possible print meaningful warning messages, when the assembler skips generation of SFrame FDE: - skipping SFrame FDE due to .cfi_def_cfa specifying CFA base register other than SP or FP ( instead of or ) - skipping SFrame FDE due to .cfi_def_cfa_register specifying CFA base register other than SP or FP ( instead of or ) - skipping SFrame FDE due to .cfi_def_cfa_offset without CFA base register in effect - skipping SFrame FDE due to .cfi_def_cfa_offset while CFA base register other than SP or FP in effect ( instead of or ) - skipping SFrame FDE due to .cfi_val_offset specifying {FP|RA} register () - skipping SFrame FDE due to .cfi_remember_state without SFrame FRE state - skipping SFrame FDE due to .cfi_register specifying {SP|FP|RA} register () - skipping SFrame FDE due to non-default DWARF return column ( instead of ) gas/ * gen-sframe.h (SFRAME_FRE_BASE_REG_INVAL): New macro for invalid SFrame FRE CFA base register value of -1. * gen-sframe.c: User readable warnings if SFrame FDE is not generated. Reviewed-by: Andreas Krebbel Signed-off-by: Jens Remus --- gas/gen-sframe.c | 96 ++++++++++++++----- gas/gen-sframe.h | 2 + gas/testsuite/gas/cfi-sframe/common-empty-1.d | 2 +- gas/testsuite/gas/cfi-sframe/common-empty-2.d | 2 +- gas/testsuite/gas/cfi-sframe/common-empty-3.d | 2 +- 5 files changed, 79 insertions(+), 25 deletions(-) diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c index 28b49a2a8425..339f4412ca05 100644 --- a/gas/gen-sframe.c +++ b/gas/gen-sframe.c @@ -867,7 +867,7 @@ sframe_row_entry_new (void) struct sframe_row_entry *fre = XCNEW (struct sframe_row_entry); /* Reset cfa_base_reg to -1. A value of 0 will imply some valid register for the supported arches. */ - fre->cfa_base_reg = -1; + fre->cfa_base_reg = SFRAME_FRE_BASE_REG_INVAL; fre->merge_candidate = true; /* Reset the mangled RA status bit to zero by default. We will initialize it in sframe_row_entry_initialize () with the sticky bit if set. */ @@ -922,6 +922,24 @@ sframe_row_entry_initialize (struct sframe_row_entry *cur_fre, cur_fre->mangled_ra_p = prev_fre->mangled_ra_p; } +/* Return SFrame register name for SP, FP, and RA, or NULL if other. */ + +static const char * +sframe_register_name (unsigned int reg) +{ + if (reg == SFRAME_CFA_SP_REG) + return "SP"; + else if (reg == SFRAME_CFA_FP_REG) + return "FP"; +#ifdef SFRAME_FRE_RA_TRACKING + else if (sframe_ra_tracking_p () + && (reg == SFRAME_CFA_RA_REG)) + return "RA"; +#endif + else + return NULL; +} + /* Translate DW_CFA_advance_loc into SFrame context. Return SFRAME_XLATE_OK if success. */ @@ -990,7 +1008,12 @@ sframe_xlate_do_def_cfa (struct sframe_xlate_ctx *xlate_ctx, 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. */ + { + as_warn (_("skipping SFrame FDE due to .cfi_def_cfa specifying CFA base " + "register other than SP or FP (%u instead of %u or %u)"), + cfi_insn->u.r, SFRAME_CFA_SP_REG, 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; @@ -1015,7 +1038,12 @@ sframe_xlate_do_def_cfa_register (struct sframe_xlate_ctx *xlate_ctx, 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. */ + { + as_warn (_("skipping SFrame FDE due to .cfi_def_cfa_register specifying " + "CFA base register other than SP or FP (%u instead of %u or %u)"), + cfi_insn->u.r, SFRAME_CFA_SP_REG, 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; @@ -1046,7 +1074,16 @@ sframe_xlate_do_def_cfa_offset (struct sframe_xlate_ctx *xlate_ctx, cur_fre->merge_candidate = false; } else - return SFRAME_XLATE_ERR_NOTREPRESENTED; + { + if (cur_fre->cfa_base_reg == SFRAME_FRE_BASE_REG_INVAL) + as_warn (_("skipping SFrame FDE due to .cfi_def_cfa_offset without CFA " + "base register in effect")); + else + as_warn (_("skipping SFrame FDE due to .cfi_def_cfa_offset while CFA " + "base register other than SP or FP in effect (%u instead of %u or %u)"), + cur_fre->cfa_base_reg, SFRAME_CFA_SP_REG, SFRAME_CFA_FP_REG); + return SFRAME_XLATE_ERR_NOTREPRESENTED; + } return SFRAME_XLATE_OK; } @@ -1097,11 +1134,19 @@ sframe_xlate_do_val_offset (struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED, instruction can be safely skipped without sacrificing the asynchronicity of stack trace information. */ if (cfi_insn->u.r == SFRAME_CFA_FP_REG) - return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */ + { + as_warn (_("skipping SFrame FDE due to .cfi_val_offset specifying FP register (%u)"), + SFRAME_CFA_FP_REG); + return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */ + } #ifdef SFRAME_FRE_RA_TRACKING else if (sframe_ra_tracking_p () && cfi_insn->u.r == SFRAME_CFA_RA_REG) - return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */ + { + as_warn (_("skipping SFrame FDE due to .cfi_val_offset specifying RA register (%u)"), + SFRAME_CFA_RA_REG); + return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */ + } #endif /* Safe to skip. */ @@ -1120,7 +1165,10 @@ sframe_xlate_do_remember_state (struct sframe_xlate_ctx *xlate_ctx) early with non-zero error code, this will cause no SFrame stack trace info for the function involved. */ if (!last_fre) - return SFRAME_XLATE_ERR_INVAL; + { + as_warn (_("skipping SFrame FDE due to .cfi_remember_state without SFrame FRE state")); + return SFRAME_XLATE_ERR_INVAL; + } if (!xlate_ctx->remember_fre) xlate_ctx->remember_fre = sframe_row_entry_new (); @@ -1307,7 +1355,12 @@ sframe_do_cfi_insn (struct sframe_xlate_ctx *xlate_ctx, || cfi_insn->u.rr.reg1 == SFRAME_CFA_RA_REG #endif || cfi_insn->u.rr.reg1 == SFRAME_CFA_FP_REG) - err = SFRAME_XLATE_ERR_NOTREPRESENTED; + { + as_warn (_("skipping SFrame FDE due to .cfi_register specifying %s register (%u)"), + sframe_register_name (cfi_insn->u.rr.reg1), + cfi_insn->u.rr.reg1); + err = SFRAME_XLATE_ERR_NOTREPRESENTED; + } break; case DW_CFA_undefined: case DW_CFA_same_value: @@ -1315,21 +1368,19 @@ sframe_do_cfi_insn (struct sframe_xlate_ctx *xlate_ctx, default: /* Following skipped operations do, however, impact the asynchronicity: - CFI_escape. */ - err = SFRAME_XLATE_ERR_NOTREPRESENTED; - } - - /* An error here will cause no SFrame FDE later. Warn the user because this - will affect the overall coverage and hence, asynchronicity. */ - if (err) - { - 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); + { + 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); + err = SFRAME_XLATE_ERR_NOTREPRESENTED; + } } + /* Any error will cause no SFrame FDE later. The user has already been + warned. */ return err; } @@ -1346,7 +1397,8 @@ sframe_do_fde (struct sframe_xlate_ctx *xlate_ctx, /* If the return column is not RIP, SFrame format cannot represent it. */ if (xlate_ctx->dw_fde->return_column != DWARF2_DEFAULT_RETURN_COLUMN) { - as_warn (_("skipping SFrame FDE due to non-default DWARF return column")); + as_warn (_("skipping SFrame FDE due to non-default DWARF return column (%u instead of %u)"), + xlate_ctx->dw_fde->return_column, DWARF2_DEFAULT_RETURN_COLUMN); return SFRAME_XLATE_ERR_NOTREPRESENTED; } diff --git a/gas/gen-sframe.h b/gas/gen-sframe.h index fbe2fd5d9368..8ed46dbb087b 100644 --- a/gas/gen-sframe.h +++ b/gas/gen-sframe.h @@ -24,6 +24,8 @@ #define SFRAME_FRE_ELEM_LOC_REG 0 #define SFRAME_FRE_ELEM_LOC_STACK 1 +#define SFRAME_FRE_BASE_REG_INVAL ((unsigned int)-1) + /* SFrame Frame Row Entry (FRE). A frame row entry is a slice of the frame and can be valid for a set of diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-1.d b/gas/testsuite/gas/cfi-sframe/common-empty-1.d index d7756302b559..08731b069229 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 DW_CFA_remember_state \(0xa\) +#warning: skipping SFrame FDE due to \.cfi_remember_state without SFrame FRE state #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 20282c7854e8..e759cddfcc20 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 DW_CFA_def_cfa_offset \(0xe\) +#warning: skipping SFrame FDE due to \.cfi_def_cfa_offset without CFA base register in effect #objdump: --sframe=.sframe #name: SFrame supports only FP/SP based CFA #... diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-3.d b/gas/testsuite/gas/cfi-sframe/common-empty-3.d index d17521dd88ea..9a46b016a9ba 100644 --- a/gas/testsuite/gas/cfi-sframe/common-empty-3.d +++ b/gas/testsuite/gas/cfi-sframe/common-empty-3.d @@ -1,5 +1,5 @@ #as: --gsframe -#warning: skipping SFrame FDE due to non-default DWARF return column +#warning: skipping SFrame FDE due to non-default DWARF return column \(0 instead of \d+\) #objdump: --sframe=.sframe #name: SFrame supports only default return column #... From patchwork Fri Feb 23 17:08:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 205532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp721218dyb; Fri, 23 Feb 2024 09:11:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXRCBagt0hpWvkTHf3YYvP2HtFedCa+U1C5wd7twP05DFOsFQ+p7KHg1sXSGY0+dBG8m/kZQ39pP7dmWB1e8YkIi3I2VQ== X-Google-Smtp-Source: AGHT+IECLZxk2L0ye+oOEgzy/W//wfnblg8tEXhe5koI7zlDIYlDXcAczxGInvSWy1Kow0TeKFwl X-Received: by 2002:a0c:da92:0:b0:68f:db10:600b with SMTP id z18-20020a0cda92000000b0068fdb10600bmr449014qvj.24.1708708286164; Fri, 23 Feb 2024 09:11:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708708286; cv=pass; d=google.com; s=arc-20160816; b=OEOox2epxaywiyyF6sWxGIP4nM8KeaygzycUdiCmXn8igGh2zv9BPsnTIWK8aeDCJF lJyvbjkDdw3Hram0qd2fRVL/HXM/rxtdU818PyyXTsYf2Yy7IwWNJcW3uvBR0QYJcKnC vuDqQnD43oz25kh3sb3XWQhaxMpcfWN+UQOVT0eSuGmYDyXSGLY1ah3clOJ+TIIHQdYJ ujqUClwxU5aWcWtFomzh9tqVfKrCzKHmuFRmC2IElA0nD2x21GkJiyyzjabO41X3kIiB Ps7oatbkTDM4DHQQOq924alw+c/zC1i0ljrocx/N5m2yoAKgffxtzAEoIZ4tfyyHhFuP B3uA== 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:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-filter:dmarc-filter :delivered-to; bh=3177u7vYZkOj6itgz6YrRkpwCcrBf8Q3Ywv1TWTnbjY=; fh=vTbGg4wY0rLaolKO+EtTu7rlJzNAP3iHbUH+MVoijcQ=; b=QUxb6tKtOMFZ0gUpGuDR2QPC8zPuFF5tRd6aHy20zcWg03hnheJDOAaE/pXWkuAp/D qE5REfxKvuxpoWf2+1PlGidf0O2xH5RnXejegMaD+nEN07IV//o908whQpxc6OnxDEQ3 g3Y59AI6zWqP1PkX9GiRPJ+dJ0bP+/MBn8U2HVPjagwclgtF4+Ybf2rwau6OUA2YPYl7 eBAZHIzweGFzUXGT+1wCbQHUrmdhubLVDfTMgO2w3SXzSw0bsjCAWCYD8ToGmUxOVy6C BLCgAeCxoSEBjS0reXezf0lsLJfI2yN569DKpjVnn3K3S1ZY6JMpvr9/e1jtJY9iXKWv NlcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=g74si0eX; 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 iv10-20020ad45cea000000b0068f5ba650bdsi13534917qvb.238.2024.02.23.09.11.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:11: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=g74si0eX; 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 CA151385828F for ; Fri, 23 Feb 2024 17:11:25 +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 045083858283 for ; Fri, 23 Feb 2024 17:08:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 045083858283 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 045083858283 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=1708708102; cv=none; b=X15eMBMhTNrDxA4Vhosnhp0xJ8AmisXRbQUN+fdRAVTa0pdtEF2Qfi11hchJat1Igd36ZDMZambsc5jheozrg/BVYyy+fV9kvPQyYKGtybbw08unif4gK28DXKC6ogLJQUHKDQREmoPPrIrP2EYwi4qhLQuTMAuTOPMtZr7BKY0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708708102; c=relaxed/simple; bh=VLyyx7GXsrBlk1SfnMjS/MfLB7l+muVpqC3V1EDNm/A=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=SK5ABilSaNhzVmJqY8s695CFl0vAjOUhyFEx1FxDCBFUX1sIEzIV5nZUUqNU77jr9fRFN8JTz12uFC24KXAt4acnKCO/ud+Ra/K/Hkq+E+1avHG1YpxFWtMhecdkdrIjeaWIweHkeH4nH7ued2efX+rLFO8ZtIP/ERYlsI8+2Po= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41NGvKHj030059; Fri, 23 Feb 2024 17:08:13 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 : content-transfer-encoding : mime-version; s=pp1; bh=3177u7vYZkOj6itgz6YrRkpwCcrBf8Q3Ywv1TWTnbjY=; b=g74si0eXkeRKW1NOtj1MRoKBE0stKoI8zTKzbYzmSGxhhdrhRho3C7gySNVDs7zpPBV9 uAD52WP2xIEEpaAXtOdlGx274fMTjofHC7xSKoIZGmN2zXjrWlNwz/75mexZz7a2prf0 YWJcUsOSlNQpdaexK3qpDn2cNVo+W0ovK/zWlrmXmTc3acBYZXcl+aX3IU4/D13oGqQs Gh3rBEZr+FzC+nXaXp0N6JUAaAPDbbcFAw3MNV52Gk5eHmZp+SVBiexd59aJBZOrM8bK 9z75Az4Hfhcm6oq02qoU+U8231yoU9lbKv7jlBoZGTZDHVQ4Z3MzFSROBaLJVXlHWZi7 vQ== 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 3weyb58a4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:12 +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 41NGKqxJ013472; Fri, 23 Feb 2024 17:08:10 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wb7h0y0ku-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 17:08:10 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41NH84Dd65536292 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Feb 2024 17:08:06 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 899EB20071; Fri, 23 Feb 2024 17:08:04 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 53FF52006E; Fri, 23 Feb 2024 17:08:04 +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:04 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Indu Bhagat Cc: Jens Remus , Andreas Krebbel Subject: [RFC PATCH 9/9] s390: Initial support to generate .sframe from CFI directives in assembler Date: Fri, 23 Feb 2024 18:08:00 +0100 Message-Id: <20240223170800.3993092-10-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> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: F9zhisIwhaV_pNqOHPiVO7PlGcg5svVd X-Proofpoint-ORIG-GUID: F9zhisIwhaV_pNqOHPiVO7PlGcg5svVd X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 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 adultscore=0 mlxlogscore=999 clxscore=1015 bulkscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 spamscore=0 malwarescore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402230125 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_STOCKGEN, 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: 1791710499799783195 X-GMAIL-MSGID: 1791710499799783195 This introduces initial support to generate .sframe from CFI directives in assembler on s390x. Due to the following SFrame limitations it is incomplete and does not work for most real-world applications (i.e. generation of SFrame FDE is skipped): - SFrame FP/RA tracking assumes the register contents to be saved on the stack (i.e. .cfi_offset). It does not support FP/RA register contents being saved in other registers (i.e. .cfi_register). GCC on s390x can be observed to save the FP/RA register contents in other registers (e.g. floating-point registers). - SFrame assumes a static RA register number. While the s390x ELF ABI [1] specifies register 14 to contain the return address on entry, GCC can be observed to copy the return address to another register and may even use that to return. Additionally glibc on s390x has two functions (mcount and fentry) that specify register 0 to hold the return address. This would either require a change to glibc (if possible) or SFrame support to track the RA register number specified in CFI directive .cfi_return_column. - SFrame assumes a static FP register number. The s390x ELF ABI [1] does not specify any FP register number. GCC and clang on s390x usually use register 11 as frame pointer. GCC on s390x can also be observed to use register 14 (e.g. binutils and glibc builds). glibc on s390x contains code that uses register 12 for the frame pointer. This would require SFrame support to track the SP/FP register number specified in CFI directives .cfi_def_cfa and .cfi_def_cfa_register. - SFrame does not support CFI directive .cfi_val_offset. glibc on s390x has two functions (mcount and fentry), that make use of that CFI directive. This would either require a change in glibc (if possible) or SFrame to support CFI directive .cfi_val_offset. This s390x support is largely based on the AArch64 support from commit b52c4ee46657 ("gas: generate .sframe from CFI directives"). SFrame ABI/arch identifier SFRAME_ABI_S390_ENDIAN_BIG is introduced for s390 and added to the SFrame specification. According to the s390x ELF ABI [1] the following calling conventions are used on s390x architecture: - Register 15 is used as stack pointer (SP). The CFA is initially located at offset +160 from the SP. - Register 14 is used as return address (RA). - There is no dedicated frame pointer. GCC and LLVM currently use register 11 as frame pointer. The s390x ELF ABI [1] standard stack frame layout has the following conventions: - The return address (RA, r15) may be saved at offset -40 from the CFA. Unlike x86 AMD64 architecture it is not necessarily saved on the stack. Also compilers may use a non-standard stack frame layout, such as but not limited to GCC with option -mpacked-stack. Therefore SFrame RA tracking is used. - The potential frame pointer (FP, r11) may be saved at offset -72 from the CFA. It is not necessarily saved on the stack and compilers may use a non-standard stack frame layout (see above). Therefore SFrame FP tracking is used. Support for SFrame is only enabled for z/Architecture (s390x) with 64-bit architecture mode. It is disabled for 32-bit architecture mode and ESA/390 (s390). Add s390-specific SFrame test cases. As for the error test cases add ones that use a non-default frame pointer (FP) register number and ones that save the return address (RA) in a non-default RA register number. [1] ELF ABI s390x Supplement: https://github.com/IBM/s390x-abi/releases [2] ELF ABI s390 Supplement: https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_s390.html https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_s390.pdf include/ * sframe.h (SFRAME_ABI_S390_ENDIAN_BIG): Define SFrame ABI/arch identifier for s390x. Reference s390x architecture in comments. libsframe/ * doc/sframe-spec.texi: Document SFrame ABI/arch identifier for s390x and reference s390x architecture. gas/ * config/tc-s390.h: s390x support to generate .sframe from CFI directives in assembler. * config/tc-s390.c: Likewise. * gen-sframe.c: Reference s390x architecture in comments. gas/testsuite/ * gas/cfi-sframe/cfi-sframe.exp: Enable common SFrame test cases for s390x. Add s390-specific SFrame test cases. * gas/cfi-sframe/cfi-sframe-s390-1.s: New s390-specific SFrame test case. * gas/cfi-sframe/cfi-sframe-s390-1.d: Likewise. * gas/cfi-sframe/cfi-sframe-s390-2.s: Likewise. * gas/cfi-sframe/cfi-sframe-s390-2.d: Likewise. * gas/cfi-sframe/cfi-sframe-s390-err-1.s: New s390-specific SFrame error test case that uses a non-default register number for the frame pointer. * gas/cfi-sframe/cfi-sframe-s390-err-1.l: Likewise. * gas/cfi-sframe/cfi-sframe-s390-err-2.s: Likewise. * gas/cfi-sframe/cfi-sframe-s390-err-2.l: Likewise. * gas/cfi-sframe/cfi-sframe-s390-err-3.s: New s390-specific SFrame error test case that uses a non-default register number to save the return address. * gas/cfi-sframe/cfi-sframe-s390-err-3.l: Likewise. * gas/cfi-sframe/cfi-sframe-s390-err-4.s: New s390-specific SFrame error test case that used a non-default return column (return address) register number. * gas/cfi-sframe/cfi-sframe-s390-err-4.l: Likewise. Reviewed-by: Andreas Krebbel Signed-off-by: Jens Remus --- Notes (jremus): The SFrame support for s390x provided by this patch still has some open issues, which need to be addressed. Any ideas or assistance to overcome the SFrame limitations listed in the commit description are very welcome. Note that unlike the AArch64 and x68 AMD64 implementation this s390x implementation does statically initialize the architecture-dependent variables s390_sframe_cfa_{sp|fp|ra}_reg, which are referenced by the SFrame interface macros SFRAME_CFA_{SP|FP|RA}_REG. The other implementations do initialize them in md_begin. I verified that all occurrences of the macros SFRAME_CFA_{SP|FP|RA}_REG are in context of test/read and never write. Is there a reason to define the SFrame interface macros SFRAME_CFA_{SP|FP|RA}_REG to variables? For instance should the SFrame common code be able to modify these? Currently I do not see how it would work well, if the architecture-specific code would change these at run time. Similar for the predicate sframe_ra_tracking_p. Example #1: Warnings when compiling binutils with SFrame $ ../configure CC="gcc -B$HOME/temp/binutils-gcc/bin -Wa,--gsframe" \ CXX="g++ -B$HOME/temp/binutils-gcc/bin -Wa,--gsframe" \ --prefix=$HOME/temp/binutils-sframe $ make -j $(nprocs) 2>&1 | tee make.log $ grep --only-matching "Warning:.*" make.log | sort | uniq -c 1 Warning: skipping SFrame FDE due to .cfi_def_cfa specifying CFA base register other than SP or FP (14 instead of 15 or 11) 205 Warning: skipping SFrame FDE due to .cfi_register specifying FP register (11) 56 Warning: skipping SFrame FDE due to .cfi_register specifying SP register (15) Example #2: Warnings when compiling glibc with SFrame $ ../configure CC="gcc -B$HOME/temp/binutils-sframe/bin -Wa,--gsframe" \ CXX="g++ -B$HOME/temp/binutils-sframe/bin -Wa,--gsframe" \ --prefix=$HOME/temp/glibc-sframe $ make -j $(nprocs) 2>&1 | tee make.log $ grep --only-matching "Warning:.*" make.log | sort | uniq -c 2 Warning: skipping SFrame FDE due to .cfi_def_cfa_register specifying CFA base register other than SP or FP (12 instead of 15 or 11) 7 Warning: skipping SFrame FDE due to .cfi_def_cfa specifying CFA base register other than SP or FP (14 instead of 15 or 11) 225 Warning: skipping SFrame FDE due to .cfi_register specifying FP register (11) 187 Warning: skipping SFrame FDE due to .cfi_register specifying SP register (15) 2 Warning: skipping SFrame FDE due to DWARF CFI op CFI_escape (0x103) 2 Warning: skipping SFrame FDE due to non-default DWARF return column (0 instead of 14) .cfi_def_cfa 14, ... originates from GCC generated code, which uses register %r14 as frame pointer (FP). .cfi_def_cfa_register 12 originates from hand-written assembler code sysdeps/s390/s390-64/dl-trampoline.S, which uses register %r12 as frame pointer (FP). .cfi_return_column 0 and .cfi_escape both originate from hand-written assembler code sysdeps/s390/s390-64/s390x-mcount.S, which is compiled twice (with and without -DSHARED). - .cfi_escape 0x14, 0x15, 0x14: Is used to code ".cfi_val_offset r15, -160", which would require binutils 2.28+ (glibc currently supports a minimum binutils 2.25). This CFI directive states that the contents of register %r15 are CFA-160 (not to be confused with saved at CFA-160). - .cfi_return_column 0: The following comment explains why register %r0 contains the return address: "The _mcount implementation now has to call __mcount_internal with the address of .LP0 as first parameter and the return address as second parameter. &.LP0 was loaded to %r1 and the return address is in %r14. _mcount may not modify any register. Alternatively, at the start of each function __fentry__ is called using a single brasl 0,__fentry__ instruction. In this case %r0 points to the callee, and %r14 points to the caller. These values need to be passed to __mcount_internal using the same sequence as for _mcount, so the code below is shared between both functions. The only major difference is that __fentry__ cannot return through %r0, in which the return address is located, because br instruction is a no-op with this register. Therefore %r1, which is clobbered by the PLT anyway, is used." Excerpt of the relevant glibc source code: .globl C_SYMBOL_NAME(MCOUNT_SYMBOL) .type C_SYMBOL_NAME(MCOUNT_SYMBOL), @function cfi_startproc .align ALIGNARG(4) C_LABEL(MCOUNT_SYMBOL) cfi_return_column (glue(r, MCOUNT_CALLEE_REG)) /* Save the caller-clobbered registers. */ aghi %r15,-224 cfi_adjust_cfa_offset (224) /* binutils 2.28+: .cfi_val_offset r15, -160 */ .cfi_escape \ /* DW_CFA_val_offset */ 0x14, \ /* r15 */ 0x0f, \ /* scaled offset */ 0x14 stmg %r14,%r5,160(%r15) cfi_offset (r14, -224) cfi_offset (r0, -224+16) ... gas/config/tc-s390.c | 55 +++++++++++++++++++ gas/config/tc-s390.h | 31 +++++++++++ gas/gen-sframe.c | 2 +- .../gas/cfi-sframe/cfi-sframe-s390-1.d | 23 ++++++++ .../gas/cfi-sframe/cfi-sframe-s390-1.s | 37 +++++++++++++ .../gas/cfi-sframe/cfi-sframe-s390-2.d | 23 ++++++++ .../gas/cfi-sframe/cfi-sframe-s390-2.s | 37 +++++++++++++ .../gas/cfi-sframe/cfi-sframe-s390-err-1.d | 15 +++++ .../gas/cfi-sframe/cfi-sframe-s390-err-1.s | 37 +++++++++++++ .../gas/cfi-sframe/cfi-sframe-s390-err-2.d | 15 +++++ .../gas/cfi-sframe/cfi-sframe-s390-err-2.s | 37 +++++++++++++ .../gas/cfi-sframe/cfi-sframe-s390-err-3.d | 15 +++++ .../gas/cfi-sframe/cfi-sframe-s390-err-3.s | 6 ++ .../gas/cfi-sframe/cfi-sframe-s390-err-4.d | 15 +++++ .../gas/cfi-sframe/cfi-sframe-s390-err-4.s | 5 ++ gas/testsuite/gas/cfi-sframe/cfi-sframe.exp | 13 ++++- include/sframe.h | 7 ++- libsframe/doc/sframe-spec.texi | 8 ++- 18 files changed, 374 insertions(+), 7 deletions(-) create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-1.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-1.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-2.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-2.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-1.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-1.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-2.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-2.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-3.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-3.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-4.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-4.s diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 09a903aea2db..af0d705b63f7 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -24,6 +24,8 @@ #include "subsegs.h" #include "dwarf2dbg.h" #include "dw2gencfi.h" +#include "sframe.h" +#include "gen-sframe.h" #include "opcode/s390.h" #include "elf/s390.h" @@ -83,6 +85,17 @@ const char FLT_CHARS[] = "dD"; /* The dwarf2 data alignment, adjusted for 32 or 64 bit. */ int s390_cie_data_alignment; +/* Register numbers used for SFrame stack trace info. */ + +/* Stack-pointer DWARF register number according to s390x ELF ABI. */ +unsigned int s390_sframe_cfa_sp_reg = 15; + +/* Frame-pointer DWARF register number accoring to s390x GCC/LLVM convention. */ +unsigned int s390_sframe_cfa_fp_reg = 11; + +/* Return-address DWARF register number according to s390x ELF ABI. */ +unsigned int s390_sframe_cfa_ra_reg = DWARF2_DEFAULT_RETURN_COLUMN; + /* The target specific pseudo-ops which we support. */ /* Define the prototypes for the pseudo-ops */ @@ -2639,6 +2652,48 @@ tc_s390_regname_to_dw2regnum (char *regname) return regnum; } +/* Whether SFrame stack trace info is supported. */ + +bool +s390_support_sframe_p (void) +{ + /* At this time, SFrame is supported for s390x (64-bit) only. */ + return (s390_arch_size == 64); +} + +/* Specify if RA tracking is needed. */ + +bool +s390_sframe_ra_tracking_p (void) +{ + return true; +} + +/* Specify the fixed offset to recover RA from CFA. + (useful only when RA tracking is not needed). */ + +offsetT +s390_sframe_cfa_ra_offset (void) +{ + return (offsetT) SFRAME_CFA_FIXED_RA_INVALID; +} + +/* Get the abi/arch indentifier for SFrame. */ + +unsigned char +s390_sframe_get_abi_arch (void) +{ + unsigned char sframe_abi_arch = 0; + + if (s390_support_sframe_p ()) + { + gas_assert (target_big_endian); + sframe_abi_arch = SFRAME_ABI_S390_ENDIAN_BIG; + } + + return sframe_abi_arch; +} + void s390_elf_final_processing (void) { diff --git a/gas/config/tc-s390.h b/gas/config/tc-s390.h index cd353045a822..c8f172d8737b 100644 --- a/gas/config/tc-s390.h +++ b/gas/config/tc-s390.h @@ -98,3 +98,34 @@ extern int s390_cie_data_alignment; extern void s390_elf_final_processing (void); #define elf_tc_final_processing s390_elf_final_processing + +/* SFrame */ + +/* Whether SFrame stack trace info is supported. */ +extern bool s390_support_sframe_p (void); +#define support_sframe_p s390_support_sframe_p + +/* The stack-pointer register number for SFrame stack trace info. */ +extern unsigned int s390_sframe_cfa_sp_reg; +#define SFRAME_CFA_SP_REG s390_sframe_cfa_sp_reg + +/* The frame-pointer register number for SFrame stack trace info. */ +extern unsigned int s390_sframe_cfa_fp_reg; +#define SFRAME_CFA_FP_REG s390_sframe_cfa_fp_reg + +/* The return address register number for SFrame stack trace info. */ +extern unsigned int s390_sframe_cfa_ra_reg; +#define SFRAME_CFA_RA_REG s390_sframe_cfa_ra_reg + +/* Specify if RA tracking is needed. */ +extern bool s390_sframe_ra_tracking_p (void); +#define sframe_ra_tracking_p s390_sframe_ra_tracking_p + +/* Specify the fixed offset to recover RA from CFA. + (useful only when RA tracking is not needed). */ +extern offsetT s390_sframe_cfa_ra_offset (void); +#define sframe_cfa_ra_offset s390_sframe_cfa_ra_offset + +/* The abi/arch indentifier for SFrame. */ +unsigned char s390_sframe_get_abi_arch (void); +#define sframe_get_abi_arch s390_sframe_get_abi_arch diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c index 339f4412ca05..08849cdafa81 100644 --- a/gas/gen-sframe.c +++ b/gas/gen-sframe.c @@ -673,7 +673,7 @@ output_sframe_internal (void) #endif out_one (fixed_ra_offset); - /* None of the AMD64, or AARCH64 ABIs need the auxiliary header. + /* None of the AMD64, AARCH64, or S390 ABIs need the auxiliary header. When the need does arise to use this field, the appropriate backend must provide this information. */ out_one (0); /* Auxiliary SFrame header length. */ diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-1.d new file mode 100644 index 000000000000..211804a2309a --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-1.d @@ -0,0 +1,23 @@ +#objdump: --sframe=.sframe +#name: SFrame generation on s390 +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_2 + Flags: NONE + Num FDEs: 1 + Num FREs: 6 + + Function Index : + + func idx \[0\]: pc = 0x0, size = 40 bytes + STARTPC +CFA +FP +RA + + 0+0000 +sp\+160 +u +u + + 0+0006 +sp\+160 +c\-72 +c\-48 + + 0+000c +sp\+336 +c\-72 +c\-48 + + 0+0010 +fp\+336 +c\-72 +c\-48 + + 0+001c +sp\+160 +u +u + + 0+001e +fp\+336 +c\-72 +c\-48 + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-1.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-1.s new file mode 100644 index 000000000000..56d8425ae2b1 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-1.s @@ -0,0 +1,37 @@ + .cfi_sections .sframe + .cfi_startproc + stmg %r6,%r15,48(%r15) + .cfi_offset 6, -112 + .cfi_offset 7, -104 + .cfi_offset 8, -96 + .cfi_offset 9, -88 + .cfi_offset 10, -80 + .cfi_offset 11, -72 + .cfi_offset 12, -64 + .cfi_offset 13, -56 + .cfi_offset 14, -48 + .cfi_offset 15, -40 + lay %r15,-176(%r15) + .cfi_def_cfa_offset 336 + lgr %r11,%r15 + .cfi_def_cfa_register 11 + lay %r15,-128(%r15) +.Lreturn: + lmg %r6,%r15,224(%r11) + .cfi_remember_state + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_restore 11 + .cfi_restore 10 + .cfi_restore 9 + .cfi_restore 8 + .cfi_restore 7 + .cfi_restore 6 + .cfi_def_cfa 15, 160 + br %r14 + .cfi_restore_state + lay %r15,-128(%r15) + j .Lreturn + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-2.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-2.d new file mode 100644 index 000000000000..211804a2309a --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-2.d @@ -0,0 +1,23 @@ +#objdump: --sframe=.sframe +#name: SFrame generation on s390 +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_2 + Flags: NONE + Num FDEs: 1 + Num FREs: 6 + + Function Index : + + func idx \[0\]: pc = 0x0, size = 40 bytes + STARTPC +CFA +FP +RA + + 0+0000 +sp\+160 +u +u + + 0+0006 +sp\+160 +c\-72 +c\-48 + + 0+000c +sp\+336 +c\-72 +c\-48 + + 0+0010 +fp\+336 +c\-72 +c\-48 + + 0+001c +sp\+160 +u +u + + 0+001e +fp\+336 +c\-72 +c\-48 + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-2.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-2.s new file mode 100644 index 000000000000..4d58cdaf64a7 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-2.s @@ -0,0 +1,37 @@ + .cfi_sections .sframe + .cfi_startproc + stmg %r6,%r15,48(%r15) + .cfi_rel_offset 6, 48 + .cfi_rel_offset 7, 56 + .cfi_rel_offset 8, 64 + .cfi_rel_offset 9, 72 + .cfi_rel_offset 10, 80 + .cfi_rel_offset 11, 88 + .cfi_rel_offset 12, 96 + .cfi_rel_offset 13, 104 + .cfi_rel_offset 14, 112 + .cfi_rel_offset 15, 120 + lay %r15,-176(%r15) + .cfi_def_cfa_offset 336 + lgr %r11,%r15 + .cfi_def_cfa_register 11 + lay %r15,-128(%r15) +.Lreturn: + lmg %r6,%r15,224(%r11) + .cfi_remember_state + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_restore 11 + .cfi_restore 10 + .cfi_restore 9 + .cfi_restore 8 + .cfi_restore 7 + .cfi_restore 6 + .cfi_def_cfa 15, 160 + br %r14 + .cfi_restore_state + lay %r15,-128(%r15) + j .Lreturn + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-1.d new file mode 100644 index 000000000000..a2724802c04b --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-1.d @@ -0,0 +1,15 @@ +#name: SFrame generation on s390 +#as: --gsframe +#warning: skipping SFrame FDE due to .cfi_def_cfa_register specifying CFA base register other than SP or FP \(10 instead of 15 or 11\) +#objdump: --sframe=.sframe +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_2 + Flags: NONE + Num FDEs: 0 + Num FREs: 0 + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-1.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-1.s new file mode 100644 index 000000000000..85e36c39d2a3 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-1.s @@ -0,0 +1,37 @@ + .cfi_sections .sframe + .cfi_startproc + stmg %r6,%r15,48(%r15) + .cfi_offset 6, -112 + .cfi_offset 7, -104 + .cfi_offset 8, -96 + .cfi_offset 9, -88 + .cfi_offset 10, -80 + .cfi_offset 11, -72 + .cfi_offset 12, -64 + .cfi_offset 13, -56 + .cfi_offset 14, -48 + .cfi_offset 15, -40 + lay %r15,-176(%r15) + .cfi_def_cfa_offset 336 + lgr %r10,%r15 + .cfi_def_cfa_register 10 # non-default frame pointer register + lay %r15,-128(%r15) +.Lreturn: + lmg %r6,%r15,224(%r10) + .cfi_remember_state + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_restore 11 + .cfi_restore 10 + .cfi_restore 9 + .cfi_restore 8 + .cfi_restore 7 + .cfi_restore 6 + .cfi_def_cfa 15, 160 + br %r14 + .cfi_restore_state + lay %r15,-128(%r15) + j .Lreturn + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-2.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-2.d new file mode 100644 index 000000000000..914f01ad9ffe --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-2.d @@ -0,0 +1,15 @@ +#name: SFrame generation on s390 +#as: --gsframe +#warning: skipping SFrame FDE due to .cfi_def_cfa specifying CFA base register other than SP or FP \(10 instead of 15 or 11\) +#objdump: --sframe=.sframe +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_2 + Flags: NONE + Num FDEs: 0 + Num FREs: 0 + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-2.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-2.s new file mode 100644 index 000000000000..0bb274a9e991 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-2.s @@ -0,0 +1,37 @@ + .cfi_sections .sframe + .cfi_startproc + stmg %r6,%r15,48(%r15) + .cfi_offset 6, -112 + .cfi_offset 7, -104 + .cfi_offset 8, -96 + .cfi_offset 9, -88 + .cfi_offset 10, -80 + .cfi_offset 11, -72 + .cfi_offset 12, -64 + .cfi_offset 13, -56 + .cfi_offset 14, -48 + .cfi_offset 15, -40 + lay %r15,-176(%r15) + .cfi_def_cfa_offset 336 + lgr %r10,%r15 + .cfi_def_cfa 10, 336 # non-default frame pointer register + lay %r15,-128(%r15) +.Lreturn: + lmg %r6,%r15,224(%r10) + .cfi_remember_state + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_restore 11 + .cfi_restore 10 + .cfi_restore 9 + .cfi_restore 8 + .cfi_restore 7 + .cfi_restore 6 + .cfi_def_cfa 15, 160 + br %r14 + .cfi_restore_state + lay %r15,-128(%r15) + j .Lreturn + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-3.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-3.d new file mode 100644 index 000000000000..54a7252f81a3 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-3.d @@ -0,0 +1,15 @@ +#name: SFrame generation on s390 +#as: --gsframe +#warning: skipping SFrame FDE due to .cfi_register specifying RA register \(14\) +#objdump: --sframe=.sframe +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_2 + Flags: NONE + Num FDEs: 0 + Num FREs: 0 + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-3.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-3.s new file mode 100644 index 000000000000..f0a5bd577304 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-3.s @@ -0,0 +1,6 @@ + .cfi_sections .sframe + .cfi_startproc + lgr %r7,%r14 + .cfi_register 14, 7 # non-default return address register + br %r7 + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-4.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-4.d new file mode 100644 index 000000000000..71769e7cf077 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-4.d @@ -0,0 +1,15 @@ +#name: SFrame generation on s390 +#as: --gsframe +#warning: skipping SFrame FDE due to non-default DWARF return column \(7 instead of 14\) +#objdump: --sframe=.sframe +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_2 + Flags: NONE + Num FDEs: 0 + Num FREs: 0 + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-4.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-4.s new file mode 100644 index 000000000000..cfdea75e0b95 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-s390-err-4.s @@ -0,0 +1,5 @@ + .cfi_sections .sframe + .cfi_startproc + .cfi_return_column 7 # non-default return address register + br %r7 + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp index cfae28d39aaf..9411c0e6c9ce 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp @@ -64,7 +64,8 @@ proc gas_x86_64_check { } { } # common tests -if { ([istarget "x86_64-*-*"] || [istarget "aarch64*-*-*"]) \ +if { ([istarget "x86_64-*-*"] || [istarget "aarch64*-*-*"] || + [istarget "s390x-*-*"]) \ && [gas_sframe_check] } then { global ASFLAGS @@ -99,3 +100,13 @@ if { [istarget "aarch64*-*-*"] && [gas_sframe_check] } then { run_dump_test "cfi-sframe-aarch64-2" run_dump_test "cfi-sframe-aarch64-pac-ab-key-1" } + +# s390 specific tests +if { [istarget "s390x*-*-*"] && [gas_sframe_check] } then { + run_dump_test "cfi-sframe-s390-1" + run_dump_test "cfi-sframe-s390-2" + run_dump_test "cfi-sframe-s390-err-1" + run_dump_test "cfi-sframe-s390-err-2" + run_dump_test "cfi-sframe-s390-err-3" + run_dump_test "cfi-sframe-s390-err-4" +} diff --git a/include/sframe.h b/include/sframe.h index b3d0c2e937d3..90bc92a32f84 100644 --- a/include/sframe.h +++ b/include/sframe.h @@ -93,6 +93,7 @@ extern "C" #define SFRAME_ABI_AARCH64_ENDIAN_BIG 1 /* AARCH64 big endian. */ #define SFRAME_ABI_AARCH64_ENDIAN_LITTLE 2 /* AARCH64 little endian. */ #define SFRAME_ABI_AMD64_ENDIAN_LITTLE 3 /* AMD64 little endian. */ +#define SFRAME_ABI_S390_ENDIAN_BIG 4 /* S390 big endian. */ /* SFrame FRE types. */ #define SFRAME_FRE_TYPE_ADDR1 0 @@ -190,7 +191,7 @@ typedef struct sframe_func_desc_entry - 2-bits: Unused. ------------------------------------------------------------------------ | Unused | PAC auth A/B key (aarch64) | FDE type | FRE type | - | | Unused (amd64) | | | + | | Unused (amd64, s390) | | | ------------------------------------------------------------------------ 8 6 5 4 0 */ uint8_t sfde_func_info; @@ -248,7 +249,7 @@ typedef struct sframe_fre_info - 1 bit: Mangled RA state bit (aarch64 only). ---------------------------------------------------------------------------------- | Mangled-RA (aarch64) | Size of offsets | Number of offsets | base_reg | - | Unused (amd64) | | | | + | Unused (amd64, s390) | | | | ---------------------------------------------------------------------------------- 8 7 5 1 0 @@ -274,7 +275,7 @@ typedef struct sframe_fre_info /* SFrame Frame Row Entry definitions. - Used for both AMD64 and AARCH64. + Used for AMD64, AARCH64, and S390. An SFrame Frame Row Entry is a self-sufficient record which contains information on how to generate the stack trace for the specified range of diff --git a/libsframe/doc/sframe-spec.texi b/libsframe/doc/sframe-spec.texi index d0f99bd698eb..a81faf49f5c1 100644 --- a/libsframe/doc/sframe-spec.texi +++ b/libsframe/doc/sframe-spec.texi @@ -74,8 +74,8 @@ The SFrame stack trace information is provided in a loaded section, known as the @code{.sframe} section. When available, the @code{.sframe} section appears in a new segment of its own, PT_GNU_SFRAME. -The SFrame format is currently supported only for select ABIs, namely, AMD64 -and AAPCS64. +The SFrame format is currently supported only for select ABIs, namely, AMD64, +AAPCS64, and s390. A portion of the SFrame format follows an unaligned on-disk representation. Some data structures, however, (namely the SFrame header and the SFrame @@ -366,6 +366,10 @@ in the format. @item @code{SFRAME_ABI_AMD64_ENDIAN_LITTLE} @tab 3 @tab AMD64 little-endian +@tindex SFRAME_ABI_S390_ENDIAN_BIG +@item @code{SFRAME_ABI_S390_ENDIAN_BIG} +@tab 4 @tab s390 big-endian + @end multitable The presence of an explicit identification of ABI/arch in SFrame may allow