From: Josh Poimboeuf <jpoimboe@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: objtool query: section start/end symbols?
Date: Thu, 6 Jun 2024 12:45:25 -0700 [thread overview]
Message-ID: <20240606194525.cdnnidxurejsjtx4@treble> (raw)
In-Reply-To: <CAHk-=wjHf6C_74VQPxmge-sMmu5yuhmNor1TaO0Uq--zrA13HA@mail.gmail.com>
On Thu, Jun 06, 2024 at 11:42:40AM -0700, Linus Torvalds wrote:
> So this is related to my currently very ugly hack at
>
> https://lore.kernel.org/all/CAHk-=whFSz=usMPHHGAQBnJRVAFfuH4gFHtgyLe0YET75zYRzA@mail.gmail.com/
>
> where I'm trying to do "runtime constants". That patch actually works,
> but it's flawed in many ways, and one of the ways it is flawed is that
> I really want to put the "this is the use for symbol X" in a section
> of its own for each X.
>
> Now, creating the sections is trivial, that's not the problem. I'd
> just make the asm do
>
> ".pushsection .static_const." #sym ",\"a\"\n\t" \
> ...
> ".popsection"
>
> and the linker script will just do
>
> KEEP(*(.static_const.*))
>
> and I'm done. Nice individual sections for each of the runtime constant symbols.
>
> However, for the fixup part, I then really want the section start and
> end addresses, so that I can iterate over those uses for a particular
> named symbol.
That should be trivial. But ideally the interface would be less magical
and wouldn't need objtool to sprinkle any pixie dust. Could it be
implemented similar to static keys by making the static const variable
an opaque structure instead of just a "normal" variable?
DEFINE_STATIC_CONST(dentry_hashtable);
That could create something similar to 'struct static_key' which
correlates the const variable with all its use sites.
--
Josh
next prev parent reply other threads:[~2024-06-06 19:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 18:42 Linus Torvalds
2024-06-06 19:45 ` Josh Poimboeuf [this message]
2024-06-06 21:10 ` Linus Torvalds
2024-06-06 22:18 ` Josh Poimboeuf
2024-06-06 22:54 ` Linus Torvalds
2024-06-07 2:41 ` Josh Poimboeuf
2024-06-07 9:39 ` Rasmus Villemoes
2024-06-07 18:54 ` Linus Torvalds
2024-06-07 9:52 ` Rasmus Villemoes
2024-06-07 19:15 ` Linus Torvalds
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=20240606194525.cdnnidxurejsjtx4@treble \
--to=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.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®