public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: jpoimboe@redhat.com, linux-kernel@vger.kernel.org,
	Fangrui Song <i@maskray.me>,
	llvm@lists.linux.dev
Subject: Re: [PATCH 1/9] objtool: Generic annotation infrastructure
Date: Mon, 25 Nov 2024 10:28:54 +0100	[thread overview]
Message-ID: <20241125092854.GG24774@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20241124031640.GA3646332@thelio-3990X>

On Sat, Nov 23, 2024 at 08:16:40PM -0700, Nathan Chancellor wrote:
> On Fri, Nov 22, 2024 at 01:10:17PM +0100, Peter Zijlstra wrote:
> > Avoid endless .discard.foo sections for each annotation, create a
> > single .discard.annotate section that takes an annotation type along
> > with the instruction.
> > 
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ...
> > --- a/tools/objtool/check.c
> > +++ b/tools/objtool/check.c
> > @@ -2373,6 +2373,49 @@ static int read_unwind_hints(struct objt
> >  	return 0;
> >  }
> >  
> > +static int read_annotate(struct objtool_file *file, void (*func)(int type, struct instruction *insn))
> > +{
> > +	struct section *sec;
> > +	struct instruction *insn;
> > +	struct reloc *reloc;
> > +	int type;
> > +
> > +	sec = find_section_by_name(file->elf, ".discard.annotate");
> > +	if (!sec)
> > +		return 0;
> > +
> > +	if (!sec->rsec)
> > +		return 0;
> > +
> > +	if (sec->sh.sh_entsize != 8) {
> > +		static bool warned = false;
> > +		if (!warned) {
> > +			WARN("%s: dodgy linker, sh_entsize != 8", sec->name);
> 
> Thanks to Fangrui, this has been resolved in LLVM main:
> 
> https://github.com/llvm/llvm-project/commit/d4bed617f4378873d7ddf4b53c041e7b39d1a9ca
> https://github.com/ClangBuiltLinux/linux/issues/2057#issuecomment-2495675374
> 
> I have built a version of LLVM from main and verified that this warning
> does not trigger with that version, while it does with LLVM 19.1.4.

Excellent, thanks for getting this sorted.

Since there's a fair number of llvm releases between the minimally
supported version to build a kernel with and this fix, I'll leave the
warning as non fatal.

One question; is there any other means of setting entsize aside from
(ab)using SHF_MERGE ? The (GNU) as documetation for .section only
mentions entsize in combination with SHF_MERGE.


  reply	other threads:[~2024-11-25  9:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-22 12:10 [PATCH 0/9] objtool: Rewrite annotations Peter Zijlstra
2024-11-22 12:10 ` [PATCH 1/9] objtool: Generic annotation infrastructure Peter Zijlstra
2024-11-24  3:16   ` Nathan Chancellor
2024-11-25  9:28     ` Peter Zijlstra [this message]
2024-11-22 12:10 ` [PATCH 2/9] objtool: Convert ANNOTATE_NOENDBR to ANNOTATE Peter Zijlstra
2024-11-22 12:10 ` [PATCH 3/9] objtool: Convert ANNOTATE_RETPOLINE_SAFE " Peter Zijlstra
2024-11-22 12:10 ` [PATCH 4/9] objtool: Convert instrumentation_{begin,end}() " Peter Zijlstra
2024-11-22 12:10 ` [PATCH 5/9] objtool: Convert VALIDATE_UNRET_BEGIN " Peter Zijlstra
2024-11-22 12:10 ` [PATCH 6/9] objtool: Convert ANNOTATE_IGNORE_ALTERNATIVE " Peter Zijlstra
2024-11-22 12:10 ` [PATCH 7/9] objtool: Convert ANNOTATE_INTRA_FUNCTION_CALLS " Peter Zijlstra
2024-11-22 17:22   ` Josh Poimboeuf
2024-11-22 12:10 ` [PATCH 8/9] objtool: Collapse annotate sequences Peter Zijlstra
2024-11-22 17:57   ` Josh Poimboeuf
2024-11-23 13:09     ` Peter Zijlstra
2024-11-22 12:10 ` [PATCH 9/9] objtool: Collect all annotations in objtool.h Peter Zijlstra
2024-11-22 17:54   ` Josh Poimboeuf
2024-11-23 13:19     ` Peter Zijlstra
2024-11-25 13:06       ` Peter Zijlstra
2024-11-25 13:40         ` Peter Zijlstra
2024-11-25 14:36           ` Peter Zijlstra
2024-11-22 17:40 ` [PATCH 0/9] objtool: Rewrite annotations Josh Poimboeuf
2024-11-23 13:21   ` Peter Zijlstra

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=20241125092854.GG24774@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=i@maskray.me \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.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