[PATCH v3 6/6] mips: Fix delay slot filling in bsd-setjmp.S

Maciej W. Rozycki macro@orcam.me.uk
Mon Sep 22 12:05:21 GMT 2025


On Wed, 3 Sep 2025, Jovan Dmitrovic wrote:

> In the !defined __PIC__ case, we cannot guarantee that the delay slot
> is properly filled at the final `j` instuction without reordering

s/instuction/instruction/

> active.
> ---
>  sysdeps/mips/bsd-setjmp.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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

 Strictly speaking the .set noreorder/reorder pair is only there for the 
.cpload pseudo-op, which is required to be in a noreorder block.  It seems 
like a bug caused by an oversight in commit ba0b6741da1a back in 2001, 
but back then all MIPS/Linux code was SVR4 PIC, so it didn't matter.

  Maciej


More information about the Libc-alpha mailing list