On Mon, May 26, 2025 at 12:38:22PM +0200, Peter Zijlstra wrote: > On Fri, May 09, 2025 at 01:16:52PM -0700, Josh Poimboeuf wrote: > > When ignore_unreachable_insn() looks for weak function holes which jump > > to their .cold functions, it assumes the parent function comes before > > the corresponding .cold function in the symbol table. That's not > > necessarily the case with -ffunction-sections. > > > > Mark all the holes beforehand (including .cold functions) so the > > ordering of the discovery doesn't matter. > > One of the things I have a 'todo' entry on, is rewriting all sections > that reference any one of these instructions. > > That is, things like fentry, alternatives, retpoline, static_call, > jump_label. Everything that can cause runtime code patching. > > Once we are sure none of those sections will contain references to this > dead code, we can go and wipe the actual code. Perhaps fill it with a > UD1 instruction with some identifying immediate.
Yeah, that would be nice. -- Josh