Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1278245lqs; Sat, 15 Jun 2024 02:06:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzV85jVM8A5XQgAhc55HHJ+A4Aco4oUa9U3xCdSTiYOXktMNJtYjms2lEQX2Z/s/FbXXRMsWmM6bFSeIHjAk3MMPYgZ4H6O9baYN0ZNA== X-Google-Smtp-Source: AGHT+IHOixoUVtbDn+6NXVUd+tFhDj41TbyhT3sf22mPvgniga5zpute8TWcOHTC81ZpPM9H7ufY X-Received: by 2002:a81:8786:0:b0:630:fe1d:99cc with SMTP id 00721157ae682-63224fe83bdmr31967697b3.52.1718442360269; Sat, 15 Jun 2024 02:06:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718442360; cv=pass; d=google.com; s=arc-20160816; b=cZLDnqvngT0vcw6YUZ33qSLaHKJ3B/dg4v16hGQVKWSwRi+spt5LfJUA+VevU8VjQZ Ql0VqjuLEM/R6p+eTOGCEX3ApckqKFKxF+bD1hytz/+FyEPBC0pQlXS23RgAUHOvZDyA xQyGEzgaca+XrVuC9wiKHofOmv/1ERLeGoOZ2JRGI300vUIFKjBXo2brVJqMGb5y6CY2 dSsKuW9foDUWOdWCYHAcgZfSZDQ5lpy0bnJmPAG3myHJ7r3wNrY92ZGs4uO9GwTM8og6 do3/LPw6464n0MFfZdf63TgN1CTtoF1/ZZjGyJt69N0RgO1V3z139YioEUEnSGClpSlY MZng== 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=X62lIkLSd7AyUNsY1oht7WZ2nzud4ybbZ0rQlPBMg+A=; fh=/PKwUTvbGWG7u9N/B70BkEU9miDF6HaySCyRZtBVnrA=; b=M5jqwbl40GE3t3YwGNUjRlvh3w0ky+n1wJzaaZgYTh7VUPIy5cjsr4L6e3wNSiiKLZ F3YAThQSKdTsh4hdKMaJZGQcspW2eAfoJG9juHx6mOV70+Cg6yQ7ZZhByH9xJXSojHbf 8abVeiO6IGr+JD3wwo9sNq3pzkfXMzHIvz6yV4ngG3DWCHIHErX8ybCOktFURUHsfjmQ Ta+xDT7YU62luNV/HvWwk38dqDzfsFT6z5qBDiwHA+GNmtplKjk6Hxdj0zyRGoilh3aY +Pf8QSkGj0BeKezwEAIun37SN63chn3oKdduRVFw6m4MIMyeSbNGJjsTDgGswCIdaVVi /McA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=jkFdBCVR; 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-215803-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215803-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b2a5b884b2si54974496d6.564.2024.06.15.02.06.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 02:06:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215803-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=jkFdBCVR; 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-215803-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215803-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 00BC81C214CA for ; Sat, 15 Jun 2024 09:06:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 066C4210E9; Sat, 15 Jun 2024 09:05:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="jkFdBCVR" 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 B636618EB8 for ; Sat, 15 Jun 2024 09:05:52 +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=1718442354; cv=none; b=X5rbhJ7+Z4L+rQYwZY2ULMRPps+HHj5JMEgXyShnOUcLpmu1MRTbidg6YzDP53TjxtidRsafncq+GUmJ23DVFPeCfqJ6rpJy/rI+1YnczwMQ/WhfCXcOyv7160Bu88z5xV9c7yzfa5u3LpVkLuN7x9OcpgXfLfPMW0OEd2rsBB0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718442354; c=relaxed/simple; bh=+woalqluYddgV4dzazx+XMw4WWHzePo+9ZVQhAcUr6w=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=quHRe648Y6fgIW6OZzf60gOgD2e6Uu/kTBVFfUb3zovTcI8OrkXlxKlWh8B4kNl35XvjK1BSiqHs2ToQH+035E+9KUHHONC8KlCVp8JIJgh/rkJH2qJxzY3aGoB9LW8+uBEf0UFEG0stQ5rI59Djd4zVFYycnmy1MefkxU6DKis= 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=jkFdBCVR; 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=1718441627; bh=+woalqluYddgV4dzazx+XMw4WWHzePo+9ZVQhAcUr6w=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=jkFdBCVRTA1LqvIM9DQfjq79SO3h5QmqvIhHQj4gwhNWMZ5E2KWAOYcJoSG6nRFSD T45UqgB0bM9/8DD7jEtub7l3PwEP5Bh1n/n1jTf5Vg9L5VDAdtt9VUqbICmXsEGENU gLEuxcIQKMEq5bb/6UgM2mM72iQqPoYYRRXzBiic= Received: from [192.168.124.13] (unknown [113.200.174.91]) (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 D4DE367451; Sat, 15 Jun 2024 04:53:42 -0400 (EDT) Message-ID: 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: Huacai Chen Cc: Jinyang He , Nathan Chancellor , Peter Zijlstra , 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: Sat, 15 Jun 2024 16:53:39 +0800 In-Reply-To: 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> <329dac82e09dfc75e77ae93ebbeacdec1dc9ff7f.camel@xry111.site> 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 Sat, 2024-06-15 at 16:45 +0800, Huacai Chen wrote: > Hi, Ruoyao and Jinyang, >=20 > On Fri, Jun 7, 2024 at 4:29=E2=80=AFPM Xi Ruoyao wro= te: > >=20 > > 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 s= lot 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?) > >=20 > > Oops indeed.=C2=A0 Even with a very simple case: > >=20 > > int sum(int a, int b) { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return a + b; > > } > >=20 > > with -fno-omit-frame-pointer we get: > >=20 > > sum: > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 addi.d=C2=A0 $r3,$r3,-16 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 st.d=C2=A0=C2=A0=C2=A0 $r22,= $r3,8 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 addi.d=C2=A0 $r22,$r3,16 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ld.d=C2=A0=C2=A0=C2=A0 $r22,= $r3,8 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 add.w=C2=A0=C2=A0 $r4,$r4,$r= 5 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 addi.d=C2=A0 $r3,$r3,16 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 jr=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 $r1 > >=20 > > So for leaf functions (where we don't save $ra) $fp is saved at cfa-8. > >=20 > > > 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. > >=20 > > I agree it now. > What is the conclusion about the clang part now? And for the original > -mno-thin-add-sub problem, do you have some way to fix it in the root? > I think we needn't rush, there are some weeks before 6.10 released. To me for now we should just make OBJTOOL and ORC depend on BROKEN and backport to stable... Even if we can fix both the -mno-thin-add-sub problem and the frame pointer problem in these weeks, they'll be some nontrivial large change and improper to backport. Thus we have to admit objtool doesn't really work for old releases and mark it broken. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University