https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99888
--- Comment #6 from Kewen Lin <linkw at gcc dot gnu.org> --- (In reply to Fangrui Song from comment #5) > * There is a restriction on the number of instructions between the function > label and the .localentry directive. > * For -fpatchable-function-entry=N[,M], M nops must precede the function > label. > > On aarch64/x86/etc, these nops are consecutive. Personally I think this > condition can be lifted for PowerPC ELFv2. The runtime library will need to > check st_other or do some instruction inspection, which may be fine. > > > nop > nop > nop > foo: > .LCF0: > .cfi_startproc > addis 2,12,.TOC.-.LCF0@ha > addi 2,2,.TOC.-.LCF0@l > .localentry foo,.-foo > nop > nop Thanks for the input! With your proposal, the nice thing is that we don't need to bother the count of NOPs between GEP and LEP. But IMHO it seems confusing since we take GEP as function entry when patching preceding NOPs while take LEP as function entry when patching succeeding NOPs. The acceptable counts of NOPs in the proposed patch conforms to ELFv2 ABI, I hope runtime library can survive with it.