lkml.org 
[lkml]   [2020]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] objtool: optimize add_dead_ends for split sections
On Tue, Apr 21, 2020 at 03:13:05PM -0500, Josh Poimboeuf wrote:
> Also, the unreachable annotation at the end of a section is really an
> edge case. I'm sort of wondering if there's a way to accomplish the
> same thing without storing the last_insn.
>
> For example, I wonder if we could use find_insn() for some bytes at the
> end of the section. Most of the time I _think_ there will be a two-byte
> UD2 instruction there anyway. So maybe we could do something like:
>
> for (offset = rela->sym->sec->len - 1;
> offset > rela->sym->sec->len - 10;
> offset --) {
>
> insn = find_insn(file, rela->sym->sec, offset);
> if (insn)
> break;
> }
>
> It's kind of ugly, but then we could maybe avoid the need for the
> last_insn thing.

Sure, that looks fine. I tested this and it looks like the performance
is roughly the same. I'll send v2 shortly.

Sami

\
 
 \ /
  Last update: 2020-04-22 00:05    [W:0.046 / U:0.804 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site