Re: objtool query: section start/end symbols?

From: Linus Torvalds
Date: Fri Jun 07 2024 - 14:57:17 EST


On Fri, 7 Jun 2024 at 02:39, Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> wrote:
>
> I'm probably missing something, but isn't this exactly what you get for
> free if you avoid using dots and other non-identifier symbols in the
> section names, i.e. make it "__static_const__" #sym or whatnot:

LOL. You're not missing anything - I am. I clearly missed this linker
rule entirely when I was looking for some explicit way to set these
start/end symbols, because that rule - which is almost exactly what I
wanted - is implicit.

That said, I say "almost exactly", because I can't get it to work.

Why? You need to match the output section name with the input section,
and since the whole point was that the input section was a *pattern*,
I can't do that.

I can hardcode the section names, which fixes it, but that is what I
wanted to avoid (once I hardcode the section names I could have just
added the start/end symbols by hand).

That said, clearly there's a way to just do it, since your
test-program - using the built-in linker script can do it.

I do worry that I also need that "AT()" logic to subtract the LOAD_OFFSET.

I really don't know linker scripts very well. I spent more time than I
want to admit to just because of missing whitespace.

Linus