From: Peter Zijlstra <peterz@infradead.org>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: x86@kernel.org, Josh Poimboeuf <jpoimboe@redhat.com>,
hjl.tools@gmail.com, ndesaulniers@google.com, mbenes@suse.cz,
rostedt@goodmis.org, linux-toolchains@vger.kernel.org
Subject: Re: The trouble with __weak and objtool got worse
Date: Sat, 16 Apr 2022 12:59:05 +0200 [thread overview]
Message-ID: <20220416105905.GE2731@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220415182229.GB25951@gate.crashing.org>
On Fri, Apr 15, 2022 at 01:22:29PM -0500, Segher Boessenkool wrote:
> Hi!
>
> On Fri, Apr 15, 2022 at 01:19:04PM +0200, Peter Zijlstra wrote:
> [ huge snip ]
>
> > This seems to happen when objtool cannot find a section symbol, in which
> > case it falls back to any other symbol to key off of, however in this
> > case that goes terribly wrong!
>
> That is an objtool problem then. Fix objtool so it looks at symbols
> directly?
I'm not sure what you're saying. It *does* look at the symbols, but at
the time we run objtool (pre link) there's multiple copies of a symbol
(weak and non-weak), and if we then generate symbol relative relocs, we
end up, post-link, with the relocs resolved wrong.
The weak symbol relocs get applied to the non-weak symbol, and fail
happens.
> > The other option seems to be to have objtool add section symbols it
> > needs, however due to ELF being a total PITA and requiring all LOCAL
> > symbols to be before GLOBAL symbols, this would mean re-ordering the
> > whole symbol table (I have the code somewhere :-/).
>
> ELF requires no such thing? Where do you see this?
The first google hit:
https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-79797.html
which has:
"In each symbol table, all symbols with STB_LOCAL binding precede the
weak symbols and global symbols. As Sections describes, a symbol table
section's sh_info section header member holds the symbol table index for
the first non-local symbol."
I ran into that when I violated that contraint at some point and
the various elf tools screamed at me.
next prev parent reply other threads:[~2022-04-16 10:59 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
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 [this message]
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=20220416105905.GE2731@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=hjl.tools@gmail.com \
--cc=jpoimboe@redhat.com \
--cc=linux-toolchains@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=ndesaulniers@google.com \
--cc=rostedt@goodmis.org \
--cc=segher@kernel.crashing.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.