diff --git a/arch/mips/crt_arch.h b/arch/mips/crt_arch.h
index 9fc50d7..c95db06 100644
--- a/arch/mips/crt_arch.h
+++ b/arch/mips/crt_arch.h
@@ -8,13 +8,39 @@ __asm__(
 ".type   " START ", @function\n"
 "_" START ":\n"
 "" START ":\n"
+#if __mips_isa_rev < 6
+#ifdef __mips_micromips
+"	move $fp, $0 \n"
+"	.align 2 \n"
+"	bal32 1f \n"
+"	nop32 \n"
+#else
 "	bal 1f \n"
 "	 move $fp, $0 \n"
+#endif
+#else
+"	move $fp, $0 \n"
+"	.align 2 \n"
+"	balc 1f \n"
+#endif
 "	.gpword . \n"
 "	.gpword " START "_c \n"
 ".weak _DYNAMIC \n"
 ".hidden _DYNAMIC \n"
 "	.gpword _DYNAMIC \n"
+
+#ifdef __mips_micromips
+"1:	ins $ra, $0, 0, 1 \n"
+"	lw $gp, 0($ra) \n"
+"	subu $gp, $ra, $gp \n"
+"	move $4, $sp \n"
+"	lw $5, 8($ra) \n"
+"	addu $5, $5, $gp \n"
+"	lw $25, 4($ra) \n"
+"	addu $25, $25, $gp \n"
+"	ori $25, $25, 1 \n"
+"	and $sp, $sp, -8 \n"
+#else
 "1:	lw $gp, 0($ra) \n"
 "	subu $gp, $ra, $gp \n"
 "	move $4, $sp \n"
@@ -23,7 +49,14 @@ __asm__(
 "	lw $25, 4($ra) \n"
 "	addu $25, $25, $gp \n"
 "	and $sp, $sp, -8 \n"
+#endif
+
+#if __mips_isa_rev < 6
 "	jalr $25 \n"
 "	 subu $sp, $sp, 16 \n"
+#else
+"	subu $sp, $sp, 16 \n"
+"	jalrc $25 \n"
+#endif
 ".set pop \n"
 );
diff --git a/arch/mips/reloc.h b/arch/mips/reloc.h
index b3d59a4..9b5a4d7 100644
--- a/arch/mips/reloc.h
+++ b/arch/mips/reloc.h
@@ -36,6 +36,26 @@
 #define CRTJMP(pc,sp) __asm__ __volatile__( \
 	"move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
 
+#if __mips_isa_rev < 6
+#ifdef __mips_micromips
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+	".hidden " #sym "\n" \
+	".set push \n" \
+	".set noreorder \n" \
+	"	.align 2 \n" \
+	"	bal32 1f \n" \
+	"	 nop32 \n" \
+	"	.gpword . \n" \
+	"	.gpword " #sym " \n" \
+	"1:	ins $ra, $0, 0, 1 \n" \
+	"	lw %0, ($ra) \n" \
+	"	subu %0, $ra, %0 \n" \
+	"	lw $ra, 4($ra) \n" \
+	"	addu %0, %0, $ra \n" \
+	"	ori %0, %0, 1 \n" \
+	".set pop \n" \
+	: "=r"(*(fp)) : : "memory", "ra" )
+#else
 #define GETFUNCSYM(fp, sym, got) __asm__ ( \
 	".hidden " #sym "\n" \
 	".set push \n" \
@@ -50,3 +70,38 @@
 	"	addu %0, %0, $ra \n" \
 	".set pop \n" \
 	: "=r"(*(fp)) : : "memory", "ra" )
+#endif
+#else
+#ifdef __mips_micromips
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+	".hidden " #sym "\n" \
+	".set push \n" \
+	".set noreorder \n" \
+	"	.align 2 \n" \
+	"	balc32 1f \n" \
+	"	.gpword . \n" \
+	"	.gpword " #sym " \n" \
+	"1:	ins $ra, $0, 0, 1 \n" \
+	"	lw %0, ($ra) \n" \
+	"	subu %0, $ra, %0 \n" \
+	"	lw $ra, 4($ra) \n" \
+	"	addu %0, %0, $ra \n" \
+	"	ori %0, %0, 1 \n" \
+	".set pop \n" \
+	: "=r"(*(fp)) : : "memory", "ra" )
+#else
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+	".hidden " #sym "\n" \
+	".set push \n" \
+	".set noreorder \n" \
+	"	balc 1f \n" \
+	"	.gpword . \n" \
+	"	.gpword " #sym " \n" \
+	"1:	lw %0, ($ra) \n" \
+	"	subu %0, $ra, %0 \n" \
+	"	lw $ra, 4($ra) \n" \
+	"	addu %0, %0, $ra \n" \
+	".set pop \n" \
+	: "=r"(*(fp)) : : "memory", "ra" )
+#endif
+#endif
diff --git a/crt/mips/crtn.s b/crt/mips/crtn.s
index 506a04b..10bfaa1 100644
--- a/crt/mips/crtn.s
+++ b/crt/mips/crtn.s
@@ -3,11 +3,13 @@
 .section .init
 	lw $gp,24($sp)
 	lw $ra,28($sp)
-	j $ra
 	addu $sp,$sp,32
+	j $ra
+	nop
 
 .section .fini
 	lw $gp,24($sp)
 	lw $ra,28($sp)
-	j $ra
 	addu $sp,$sp,32
+	j $ra
+	nop
diff --git a/src/fenv/mips/fenv.S b/src/fenv/mips/fenv.S
index a5cb1f5..b0548ac 100644
--- a/src/fenv/mips/fenv.S
+++ b/src/fenv/mips/fenv.S
@@ -10,8 +10,9 @@ feclearexcept:
 	or      $5, $5, $4
 	xor     $5, $5, $4
 	ctc1    $5, $31
-	jr      $ra
 	li      $2, 0
+	jr      $ra
+	nop
 
 .global feraiseexcept
 .type  feraiseexcept,@function
@@ -20,23 +21,26 @@ feraiseexcept:
 	cfc1    $5, $31
 	or      $5, $5, $4
 	ctc1    $5, $31
-	jr      $ra
 	li      $2, 0
+	jr      $ra
+	nop
 
 .global fetestexcept
 .type  fetestexcept,@function
 fetestexcept:
 	and     $4, $4, 0x7c
 	cfc1    $2, $31
-	jr      $ra
 	and     $2, $2, $4
+	jr      $ra
+	nop
 
 .global fegetround
 .type  fegetround,@function
 fegetround:
 	cfc1    $2, $31
-	jr      $ra
 	andi    $2, $2, 3
+	jr      $ra
+	nop
 
 .global __fesetround
 .type __fesetround,@function
@@ -46,16 +50,18 @@ __fesetround:
 	and     $5, $5, $6
 	or      $5, $5, $4
 	ctc1    $5, $31
-	jr      $ra
 	li      $2, 0
+	jr      $ra
+	nop
 
 .global fegetenv
 .type  fegetenv,@function
 fegetenv:
 	cfc1    $5, $31
 	sw      $5, 0($4)
-	jr      $ra
 	li      $2, 0
+	jr      $ra
+	nop
 
 .global fesetenv
 .type  fesetenv,@function
@@ -65,7 +71,8 @@ fesetenv:
 	 nop
 	lw      $5, 0($4)
 1:	ctc1    $5, $31
-	jr      $ra
 	li      $2, 0
+	jr      $ra
+	nop
 
 #endif
diff --git a/src/internal/mips/syscall.s b/src/internal/mips/syscall.s
index 5d0def5..e6cb8fb 100644
--- a/src/internal/mips/syscall.s
+++ b/src/internal/mips/syscall.s
@@ -19,8 +19,9 @@ __syscall:
 	sw      $2 ,28($sp)
 	lw      $2, 28($sp)
 	syscall
-	beq     $7, $0, 1f
 	addu    $sp, $sp, 32
+	beq     $7, $0, 1f
+	nop
 	subu    $2, $0, $2
 1:	jr      $ra
 	nop
diff --git a/src/ldso/mips/dlsym.s b/src/ldso/mips/dlsym.s
index 1573e51..dd68a8f 100644
--- a/src/ldso/mips/dlsym.s
+++ b/src/ldso/mips/dlsym.s
@@ -13,5 +13,6 @@ dlsym:
 	jalr $25
 	nop
 	lw $ra, 12($sp)
-	jr $ra
 	addiu $sp, $sp, 16
+	jr $ra
+	nop
diff --git a/src/setjmp/mips/longjmp.S b/src/setjmp/mips/longjmp.S
index fdb6c95..b1572c3 100644
--- a/src/setjmp/mips/longjmp.S
+++ b/src/setjmp/mips/longjmp.S
@@ -36,5 +36,6 @@ longjmp:
 	lw      $22, 32($4)
 	lw      $23, 36($4)
 	lw      $30, 40($4)
-	jr      $ra
 	lw      $28, 44($4)
+	jr      $ra
+	nop
diff --git a/src/setjmp/mips/setjmp.S b/src/setjmp/mips/setjmp.S
index 501d526..e45c77d 100644
--- a/src/setjmp/mips/setjmp.S
+++ b/src/setjmp/mips/setjmp.S
@@ -35,5 +35,6 @@ setjmp:
 	swc1    $30, 96($4)
 	swc1    $31, 100($4)
 #endif
-	jr      $ra
 	li      $2, 0
+	jr      $ra
+	nop
diff --git a/src/signal/mips/sigsetjmp.s b/src/signal/mips/sigsetjmp.s
index 74b65ff..6d7b605 100644
--- a/src/signal/mips/sigsetjmp.s
+++ b/src/signal/mips/sigsetjmp.s
@@ -8,15 +8,17 @@ sigsetjmp:
 __sigsetjmp:
 	lui $gp, %hi(_gp_disp)
 	addiu $gp, %lo(_gp_disp)
+	addu $gp, $gp, $25
 	beq $5, $0, 1f
-	 addu $gp, $gp, $25
+	 nop
 
 	sw $ra, 104($4)
 	sw $16, 104+4+16($4)
 
 	lw $25, %call16(setjmp)($gp)
+	move $16, $4
 	jalr $25
-	 move $16, $4
+	 nop
 
 	move $5,$2
 	move $4,$16
diff --git a/src/thread/mips/clone.s b/src/thread/mips/clone.s
index 37dddf5..8e83626 100644
--- a/src/thread/mips/clone.s
+++ b/src/thread/mips/clone.s
@@ -4,7 +4,7 @@
 __clone:
 	# Save function pointer and argument pointer on new thread stack
 	and $5, $5, -8
-	subu $5, $5, 16
+	subu $5, $5, 32
 	sw $4, 0($5)
 	sw $7, 4($5)
 	# Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,tls,ctid)
@@ -19,8 +19,9 @@ __clone:
 	beq $7, $0, 1f
 	nop
 	addu $sp, $sp, 16
-	jr $ra
 	subu $2, $0, $2
+	jr $ra
+	nop
 1:	beq $2, $0, 1f
 	nop
 	addu $sp, $sp, 16
diff --git a/src/thread/mips/syscall_cp.S b/src/thread/mips/syscall_cp.S
new file mode 100644
index 0000000..c593bcf
--- /dev/null
+++ b/src/thread/mips/syscall_cp.S
@@ -0,0 +1,85 @@
+.set    noreorder
+
+.global __cp_begin
+.hidden __cp_begin
+.type   __cp_begin,@function
+.global __cp_end
+.hidden __cp_end
+.type   __cp_end,@function
+.global __cp_cancel
+.hidden __cp_cancel
+.type   __cp_cancel,@function
+.hidden __cancel
+.global __syscall_cp_asm
+.hidden __syscall_cp_asm
+.type   __syscall_cp_asm,@function
+__syscall_cp_asm:
+	subu    $sp, $sp, 32
+__cp_begin:
+	lw      $4, 0($4)
+	move    $2, $5
+	bne     $4, $0, __cp_cancel
+	nop
+	move    $4, $6
+	move    $5, $7
+	lw      $6, 48($sp)
+	lw      $7, 52($sp)
+	lw      $8, 56($sp)
+	lw      $9, 60($sp)
+	lw      $10,64($sp)
+	sw      $8, 16($sp)
+	sw      $9, 20($sp)
+	sw      $10,24($sp)
+	sw      $2, 28($sp)
+	lw      $2, 28($sp)
+	syscall
+__cp_end:
+	addu    $sp, $sp, 32
+	beq     $7, $0, 1f
+	nop
+	subu    $2, $0, $2
+1:	jr      $ra
+	nop
+
+__cp_cancel:
+	move    $2, $ra
+
+#if __mips_isa_rev < 6
+#ifdef __mips_micromips
+	addu    $sp, $sp, 32
+	.align  2
+	bal32   1f
+	nop32
+#else
+	bal     1f
+	addu    $sp, $sp, 32
+#endif
+#else
+#ifdef __mips_micromips
+	addu    $sp, $sp, 32
+	.align  2
+	balc32  1f
+#else
+	addu    $sp, $sp, 32
+	balc    1f
+#endif
+#endif
+	.gpword .
+	.gpword __cancel
+#ifdef __mips_micromips
+1:	ins     $ra, $0, 0, 1
+	lw      $3, ($ra)
+	subu    $3, $ra, $3
+	lw      $25, 4($ra)
+	addu    $25, $25, $3
+	ori     $25, $25, 1
+#else
+1:	lw      $3, ($ra)
+	subu    $3, $ra, $3
+	lw      $25, 4($ra)
+	addu    $25, $25, $3
+#endif
+	move    $ra, $2
+	jr      $25
+
+	nop
diff --git a/src/thread/mips/syscall_cp.s b/src/thread/mips/syscall_cp.s
deleted file mode 100644
index d284626..0000000
--- a/src/thread/mips/syscall_cp.s
+++ /dev/null
@@ -1,53 +0,0 @@
-.set    noreorder
-
-.global __cp_begin
-.hidden __cp_begin
-.type   __cp_begin,@function
-.global __cp_end
-.hidden __cp_end
-.type   __cp_end,@function
-.global __cp_cancel
-.hidden __cp_cancel
-.type   __cp_cancel,@function
-.hidden __cancel
-.global __syscall_cp_asm
-.hidden __syscall_cp_asm
-.type   __syscall_cp_asm,@function
-__syscall_cp_asm:
-	subu    $sp, $sp, 32
-__cp_begin:
-	lw      $4, 0($4)
-	bne     $4, $0, __cp_cancel
-	move    $2, $5
-	move    $4, $6
-	move    $5, $7
-	lw      $6, 48($sp)
-	lw      $7, 52($sp)
-	lw      $8, 56($sp)
-	lw      $9, 60($sp)
-	lw      $10,64($sp)
-	sw      $8, 16($sp)
-	sw      $9, 20($sp)
-	sw      $10,24($sp)
-	sw      $2, 28($sp)
-	lw      $2, 28($sp)
-	syscall
-__cp_end:
-	beq     $7, $0, 1f
-	addu    $sp, $sp, 32
-	subu    $2, $0, $2
-1:	jr      $ra
-	nop
-
-__cp_cancel:
-	move    $2, $ra
-	bal     1f
-	addu    $sp, $sp, 32
-	.gpword .
-	.gpword __cancel
-1:	lw      $3, ($ra)
-	subu    $3, $ra, $3
-	lw      $25, 4($ra)
-	addu    $25, $25, $3
-	jr      $25
-	move    $ra, $2
diff --git a/src/unistd/mips/pipe.s b/src/unistd/mips/pipe.s
index ba2c39a..e60912b 100644
--- a/src/unistd/mips/pipe.s
+++ b/src/unistd/mips/pipe.s
@@ -11,8 +11,9 @@ pipe:
 	beq $7, $0, 1f
 	nop
 	lw $25, %call16(__syscall_ret)($gp)
-	jr $25
 	subu $4, $0, $2
+	jr $25
+	nop
 1:	sw $2, 0($4)
 	sw $3, 4($4)
 	move $2, $0
