From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from xry111.site (xry111.site [89.208.246.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF7E315B0F3; Fri, 7 Jun 2024 08:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.208.246.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717748968; cv=none; b=vEaVO+Pj4ATWi7t6sfsl2raJOBvdnuC+VijTaS4zA6tXLjI3iQ5MNENZK18jasLlKh4Alc2kftwkIV3lwIHnrRc1bXo2VHk2Z5K8gI9L2WczAHmOWfZajlERIjdpa31pY6PSw119L6kJqj7GebY3Zn6ZIQF1sJtvr4yA+8x0DFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717748968; c=relaxed/simple; bh=aK10eVoy1pHPzRBaMWuJDogzvbBebhllculFYvTNhSk=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=QZac+go+Bn6CO7RF/BFQ5feXcNMuiqIrb61YD6cmSKmT5c0fsnQ9EIgzhD1OTfePqPZquvnIjkpOjzQ9to3pfRTIBpGU/WXELzZhvGnxBps/RMQ4hfwv0nbm0N8j2we0cwr2AXOH5tjyajqAcZPCaKqwfotsrrDF6IgiF68NQy4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site; spf=pass smtp.mailfrom=xry111.site; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b=MHI9wAYF; arc=none smtp.client-ip=89.208.246.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xry111.site Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="MHI9wAYF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1717748954; bh=aK10eVoy1pHPzRBaMWuJDogzvbBebhllculFYvTNhSk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=MHI9wAYFhtYurtAizVkehIHAmwceOkFYntOBS7R63hOUkb1teR2c/+603lWI4bevD RZDCTUB1xIGLwYx0xEqV7cLsfKATMUsDTzbYxeJf2S929RFhEZs1sysIK6CKsxwti8 jCyoVTysq/k2e41RpmIF0+lfXv0iohfCf9AEUX8s= Received: from [127.0.0.1] (unknown [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 359A76709A; Fri, 7 Jun 2024 04:29:11 -0400 (EDT) Message-ID: <329dac82e09dfc75e77ae93ebbeacdec1dc9ff7f.camel@xry111.site> Subject: Re: [PATCH] loongarch: Only select HAVE_OBJTOOL and allow ORC unwinder if the inline assembler supports R_LARCH_{32,64}_PCREL From: Xi Ruoyao To: Jinyang He , Nathan Chancellor , Peter Zijlstra Cc: Huacai Chen , WANG Xuerui , Tiezhu Yang , Nick Desaulniers , Bill Wendling , Justin Stitt , Youling Tang , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, mengqinggang@loongson.cn, cailulu@loongson.cn, wanglei@loongson.cn, luweining@loongson.cn, Yujie Liu , Heng Qi , Tejun Heo Date: Fri, 07 Jun 2024 16:29:09 +0800 In-Reply-To: <2bd6ae20-ec56-c1a2-c5dd-e8c978a376d3@loongson.cn> References: <20240604150741.30252-1-xry111@xry111.site> <20240605054328.GA279426@thelio-3990X> <20240605062548.GF279426@thelio-3990X> <444ec2031ef6ca016cbfa8dfedc51bddc8529ba7.camel@xry111.site> <82b7e6ea-c2cb-6364-ebe9-bff928028408@loongson.cn> <1c132209a612e2e8953f0b458fc01853120db9a9.camel@xry111.site> <2bf11cd2-8449-acda-f5ad-659c38cb018e@loongson.cn> <96a2e8a80c06772b64fcbdba42e1dae2d68a53a7.camel@xry111.site> <2bd6ae20-ec56-c1a2-c5dd-e8c978a376d3@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.2 Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2024-06-07 at 15:14 +0800, Jinyang He wrote: > > =C2=A0=C2=A0=C2=A0=C2=A0 Note: on RISC-V and LoongArch, the stack slot = for the previous frame > > =C2=A0=C2=A0=C2=A0=C2=A0 pointer is stored at fp[-2] instead of fp[0]. = See [Consider > > =C2=A0=C2=A0=C2=A0=C2=A0 standardising which stack slot fp points > > =C2=A0=C2=A0=C2=A0=C2=A0 to](https://github.com/riscv-non-isa/riscv-elf= -psabi-doc/issues/18) > > =C2=A0=C2=A0=C2=A0=C2=A0 for the RISC-V discussion. >=20 > In most cases the $fp is saved at cfa-16. But for va args, something > becomes different at LoongArch (I do not know the case of riscv), the > $fp isn't saved at cfa-16. (e.g. printk?) Oops indeed. Even with a very simple case: int sum(int a, int b) { return a + b; } with -fno-omit-frame-pointer we get: sum: addi.d $r3,$r3,-16 st.d $r22,$r3,8 addi.d $r22,$r3,16 ld.d $r22,$r3,8 add.w $r4,$r4,$r5 addi.d $r3,$r3,16 jr $r1 So for leaf functions (where we don't save $ra) $fp is saved at cfa-8. > I feel that the update_cfi_state should be arch specific. I believe > that some logic can be reused, but each arch may have its own logic. I agree it now. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University