From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id D41053858CDB for ; Fri, 12 Apr 2024 14:47:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D41053858CDB 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 D41053858CDB 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=1712933255; cv=none; b=jz9AO80jQ9MYkY1Ot4pBxklpbj1MMTkjVcR7l10K0FzMaSAID0tQWcyAi/M1jt6RYbR60l3daK2HtZQXRRUnnFB1oXE3aEvLzN9J414/VJ1pfaLPdu2H/+PVuHS5zV61S46nw+TY0HG/CIxSsysxu42wLkyl0PCWm0D2xZsYs0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712933255; c=relaxed/simple; bh=7aSXiX1Odf/ub2aGC+0MX3mD6ZbRo349XWFsKSKEg+k=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=rjzOlrHNKxsm3+nbodlfSzDHUfQD/Hi7/on+cojG8RgNJcnXgNCcIqhVbGPC5fi2lP8pi9cMhA0TDHzk0h7kbH8ndLLKPzBzzF3XQx+dW/TK8BPLZL9zMBurmRANEx+q9fpKQvxYyXcNTcP/f+tdDk1oQzn8oSzGLwo62TNTZeU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43CEfVWw004824; Fri, 12 Apr 2024 14:47:29 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=Uc8AbevMLxr6wKGNpBE6vBbSt3PX87BzqPFY36ySYBQ=; b=SctKtOw7qwVSEoF6Qc6ILZrHWAQkxQ/Pg3jJ4r2Ykb9jzUjHQMEvCF8HQYzA27DGSPB7 Z2K21J/IVF6u2hySQ68/qA1GOw9S3stzccZg6EseCoTIxbHxcbmvNZcpApgarVzE3Ah+ KiKsKrdMFMlmM0l1ejFOclZx91NgVUvFrjgSaV2dk4LiPwG3kV9zYRahqISDfyxluBfG GyA4IUTNJIByR50/+iTy7ukFCdOTNAtMCY/U1aCi69SxVctoIWEtdRlNySJS0DCq94td 2sU0KfCS2BP8cXe5Ap3XdywkbJ7WWUp0+d2ToCcCvn0UWISu1DFcBVZ0vWzqWge8leiV Ng== 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 3xf5kc866h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Apr 2024 14:47:29 +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 43CCCWX7021556; Fri, 12 Apr 2024 14:47:28 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3xbjxma43d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Apr 2024 14:47:28 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 43CElN1R50856268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Apr 2024 14:47:25 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 07F952005A; Fri, 12 Apr 2024 14:47:23 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9C9420063; Fri, 12 Apr 2024 14:47:22 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 12 Apr 2024 14:47:22 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Indu Bhagat Cc: Jens Remus , Andreas Krebbel Subject: [PATCH v3 04/15] readelf/objdump: Display SFrame fixed RA offset as 'f' in dump Date: Fri, 12 Apr 2024 16:47:07 +0200 Message-Id: <20240412144718.4191286-5-jremus@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240412144718.4191286-1-jremus@linux.ibm.com> References: <20240412144718.4191286-1-jremus@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ZMT0-0NRPniYFSmPGrKWfp32go_LLmY- X-Proofpoint-GUID: ZMT0-0NRPniYFSmPGrKWfp32go_LLmY- 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-04-12_11,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 bulkscore=0 spamscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404120107 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: For the SFrame FRE frame-pointer (FP) offset from CFA a 'u' is displayed if it is unavailable. For the SFrame FRE return-address (RA) offset from CFA a 'u' was displayed if the ABI uses a fixed RA offset from CFA. By chance a 'u' was also displayed if the RA offset is unavailable, as the string buffer was not initialized after formatting the FP offset. Note that it could not occur that the FP offset was erroneously displayed as RA offset, as the SFrame format cannot have a FRE with FP offset without RA offset. For the FRE RA offset display 'f' if the ABI uses a fixed RA offset from CFA. Display a 'u' if it is unavailable. libsframe/ * sframe-dump.c: Display SFrame fixed RA offset as 'f' in dump. gas/testsuite/ * gas/cfi-sframe/cfi-sframe-common-4.d: Test for RA displayed either as 'u' (if RA tracking) or as 'f' (fixed RA offset if no RA tracking). * 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 RA displayed as 'f' (fixed RA offset), as x86-64 does not use RA tracking. * gas/scfi/x86_64/scfi-cfi-sections-1.d: Likewise. * gas/scfi/x86_64/scfi-dyn-stack-1.d: Likewise. ld/testsuite/ * ld-x86-64/sframe-plt-1.d: Test for RA displayed as 'f' (fixed RA offset), as x86-64 does not use RA tracking. * ld-x86-64/sframe-simple-1.d: Likewise. Signed-off-by: Jens Remus --- Notes (jremus): Changes v2 -> v3: - New patch. If the change in display of fixed RA offset as 'f' is undesired the patch can be reduced to fixing the logic to display the FP offset. .../gas/cfi-sframe/cfi-sframe-common-4.d | 4 ++-- .../gas/cfi-sframe/cfi-sframe-common-5.d | 4 ++-- .../gas/cfi-sframe/cfi-sframe-common-6.d | 4 ++-- .../gas/cfi-sframe/cfi-sframe-common-7.d | 4 ++-- .../gas/cfi-sframe/cfi-sframe-common-8.d | 2 +- .../gas/cfi-sframe/cfi-sframe-x86_64-1.d | 8 ++++---- .../gas/scfi/x86_64/scfi-cfi-sections-1.d | 10 +++++----- gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d | 10 +++++----- ld/testsuite/ld-x86-64/sframe-plt-1.d | 8 ++++---- ld/testsuite/ld-x86-64/sframe-simple-1.d | 16 ++++++++-------- libsframe/sframe-dump.c | 8 +++++--- 11 files changed, 40 insertions(+), 38 deletions(-) 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 ca559bd0a029..8632613f532f 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d @@ -17,7 +17,7 @@ Contents of the SFrame section .sframe: func idx \[0\]: pc = 0x0, size = 12 bytes STARTPC + CFA + FP + RA + #... - 0+0004 +sp\+16 +u +u + - 0+0008 +sp\+32 +u +u + + 0+0004 +sp\+16 +u +[uf] + + 0+0008 +sp\+32 +u +[uf] + #pass 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 ee82053e13db..dd2c32d3d9fc 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d @@ -17,7 +17,7 @@ Contents of the SFrame section .sframe: func idx \[0\]: pc = 0x0, size = 12 bytes STARTPC + CFA + FP + RA + #... - 0+0004 +sp\+16 +u +u + - 0+0008 +sp\+24 +u +u + + 0+0004 +sp\+16 +u +[uf] + + 0+0008 +sp\+24 +u +[uf] + #pass 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 9d54b98552bf..34390c46a074 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d @@ -17,7 +17,7 @@ Contents of the SFrame section .sframe: func idx \[0\]: pc = 0x0, size = 12 bytes STARTPC + CFA + FP + RA + #... - 0+0004 +sp\+8 +u +u + - 0+0008 +sp\+8 +u +u + + 0+0004 +sp\+8 +u +[uf] + + 0+0008 +sp\+8 +u +[uf] + #pass 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 2b7fe3aec8f4..61efb9c4ed12 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d @@ -17,7 +17,7 @@ Contents of the SFrame section .sframe: func idx \[0\]: pc = 0x0, size = 12 bytes STARTPC + CFA + FP + RA + #... - 0+0004 +sp\+8 +u +u + - 0+0008 +sp\+8 +u +u + + 0+0004 +sp\+8 +u +[uf] + + 0+0008 +sp\+8 +u +[uf] + #pass 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 d654e1d0bcd4..d77645636b36 100644 --- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d @@ -17,6 +17,6 @@ Contents of the SFrame section .sframe: func idx \[0\]: pc = 0x0, size = 8 bytes STARTPC + CFA + FP + RA + #... - 0+0004 +sp\+16 +u +u + + 0+0004 +sp\+16 +u +[uf] + #pass 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 c8b5e6adfea0..88b4cc63dbaa 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 @@ -16,8 +16,8 @@ Contents of the SFrame section .sframe: func idx \[0\]: pc = 0x0, size = 25 bytes STARTPC +CFA +FP +RA + - 0+0000 +sp\+8 +u +u + - 0+0001 +sp\+16 +c\-16 +u + - 0+0004 +fp\+16 +c\-16 +u + - 0+0018 +sp\+8 +c\-16 +u + + 0+0000 +sp\+8 +u +f + + 0+0001 +sp\+16 +c\-16 +f + + 0+0004 +fp\+16 +c\-16 +f + + 0+0018 +sp\+8 +c\-16 +f + #pass 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 c45933b72edc..7c247e33a6e8 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 @@ -16,10 +16,10 @@ Contents of the SFrame section .sframe: func idx \[0\]: pc = 0x0, size = 12 bytes STARTPC + CFA + FP + RA + - 0+0000 +sp\+8 +u +u + - 0+0001 +sp\+16 +c\-16 +u + - 0+0004 +fp\+16 +c-16 +u + - 0+000a +sp\+16 +c\-16 +u + - 0+000b +sp\+8 +u +u + + 0+0000 +sp\+8 +u +f + + 0+0001 +sp\+16 +c\-16 +f + + 0+0004 +fp\+16 +c-16 +f + + 0+000a +sp\+16 +c\-16 +f + + 0+000b +sp\+8 +u +f + #pass 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 6cd0484d5793..c6a9b53f4e09 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 @@ -16,10 +16,10 @@ Contents of the SFrame section .sframe: Function Index : func idx \[0\]: pc = 0x0, size = 87 bytes - STARTPC + CFA + FP + RA - 0+0000 + sp\+8 + u + u - 0+0001 + sp\+16 + c-16 + u - 0+0004 + fp\+16 + c-16 + u - 0+0056 + sp\+8 + u + u + STARTPC + CFA + FP + RA + + 0+0000 + sp\+8 + u + f + + 0+0001 + sp\+16 + c-16 + f + + 0+0004 + fp\+16 + c-16 + f + + 0+0056 + sp\+8 + u + f + #pass diff --git a/ld/testsuite/ld-x86-64/sframe-plt-1.d b/ld/testsuite/ld-x86-64/sframe-plt-1.d index 9d123a73826d..617fb9950acc 100644 --- a/ld/testsuite/ld-x86-64/sframe-plt-1.d +++ b/ld/testsuite/ld-x86-64/sframe-plt-1.d @@ -19,12 +19,12 @@ Contents of the SFrame section .sframe: func idx \[0\]: pc = 0x1000, size = 16 bytes STARTPC +CFA +FP +RA + - 0+1000 +sp\+16 +u +u + - 0+1006 +sp\+24 +u +u + + 0+1000 +sp\+16 +u +f + + 0+1006 +sp\+24 +u +f + func idx \[1\]: pc = 0x1010, size = 16 bytes STARTPC\[m\] +CFA +FP +RA + - 0+0000 +sp\+8 +u +u + - 0+000b +sp\+16 +u +u + + 0+0000 +sp\+8 +u +f + + 0+000b +sp\+16 +u +f + #... diff --git a/ld/testsuite/ld-x86-64/sframe-simple-1.d b/ld/testsuite/ld-x86-64/sframe-simple-1.d index ce5f94386ac2..18c863938d39 100644 --- a/ld/testsuite/ld-x86-64/sframe-simple-1.d +++ b/ld/testsuite/ld-x86-64/sframe-simple-1.d @@ -23,14 +23,14 @@ Contents of the SFrame section .sframe: func idx \[2\]: pc = 0x1020, size = 53 bytes STARTPC +CFA +FP +RA + - 0+1020 +sp\+8 +u +u + - 0+1021 +sp\+16 +c-16 +u + - 0+1024 +fp\+16 +c-16 +u + - 0+1054 +sp\+8 +c-16 +u + + 0+1020 +sp\+8 +u +f + + 0+1021 +sp\+16 +c-16 +f + + 0+1024 +fp\+16 +c-16 +f + + 0+1054 +sp\+8 +c-16 +f + func idx \[3\]: pc = 0x1055, size = 37 bytes STARTPC +CFA +FP +RA + - 0+1055 +sp\+8 +u +u + - 0+1056 +sp\+16 +c-16 +u + - 0+1059 +fp\+16 +c-16 +u + - 0+1079 +sp\+8 +c-16 +u + + 0+1055 +sp\+8 +u +f + + 0+1056 +sp\+16 +c-16 +f + + 0+1059 +fp\+16 +c-16 +f + + 0+1079 +sp\+8 +c-16 +f + diff --git a/libsframe/sframe-dump.c b/libsframe/sframe-dump.c index 493d052ce91f..69633d53a33a 100644 --- a/libsframe/sframe-dump.c +++ b/libsframe/sframe-dump.c @@ -181,13 +181,15 @@ dump_sframe_func_with_fres (sframe_decoder_ctx *sfd_ctx, printf ("%-10s", temp); /* Dump RA info. - If an ABI does not track RA offset, e.g., AMD64, display a 'u', + If an ABI does not track RA offset, e.g., AMD64, display 'f', else display the offset d as 'c+-d'. */ - if (sframe_decoder_get_fixed_ra_offset(sfd_ctx) + if (sframe_decoder_get_fixed_ra_offset (sfd_ctx) != SFRAME_CFA_FIXED_RA_INVALID) - strcpy (temp, "u"); + strcpy (temp, "f"); else if (err[2] == 0) sprintf (temp, "c%+d", ra_offset); + else + strcpy (temp, "u"); /* Mark SFrame FRE's RA information with "[s]" if the RA is mangled with signature bits. */ -- 2.40.1