[PATCH v2 4/8] mips: Fix issues with removing no-reorder directives

Jovan Dmitrovic jovan.dmitrovic@htecgroup.com
Wed Jun 18 14:33:44 GMT 2025


From: Aleksandar Rakic <aleksandar.rakic@htecgroup.com>

1. Added -O2 to the Makefile to ensure that assembly sources have
   their delay slots filled.

2. Also move the no-reorder directive into the PIC section of the
   setjmp code.

Cherry-picked 4e451260675b2e54535eafc2df35d92653acd084
from https://github.com/MIPS/glibc

Signed-off-by: Andrew Bennett <andrew.bennett@imgtec.com>
Signed-off-by: Faraz Shahbazker <fshahbazker@wavecomp.com>
Signed-off-by: Aleksandar Rakic <aleksandar.rakic@htecgroup.com>
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
---
 sysdeps/mips/Makefile     | 2 ++
 sysdeps/mips/bsd-setjmp.S | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile
index d189973aa0..17ddc2a97c 100644
--- a/sysdeps/mips/Makefile
+++ b/sysdeps/mips/Makefile
@@ -18,9 +18,11 @@ CPPFLAGS-crtn.S += $(pic-ccflag)
 endif
 
 ASFLAGS-.os += $(pic-ccflag)
+
 # libc.a and libc_p.a must be compiled with -fPIE/-fpie for static PIE.
 ASFLAGS-.o += $(pie-default)
 ASFLAGS-.op += $(pie-default)
+ASFLAGS += -O2
 
 ifeq ($(subdir),elf)
 
diff --git a/sysdeps/mips/bsd-setjmp.S b/sysdeps/mips/bsd-setjmp.S
index b8f5ef6ca7..4d638216d2 100644
--- a/sysdeps/mips/bsd-setjmp.S
+++ b/sysdeps/mips/bsd-setjmp.S
@@ -28,8 +28,8 @@
 	.option pic2
 #endif
 ENTRY (setjmp)
-	.set	noreorder
 #ifdef __PIC__
+	.set	noreorder
 	.cpload t9
 	.set	reorder
 	la	t9, C_SYMBOL_NAME (__sigsetjmp)
-- 
2.34.1


More information about the Libc-alpha mailing list