Public

Hi,

Could you please let us know if you have any comments
on this patch?

Kind regards,
Aleksandar Rakic


________________________________________
From: Aleksandar Rakic <aleksandar.ra...@htecgroup.com>
Sent: Monday, March 17, 2025 2:21 PM
To: gcc-patches@gcc.gnu.org
Cc: Djordje Todorovic; c...@mips.com; richard.guent...@gmail.com; 
ja...@redhat.com; Matthew Fortune; Faraz Shahbazker; Aleksandar Rakic
Subject: [PATCH v2 06/12] Frame barrier fix

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 7ff41862427..f01057feea1 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -12366,7 +12366,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

Reply via email to