This seems like a weird place to call this, or am I missing something.  Any reason why it can't be called from main before calling kpatch_write_output_elf?