From patchwork Mon May 13 08:11:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sung-hun Kim X-Patchwork-Id: 89989 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 75E29386F45F for ; Mon, 13 May 2024 08:12:47 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by sourceware.org (Postfix) with ESMTPS id AFC3838449C0 for ; Mon, 13 May 2024 08:12:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AFC3838449C0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=samsung.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AFC3838449C0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715587925; cv=none; b=gZNWIqRBB6w6ncRMeExWoUlA7kXpxLvvKgLq2a5CgP9r/UUfUtiflndUHNvbWjqqTAGstoF4wqtRUPlSWHDb+CJnjwaMHlzHvMj3/YHTTMtnNo/jl/c3WxPQBFyPKE660FNEQXbphofZZ6tvfDWqJheHf2Zs6wmC3tj0JM68viM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715587925; c=relaxed/simple; bh=e1bqCfHbDals8+RBEk1pbVx+JSn4dkuXiNSPR2Vr7kE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=SK6blfg3RCK9oVGvOlSiO/pwiyAfGpQduTjPncKXKMZwT/N2BVR+gV8MhwkWdvq/spWBLLmwoQmjjZsu/t5akZBawH2dyfRqbHPrSX8Y6ORCgwYue4NqKPPxksDUhzbiFt2VJ77Z6thoED6pwj3wRwezsM6RJIWTnsJeI/vJFbc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20240513081157epoutp02e6e8eb7dd7535ee53eda066fd5ca9483~O-h8osLKY2830328303epoutp02N for ; Mon, 13 May 2024 08:11:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20240513081157epoutp02e6e8eb7dd7535ee53eda066fd5ca9483~O-h8osLKY2830328303epoutp02N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1715587917; bh=eRYLhdAuYba9tfnWThShoIU3yl/2ILdjFisrDh890Us=; h=From:To:Cc:Subject:Date:References:From; b=kvWc6Ifwww32hhJOL/bygON8gJnN0bj4cNkmIhOFvlWvzxBfHLkJ1ZfrYUMvK0rxb B8ST/A7ChfsJkwQ7zbyLKAODp7ODyGfmBmOhfxTZC63u67tZtIUjlDKLzBOp5VgnkP +1u0JITbJbz7zjLWWd+BGE+ee4QlpXIVc8WG0PLY= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20240513081157epcas1p15125578c42311c71235f4b6248913f6b~O-h8B5Q0G1566115661epcas1p10; Mon, 13 May 2024 08:11:57 +0000 (GMT) Received: from epsmgec1p1.samsung.com (unknown [182.195.36.136]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4VdBzJ13y2z4x9Q9; Mon, 13 May 2024 08:11:56 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmgec1p1.samsung.com (Symantec Messaging Gateway) with SMTP id A3.0F.08627.A4BC1466; Mon, 13 May 2024 17:11:54 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20240513081154epcas1p365a9507c6e31950c50569b9ffdd63f15~O-h5G-zr21327013270epcas1p3P; Mon, 13 May 2024 08:11:54 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240513081154epsmtrp1e2779248194c6a167501e05fa702bc0b~O-h5GWlEm0660806608epsmtrp1c; Mon, 13 May 2024 08:11:54 +0000 (GMT) X-AuditID: b6c32a33-d59fa700000021b3-c8-6641cb4a9b0c Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id C8.91.09238.94BC1466; Mon, 13 May 2024 17:11:53 +0900 (KST) Received: from localhost.localdomain (unknown [10.113.111.45]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240513081153epsmtip14b0b4e92538189caccfd2f0588d04896~O-h43YJhP0720507205epsmtip1p; Mon, 13 May 2024 08:11:53 +0000 (GMT) From: Sung-hun Kim To: binutils@sourceware.org Cc: sungguk.na@samsung.com, dongkyun.s@samsung.com, sw0312.kim@samsung.com, sfoon.kim@samsung.com Subject: [PATCH] RISC-V: gas: Change initial CFI operation from DW_CFA_def_cfa_register to DW_CFA_def_cfa Date: Mon, 13 May 2024 17:11:49 +0900 Message-Id: <20240513081149.32515-1-sfoon.kim@samsung.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJKsWRmVeSWpSXmKPExsWy7bCmga7Xacc0g6ZmMYuP0/YwWkxe/o7Z onHacnaLHfMOMlrMmPySzYHVo2/LKkaP7b/dApiism0yUhNTUosUUvOS81My89JtlbyD453j Tc0MDHUNLS3MlRTyEnNTbZVcfAJ03TJzgLYpKZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yV UgtScgpMC/SKE3OLS/PS9fJSS6wMDQyMTIEKE7Iz3s1xKGjhrdj0dAdTA+Nbri5GTg4JAROJ nk3f2LsYuTiEBHYwSixoeAblfGKUmHxwFxu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RYu+7y6wQCUmJOesWMHYxcgDZwhKHDxdD1Hxk lPi+uZkJpIZNQEti2/5LjCC2iIC0RNOMPhYQm1kgXWLltnPsILawQKbErlNTWUDmsAioSlz/ UAAS5hWwkjh+5yXUKnmJmZe+s0PEBSVOznwCNUZeonnrbOYJjHyzkKRmIUktYGRaxSiZWlCc m56bbFhgmJdarlecmFtcmpeul5yfu4kRHG5aGjsY783/p3eIkYmD8RCjBAezkgivQ6F9mhBv SmJlVWpRfnxRaU5q8SFGaQ4WJXFewxmzU4QE0hNLUrNTUwtSi2CyTBycUg1MRw9drlNksrDf 6Z5+ZfNEmd0JUsk807wapb4cljoauPCxb/+/xKrcR5dfXbjiwxx+tSkkvKTzcto0fdVinvY9 945x595uevLCNDds7t6X4gHVd2Rv5u17p7L/g+6bC5InRNgfmEduMXRXM9r37fq+fd73XcUu 8q9M0Hx14GLoG7GQtDO/+MVKtk8S2lHlcN3NacWbWo+yQDUj9c/NR0v+tTxeohbz9rug8rWV t7hCfn8R55zTbLor+nSq9ORHrffzk5UY3gUEeU67+35hZsDq5UXV2ikfzPtT510xrHywz++7 yym2awaBBR/4MyyfzV6cVLmqvPGqLo9ua9Ua+fKUmQcWzc8/ME21/cmMc+FuSizFGYmGWsxF xYkAz3NRVKYCAAA= X-CMS-MailID: 20240513081154epcas1p365a9507c6e31950c50569b9ffdd63f15 X-Msg-Generator: CA CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240513081154epcas1p365a9507c6e31950c50569b9ffdd63f15 References: X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org The DWARF specification (especially, DWARF4 and 5 [1,2]) states that DW_CFA_def_cfa_register cannot be used as the first CFI operation. It said DW_CFA_def_cfa_register as follows: ... This operation is valid only if the current CFA rule is defined to use a register and offset. So, DW_CFA_def_cfa_register can be used after that other definition operation such as DW_CFA_def_cfa is called. However, the current gas code emits DW_CFA_def_cfa_register as an initial CFI operation for RISCV. In the libgcc, the unwinding function does not care about it, so it can unwind the call stack. However, on the third party library such as libunwindstack in Android, it causes a fatal error. This patch changes the initial CFI operation to DW_CFA_def_cfa with offset 0. It works as same as the previous one, but it does not have any limitation so it satisfies the DWARF spec. This change resolves the compatibility issue while preserving the original behaviour. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31733 [1] DWARF4 specification, https://dwarfstd.org/doc/DWARF4.pdf [2] DWARF5 specification, https://dwarfstd.org/doc/DWARF5.pdf Signed-off-by: Sung-hun Kim Reviewed-By: Andrew Burgess --- gas/config/tc-riscv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 1757ff6e9e2..8d749581c1d 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -5209,7 +5209,7 @@ RISC-V options:\n\ void riscv_cfi_frame_initial_instructions (void) { - cfi_add_CFA_def_cfa_register (X_SP); + cfi_add_CFA_def_cfa (X_SP, 0); } int