On Fri, Mar 27, 2015 at 10:30:38AM +0100, Andreas Krebbel wrote: > At a second glance it is not really clear to me why we disable hotpatching > for nested functions at > all. While it is probably a bit difficult to actually hotpatch them I don't > see why we should > prevent it. We probably just copied that over from the x86 ms_hook_prologue > attribute implementation: > > static bool > ix86_function_ms_hook_prologue (const_tree fn) > { > if (fn && lookup_attribute ("ms_hook_prologue", DECL_ATTRIBUTES (fn))) > { > if (decl_function_context (fn) != NULL_TREE) > error_at (DECL_SOURCE_LOCATION (fn), > "ms_hook_prologue is not compatible with nested function"); > else > return true; > } > return false; > } > > Also the kernel guys (one of the main users of that feature) confirmed that > they in principle prefer > hotpatching to behave more like -pg and -pg does insert an mcount call for > nested functions. > (Although I would be surprised to hear of nested functions in the Linux > kernel). > > So I'm inclined to just remove that special handling of nested functions.
Agreed, I also wondered what would be so special about nested functions here. Sure, one could hotpatch them with code clobbering the static chain register, but that wouldn't be a gcc issue. Jakub