From: Matthew Fortune <matthew.fort...@imgtec.com> Ensure the frame barrier prevents reordering of stack pointer changes.
It is possible for a load/store accessing the stack via a copy of the stack pointer to be moved across the epilogue meaning that it accesses stack that is no longer allocated. This leads to a situation where the code is unsafe in the event of an interrupt where the same stack is used for interrupt handling. gcc/ * config/mips/mips.cc (mips_frame_barrier): Upgrade to a full blockage. Cherry-picked 0c240da6f6032bd19348b97148d25c05ba2e8356 from https://github.com/MIPS/gcc Signed-off-by: Matthew Fortune <matthew.fort...@imgtec.com> Signed-off-by: Faraz Shahbazker <fshahbaz...@wavecomp.com> Signed-off-by: Aleksandar Rakic <aleksandar.ra...@htecgroup.com> --- gcc/config/mips/mips.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc index dcb4b9f9f99..57a858aca39 100644 --- a/gcc/config/mips/mips.cc +++ b/gcc/config/mips/mips.cc @@ -13626,7 +13626,7 @@ mips_output_function_epilogue (FILE *) static void mips_frame_barrier (void) { - emit_clobber (gen_frame_mem (BLKmode, stack_pointer_rtx)); + emit_insn (gen_blockage ()); } -- 2.34.1