patchable-function-entry
The -Z patchable-function-entry=total_nops,prefix_nops,record_section,
-Z patchable-function-entry=total_nops,prefix_nops, or
-Z patchable-function-entry=total_nops
compiler flag enables nop padding of function entries with ‘total_nops’ nops, with
an offset for the entry of the function at ‘prefix_nops’ nops. In the third form,
‘prefix_nops’ defaults to 0. record_section can specify a specific linker section
to place entry record in, the default is __patchable_function_entries.
As an illustrative example, -Z patchable-function-entry=3,2 would produce:
nop
nop
function_label:
nop
//Actual function code begins here
This flag is used for hotpatching, especially in the Linux kernel. The flag
arguments are modeled after the -fpatchable-function-entry flag as defined
for both Clang
and gcc
and is intended to provide the same effect.