Blob Blame Raw
diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index ded5471..7d28496 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -140,7 +140,7 @@ _dl_tlsdesc_undefweak:
 	cfi_startproc
 	.align 2
 _dl_tlsdesc_dynamic:
-# define NSAVEXREGPAIRS 2
+# define NSAVEXREGPAIRS 3
 	stp	x29, x30, [sp,#-(32+16*NSAVEXREGPAIRS)]!
 	cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
 	mov	x29, sp
@@ -151,6 +151,10 @@ _dl_tlsdesc_dynamic:
 	stp	x1,  x2, [sp, #32+16*0]
 	stp	x3,  x4, [sp, #32+16*1]
 
+	/* Work around GCC rescheduling compares across tlsdesc calls.  */
+	mrs	x30, nzcv
+	stp	xzr, x30, [sp, #32+16*2]
+
 	mrs	x4, tpidr_el0
 	ldr	x1, [x0,#8]
 	ldr	x0, [x4]
@@ -169,6 +173,8 @@ _dl_tlsdesc_dynamic:
 1:
 	ldp	 x1,  x2, [sp, #32+16*0]
 	ldp	 x3,  x4, [sp, #32+16*1]
+	ldp	 xzr, x30, [sp, #32+16*2]
+	msr	 nzcv, x30
 
 	ldp	x29, x30, [sp], #(32+16*NSAVEXREGPAIRS)
 	cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)