Re: [PATCH v2 15/21] objtool: cache relocations, do less work
From: Linus Torvalds
Date: Mon Sep 14 2026 - 18:37:54 EST
On Mon, 14 Sept 2026 at 15:23, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> There might be more efficient ways to structure the considerable amount
> of data, like replacing "struct instruction" with "struct basic_block"
> or so, but it's hard to know whether that would be a net positive.
Yeah, I was thinking that you'd only hash instructions as you find
them if they are obvious "I need this instruction", and then try to
hash them *again* if they are branch targets (and just have a "already
hashed" flag).
That way random number instructions would not be on the hash - unless
they become branch targets.
And you wouldn't ever really have to track any complicated decisions
(like that whole "basic block" thing - I agree that it's painful,
because the shape of a basic block will change over time as you find
branch targets).
But not a big deal. More an idle thought brought on by that other
patch that changed the hash table size, and this discussion that was
talking about the hashing - or not hashing - of sections.
So more of a "if it is easy and straightforward" kind of thing.
Linus