linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
	x86@kernel.org, hjl.tools@gmail.com, mbenes@suse.cz,
	rostedt@goodmis.org, linux-toolchains@vger.kernel.org,
	clang-built-linux <llvm@lists.linux.dev>
Subject: Re: The trouble with __weak and objtool got worse
Date: Sat, 16 Apr 2022 09:07:42 -0700	[thread overview]
Message-ID: <20220416160742.6g4nejji4xyrgpvp@treble> (raw)
In-Reply-To: <20220416104809.GC2731@worktop.programming.kicks-ass.net>

On Sat, Apr 16, 2022 at 12:48:09PM +0200, Peter Zijlstra wrote:
> This *might* work for static_call. But what about things like
> .retpoline_sites?
> 
> If we get an indirect inside the weak function and at
> a different place inside the non-weak function, then we end up with two
> patch sites in the non-weak function.
> 
> And since all of that is compiler generated, we don't have anything to
> stick anything in to alleviate trouble.
> 
> (in fact, I didn't observe this with static_call, I just picked it for
> the example because it was somewhat easier)

Ok, right.  And ORC entries will be broken.  I found the ones below by
disabling CONFIG_DEBUG_INFO and looking for "sym->bind == STB_WEAK" in
the elf_add_reloc_to_insn() fallback.

I guess objtool will need to bite the bullet and create section symbols.

  lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0x0: missing section symbol for reference to weak function text
  lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0x4: missing section symbol for reference to weak function text
  lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0x8: missing section symbol for reference to weak function text
  lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0xc: missing section symbol for reference to weak function text
  lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0x10: missing section symbol for reference to weak function text
  lib/clz_ctz.o: warning: objtool: .orc_unwind_ip+0x14: missing section symbol for reference to weak function text
  lib/iomap_copy.o: warning: objtool: .orc_unwind_ip+0x0: missing section symbol for reference to weak function text
  lib/iomap_copy.o: warning: objtool: .orc_unwind_ip+0x4: missing section symbol for reference to weak function text
  lib/iomap_copy.o: warning: objtool: .orc_unwind_ip+0x10: missing section symbol for reference to weak function text
  lib/iomap_copy.o: warning: objtool: .orc_unwind_ip+0x14: missing section symbol for reference to weak function text
  lib/crc32.o: warning: objtool: .orc_unwind_ip+0x14: missing section symbol for reference to weak function text
  lib/crc32.o: warning: objtool: .orc_unwind_ip+0x18: missing section symbol for reference to weak function text
  lib/crc32.o: warning: objtool: .orc_unwind_ip+0x1c: missing section symbol for reference to weak function text
  lib/crc32.o: warning: objtool: .orc_unwind_ip+0x20: missing section symbol for reference to weak function text
  lib/crc32.o: warning: objtool: .orc_unwind_ip+0x24: missing section symbol for reference to weak function text
  lib/crc32.o: warning: objtool: .orc_unwind_ip+0x28: missing section symbol for reference to weak function text

-- 
Josh


  reply	other threads:[~2022-04-16 16:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-15 11:19 The trouble with __weak and objtool got worse Peter Zijlstra
2022-04-15 14:12 ` Steven Rostedt
2022-04-15 15:31   ` Peter Zijlstra
2022-04-15 15:10 ` Josh Poimboeuf
2022-04-15 15:15   ` Josh Poimboeuf
2022-04-15 15:26 ` Peter Zijlstra
2022-04-15 17:40   ` Nick Desaulniers
2022-04-15 18:21     ` Josh Poimboeuf
2022-04-15 18:23       ` Josh Poimboeuf
2022-04-15 20:36       ` Nick Desaulniers
2022-04-16 10:49         ` Peter Zijlstra
2022-04-16 10:48       ` Peter Zijlstra
2022-04-16 16:07         ` Josh Poimboeuf [this message]
2022-04-16 16:32           ` H.J. Lu
2022-04-17 15:44           ` Peter Zijlstra
2022-04-17 15:46             ` Peter Zijlstra
2022-04-15 18:22 ` Segher Boessenkool
2022-04-15 18:36   ` Nick Desaulniers
2022-04-15 20:07     ` Segher Boessenkool
2022-04-15 20:31       ` Nick Desaulniers
2022-04-15 21:17         ` Fangrui Song
2022-04-15 21:41           ` Segher Boessenkool
2022-04-16 11:09       ` Peter Zijlstra
2022-04-16 10:59   ` Peter Zijlstra
2022-04-16 13:20     ` Segher Boessenkool
2022-04-16 17:59       ` Segher Boessenkool
2022-04-15 21:04 ` H.J. Lu
2022-04-16 11:25   ` Peter Zijlstra
2022-04-16 16:27     ` H.J. Lu

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=20220416160742.6g4nejji4xyrgpvp@treble \
    --to=jpoimboe@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mbenes@suse.cz \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=x86@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;
as well as URLs for NNTP newsgroup(s).