On Fri, Feb 01, 2019 at 11:37:06PM +0100, Eric Botcazou wrote: > > As discussed in the PR and suggested by Uros, scheduler has code to keep a > > use of hard register next to the assignment that sets that hard register > > from a pseudo, which is desirable so that RA can deal with it properly. > > Unfortunately, with -fstack-protector* we stick the stack protect epilogue > > in between, which splits the load and use to different basic blocks. > > The code emitted by expand_function_end between these two spots is only the > > loading of the return value into registers, so generally it shouldn't > > contain any stores which stack protection wants to guard against, so I > > believe from security POV this shouldn't weaken anything, but fixes the > > testcase. > > This moves the stack protect epilogue from after the naked_return_label to > before though, so it will be skipped for a naked return.
So, can we e.g. keep emitting the epilogue where it is now for naked_return_label != NULL_RTX and move it otherwise? For __builtin_return the setter and use of the hard register won't be adjacent in any case. Jakub