Re: [PATCH v2 15/21] objtool: cache relocations, do less work
From: Lorenzo Stoakes (ARM)
Date: Tue Sep 15 2026 - 08:57:09 EST
On Mon, Sep 14, 2026 at 03:30:19PM -0700, Linus Torvalds wrote:
> 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.
Obviously I defer to Josh on this, but it seems from what he said it's
probably a little involved and maybe tricky to figure out how much impact
it might have.
Anyway v3 drops the relocation hash altogether so 1 out of 2 ain't bad ;)
>
> Linus
--
Cheers, Lorenzo