Messages in this thread | | | Date | Tue, 21 Apr 2020 15:02:58 -0700 | From | Sami Tolvanen <> | Subject | Re: [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
| |