From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Huacai Chen <chenhuacai@kernel.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/5] LoongArch: Enable jump table with GCC for objtool
Date: Wed, 6 Nov 2024 13:03:34 +0800 [thread overview]
Message-ID: <62df4c24-68ed-fbfc-ed98-2df796697d89@loongson.cn> (raw)
In-Reply-To: <20241105141530.GE10375@noisy.programming.kicks-ass.net>
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
Thanks,
Tiezhu
next prev parent reply other threads:[~2024-11-06 5:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 12:39 [PATCH v2 0/5] Add jump table support for objtool on LoongArch Tiezhu Yang
2024-11-05 12:39 ` [PATCH v2 1/5] objtool: Handle various symbol types for rodata Tiezhu Yang
2024-11-05 12:39 ` [PATCH v2 2/5] objtool: Handle special cases of discard.reachable Tiezhu Yang
2024-11-05 12:39 ` [PATCH v2 3/5] objtool/LoongArch: Add support for switch table Tiezhu Yang
2024-11-05 12:39 ` [PATCH v2 4/5] objtool/LoongArch: Add support for goto table Tiezhu Yang
2024-11-05 12:39 ` [PATCH v2 5/5] LoongArch: Enable jump table with GCC for objtool Tiezhu Yang
2024-11-05 14:15 ` Peter Zijlstra
2024-11-06 5:03 ` Tiezhu Yang [this message]
2024-11-12 3:15 ` Xi Ruoyao
2024-11-12 12:26 ` Tiezhu Yang
2024-11-13 21:11 ` annotating jump tables (Re: [PATCH v2 5/5] LoongArch: Enable jump table with GCC for objtool) Josh Poimboeuf
2024-11-14 17:13 ` Nick Desaulniers
2024-11-14 18:13 ` Ard Biesheuvel
2024-11-28 0:56 ` Josh Poimboeuf
2024-11-05 12:47 ` [PATCH v2 0/5] Add jump table support for objtool on LoongArch Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=62df4c24-68ed-fbfc-ed98-2df796697d89@loongson.cn \
--to=yangtiezhu@loongson.cn \
--cc=chenhuacai@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®