[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9589c5b673f45f02e2b0fa9d9a96eff0f0df0920.camel@xry111.site>
Date: Tue, 12 Nov 2024 11:15:41 +0800
From: Xi Ruoyao <xry111@...111.site>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>, Peter Zijlstra
<peterz@...radead.org>
Cc: Huacai Chen <chenhuacai@...nel.org>, Josh Poimboeuf
<jpoimboe@...nel.org>, loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 5/5] LoongArch: Enable jump table with GCC for objtool
On Wed, 2024-11-06 at 13:03 +0800, Tiezhu Yang wrote:
> On 11/05/2024 10:15 PM, Peter Zijlstra wrote:
> > On Tue, Nov 05, 2024 at 08:39:06PM +0800, Tiezhu Yang wrote:
> > > For now, it is time to remove the compiler option -fno-jump-tables
> > > to enable jump table for objtool if the compiler is GCC and it has
> > > the compiler option -mannotate-tablejump, otherwise still keep the
> > > compiler option -fno-jump-tables to maintain compatibility with the
> > > older compilers.
>
> ...
>
> > >
> > > ifdef CONFIG_OBJTOOL
> > > +ifdef CONFIG_CC_IS_GCC
> > > +ifdef CONFIG_CC_HAS_ANNOTATE_TABLEJUMP
> > > +KBUILD_CFLAGS += $(call cc-option,-mannotate-tablejump)
> > > +else
> > > KBUILD_CFLAGS += -fno-jump-tables
> > > endif
> > > +endif
> > > +ifdef CONFIG_CC_IS_CLANG
> > > +KBUILD_CFLAGS += -fno-jump-tables
> > > +endif
> > > +endif
> >
> > This seems excessive. Why split between GCC and Clang, isn't
> > CC_HAS_ANNOTATE_JUMPTABLE sufficient?
>
> Thanks for your reply.
>
> In theory, it is sufficient to only check CC_HAS_ANNOTATE_JUMPTABLE
> to use -fno-jump-tables or not, and also this is my initial aim.
>
> In fact, when compling with Clang on LoongArch, if the compiler has
> the option -mannotate-tablejump and config CC_HAS_ANNOTATE_TABLEJUMP
> is set, there still exists some objtool warnings if remove the option
> -fno-jump-tables, this is because there are some special cases such
> as different rodata relocation type and rodata entry size generated
> by Clang, I am working in progress to address the corner issues, and
> the final code looks something like this:
>
> ifdef CONFIG_CC_HAS_ANNOTATE_TABLEJUMP
> KBUILD_CFLAGS += $(call cc-option,-mannotate-tablejump)
> else
> KBUILD_CFLAGS += -fno-jump-tables
> endif
Has -mannotate-tablejump been added to Clang? IMO it's better to add it
to Clang first, and add Clang & GCC support at once into objtool.
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists