This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Adding CFI statements to ARM's assembly code: longjmp family


Hello!

On 2009-12-31 16:57, Joseph S. Myers wrote:
> sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S

Also: sysdeps/arm/eabi/__longjmp.S


2010-01-11  Thomas Schwinge  <thomas@codesourcery.com>

	* sysdeps/arm/eabi/__longjmp.S (__longjmp): Add CFI statements.
	* sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S (CALL_FAIL)
	(CHECK_SP): Likewise

diff --git a/glibc-ports-mainline/sysdeps/arm/eabi/__longjmp.S b/glibc-ports-mainline/sysdeps/arm/eabi/__longjmp.S
index 3059193..edabdad 100644
--- a/glibc-ports-mainline/sysdeps/arm/eabi/__longjmp.S
+++ b/glibc-ports-mainline/sysdeps/arm/eabi/__longjmp.S
@@ -1,5 +1,6 @@
 /* longjmp for ARM.
-   Copyright (C) 1997, 1998, 2005, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2005, 2006, 2009, 2010
+     Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,10 +32,21 @@ ENTRY (__longjmp)
 	moveq	r0, #1		/* can't let setjmp() return zero! */
 
 #ifdef CHECK_SP
-	ldr	r4, [ip, #32]
+	ldr	r4, [ip, #32]	/* jmpbuf's sp */
+	cfi_undefined (r4)
 	CHECK_SP (r4)
 #endif
 	LOADREGS(ia, ip!, {v1-v6, sl, fp, sp, lr})
+	cfi_restore (v1)
+	cfi_restore (v2)
+	cfi_restore (v3)
+	cfi_restore (v4)
+	cfi_restore (v5)
+	cfi_restore (v6)
+	cfi_restore (sl)
+	cfi_restore (fp)
+	cfi_restore (sp)
+	cfi_restore (lr)
 
 #ifdef IS_IN_rtld
   	ldr	a2, 1f
diff --git a/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S b/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S
index f92a382..423e777 100644
--- a/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S
+++ b/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/eabi/____longjmp_chk.S
@@ -30,6 +30,7 @@ longjmp_msg:
 #ifdef PIC
 # define CALL_FAIL						\
 	ldr	sl, .L_GOT;					\
+	cfi_undefined (sl);					\
 .L_GOT_OFF:							\
 	add	sl, pc, sl;					\
 	ldr	r0, .Lstr;					\
@@ -48,12 +49,17 @@ longjmp_msg:
 #endif
 
 #define CHECK_SP(reg)				\
+	cfi_remember_state;			\
 	cmp	sp, reg;			\
 	bls	.Lok;				\
 	mov	r5, r0;				\
+	cfi_undefined (r5);			\
 	mov	r7, #SYS_ify(sigaltstack);	\
+	cfi_undefined (r7);			\
 	mov	r0, #0;				\
-	sub	sp, sp, #16;			\
+	sub	sp, sp, #16; /* >= sizeof (stack_t) */ \
+	cfi_adjust_cfa_offset (16);		\
+	cfi_remember_state;			\
 	mov	r1, sp;				\
 	swi	#0;				\
 	cmp	r0, #0;				\
@@ -69,8 +75,10 @@ longjmp_msg:
 	bhi	.Lok2;				\
 .Lfail:						\
 	CALL_FAIL				\
+	cfi_restore_state;			\
 .Lok2:						\
 	mov	r0, r5;				\
+	cfi_restore_state;			\
 .Lok:
 
 #include <__longjmp.S>


I did not touch sysdeps/arm/__longjmp.S, sysdeps/arm/fpu/__longjmp.S,
sysdeps/unix/sysv/linux/arm/____longjmp_chk.S.


Regards,
 Thomas

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]