[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhV-H7hhh3Jes0jMrg82+KJCa7GQZW=F9bDtktFh=eazMDX9w@mail.gmail.com>
Date: Sat, 15 Jun 2024 17:33:02 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Xi Ruoyao <xry111@...111.site>
Cc: Jinyang He <hejinyang@...ngson.cn>, Nathan Chancellor <nathan@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, WANG Xuerui <kernel@...0n.name>,
Tiezhu Yang <yangtiezhu@...ngson.cn>, Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
Youling Tang <tangyouling@...inos.cn>, loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev, mengqinggang@...ngson.cn,
cailulu@...ngson.cn, wanglei@...ngson.cn, luweining@...ngson.cn,
Yujie Liu <yujie.liu@...el.com>, Heng Qi <hengqi@...ux.alibaba.com>,
Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH] loongarch: Only select HAVE_OBJTOOL and allow ORC
unwinder if the inline assembler supports R_LARCH_{32,64}_PCREL
On Sat, Jun 15, 2024 at 4:54 PM Xi Ruoyao <xry111@...111.site> wrote:
>
> On Sat, 2024-06-15 at 16:45 +0800, Huacai Chen wrote:
> > Hi, Ruoyao and Jinyang,
> >
> > On Fri, Jun 7, 2024 at 4:29 PM Xi Ruoyao <xry111@...111.site> wrote:
> > >
> > > On Fri, 2024-06-07 at 15:14 +0800, Jinyang He wrote:
> > > > > Note: on RISC-V and LoongArch, the stack slot for the previous frame
> > > > > pointer is stored at fp[-2] instead of fp[0]. See [Consider
> > > > > standardising which stack slot fp points
> > > > > to](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/18)
> > > > > for the RISC-V discussion.
> > > >
> > > > 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.
> > 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...
But this patch allows clang to build objtool, which seems broken, too.
>
> 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.
I don't like to disable objtool, unless there is no better solution.
And it seems there has already been some "large fix" in objtool's
history.
Huacai
>
>
> --
> Xi Ruoyao <xry111@...111.site>
> School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists