Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp890134lqt; Fri, 7 Jun 2024 01:29:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXhYvo1I/AzgUnpY+bRWY9a85A3MqKwfqMmoyjf9pUPdKxUxsj2ltBEfZgxbXfW0lSgbB14UfQ+uBszOFumWJjEw2qblySm3e5u3smgpQ== X-Google-Smtp-Source: AGHT+IFx32GM+rDUfQ+sfVArkpoZf51l0Y4yQucCmGGqHWp0+ocErvTrMQJWQwnPgb56tRtIVdHa X-Received: by 2002:a17:906:70d0:b0:a6e:2a27:5669 with SMTP id a640c23a62f3a-a6e2a2766admr48182366b.23.1717748974924; Fri, 07 Jun 2024 01:29:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717748974; cv=pass; d=google.com; s=arc-20160816; b=ZalueN3NtsANxv7Qv2TFiPsU9w1a7OGO+3enSHIMn72VpC7nfdMIsGmzAbiE/hZ2/D V+tTOlQGEHp3GwJ8kZzItOXMvpP0OyJRYsMPPmThoJBS1yJODphIR8wmWs/FjQkawuou mKY+HvjdbHAP99X1P49h6VmwI5PLbRwLsu4zRIQWaN9makKnmgzk07+OvdYhu1H9QpfT 2mWZSCpeKHAUXNYH54NSlcWaTb9uMlteK6Cie8HSplNLSIwZQrtLWpf/lqBqzEm/V7Kl VbvuErpnpLmtpAiI8yDPRhwilm74pZy2NLdApS+AJO6grCBv7x9GI+FsgVG1LzTV4C+P 0PbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=ob8RWOVbA/w2aQ09lVEyhAIlE6/8u1/Bhmf91K0vONI=; fh=46mgic5tqO6GulhMLm6SoVRlTvteB16CHfX2DAAbXdA=; b=HsBto1pqqlQz5raDV0JOeS+qTtXLxtXXHIYg0gluBWjOrTwBSsra7Uzx6/cKUvQelt NY4gtyVz2OH5Jo0lYaes2xEZsFgqSDFvEyVDwCwZSVVuIgdUez7Nz9EJTn8hFYb8apyM BX57HjKzBOHdbtoIk90c6JHF7JxfL2ZZQAZh8F3engBiBWtOEKXwhmvhCh4XKsQL5woy 8tmRQEUW0lVvIpllFdWy8peLsOmr6L/j+lY7hqjjBbysgdiM91dES6a0/p1qNzs3BwlD my0YOFAraEKg9wJA7/DNCe8Ya6j3Hyc1V7dWtNJY99yCa1p9jWWQwkKmSuAWTYnbQxn5 jBOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=MHI9wAYF; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-205602-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205602-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c806dba14si154574466b.280.2024.06.07.01.29.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 01:29:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205602-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=MHI9wAYF; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-205602-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205602-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6E74A1F23882 for ; Fri, 7 Jun 2024 08:29:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79A6C15B104; Fri, 7 Jun 2024 08:29:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="MHI9wAYF" 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 DF82B15B0F6 for ; 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=1717748969; cv=none; b=A7npU6gAeqMWKNc+meOlB3bFOS9/WRo4oiOdxivggo+gRVGz7CMDHQ3B0IlPEzLFaW33mtkATFeLwqP+PGCH2tgMcp0P8c9ni5SL/ZAnjuaRU5QtcNaJRXlppybjYveIwEJcKd0y9UqkAZmqCY9gjJ2y6C/5S0ePMl6WNQl4RBI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717748969; c=relaxed/simple; bh=aK10eVoy1pHPzRBaMWuJDogzvbBebhllculFYvTNhSk=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=UXP0NDNDvcopAk1elfgB2yz82qkPhhIOk+jBTKd3DpsOErVtNZcbKAu+ycwxEUKT0By7ECQXtzhEq6CuXYH+FIk5oUq5JGscxk+F6wmyWLOgAJLh4YfLss6llf1ye7qGXW9ymjiZuetZTgN++CdWNcS5VXWi3bgIkwpqjpY+K9Y= 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 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: linux-kernel@vger.kernel.org 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