mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	llvm@lists.linux.dev
Subject: Re: [PATCH] compiler.h: Specify correct attribute for .rodata..c_jump_table
Date: Wed, 12 Feb 2025 18:39:36 -0800	[thread overview]
Message-ID: <20250213023936.lzbpgou4eallaij3@jpoimboe> (raw)
In-Reply-To: <b1e5e3ea-be4b-5dae-cc0d-34693429d060@loongson.cn>

On Thu, Feb 13, 2025 at 10:20:40AM +0800, Tiezhu Yang wrote:
> On 02/13/2025 01:50 AM, Josh Poimboeuf wrote:
> > > @@ -133,7 +133,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
> > >  #define annotate_unreachable() __annotate_unreachable(__COUNTER__)
> > > 
> > >  /* Annotate a C jump table to allow objtool to follow the code flow */
> > > -#define __annotate_jump_table __section(".rodata..c_jump_table")
> > > +#define __annotate_jump_table __section(".rodata..c_jump_table,\"a\",@progbits #")
> > 
> > This caused a regression, this hack apparently doesn't work with Clang:
> > 
> >   $ readelf -WS kernel/bpf/core.o | grep c_jump_table
> >     [43] .rodata..c_jump_table,"a",@progbits # PROGBITS        0000000000000000 00d610 000800 00   A  0   0 16
> > 
> > Notice the section name is literally:
> > 
> >   .rodata..c_jump_table,"a",@progbits #
> 
> Yes, I noticed this section name which contains the original name
> ".rodata..c_jump_table" and the specified attribute compiled with
> Clang, it should not contain the specified attribute.
> 
> That is strange but seems no effect due to only compare the first
> few letters of the section name in objtool.

It actually does have an effect -- objtool doesn't recognize the BPF C
jump table (see the use of C_JUMP_TABLE_SECTION in
tools/objtool/arch/x86/special.c), resulting in a bogus warning and
missing ORC.

I do have a workaround to use strstarts() instead of strcmp(), I'll be
posting that soon.

> I will keep digging with the GNU and LLVM compiler developers.

Thanks!

-- 
Josh

  reply	other threads:[~2025-02-13  2:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24  6:27 Tiezhu Yang
2025-02-12 17:50 ` Josh Poimboeuf
2025-02-13  2:20   ` Tiezhu Yang
2025-02-13  2:39     ` Josh Poimboeuf [this message]
2025-02-13 12:38       ` Tiezhu Yang
2025-02-13 18:54         ` Josh Poimboeuf
2025-02-14  2:23           ` Tiezhu Yang
2025-02-14  8:44             ` Josh Poimboeuf
2025-02-14  8:56               ` Tiezhu Yang

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=20250213023936.lzbpgou4eallaij3@jpoimboe \
    --to=jpoimboe@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=loongarch@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=peterz@infradead.org \
    --cc=yangtiezhu@loongson.cn \
    /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®