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: clone


Hello!

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

> clone is the trickiest case.  From other architectures, I think you want 
> to call cfi_endproc immediately after the syscall because the correct CFI 
> will be different in the parent and in the child.

I agree to put it *after* the syscall instruction -- do you have an idea
why i386 / x86_64 put it *before*?

> At the start of code 
> for the child, you can then call cfi_startproc again and mark lr as 
> undefined with cfi_undefined; backtraces in a new thread should not go 
> back before clone.

Right, that's how I planned to do it -- now successfully tested.


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

	* sysdeps/unix/sysv/linux/arm/clone.S (__clone): Add CFI statements.

diff --git a/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/clone.S b/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/clone.S
index 1a19f5b..178b0f1 100644
--- a/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/clone.S
+++ b/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/clone.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2002, 2005, 2008, 2009
+/* Copyright (C) 1996, 1997, 1998, 1999, 2002, 2005, 2008, 2009, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Pat Beirne <patb@corelcomputer.com>
@@ -52,8 +52,13 @@ ENTRY(__clone)
 	@ new sp is already in r1
 #ifdef __ARM_EABI__
 	stmfd	sp!, {r4, r7}
+	cfi_adjust_cfa_offset (8)
+	cfi_rel_offset (r4, 0)
+	cfi_rel_offset (r7, 4)
 #else
 	str	r4, [sp, #-8]!
+	cfi_adjust_cfa_offset (8)
+	cfi_rel_offset (r4, 0)
 #endif
 	ldr	r2, [sp, #8]
 	ldr	r3, [sp, #12]
@@ -64,6 +69,7 @@ ENTRY(__clone)
 #else
 	swi	SYS_ify(clone)
 #endif
+	cfi_endproc
 	cmp	r0, #0
 	beq	1f
 #ifdef __ARM_EABI__
@@ -74,6 +80,8 @@ ENTRY(__clone)
 	blt	PLTJMP(C_SYMBOL_NAME(__syscall_error))
 	RETINSTR(, lr)
 
+	cfi_startproc
+	cfi_undefined (lr)
 1:
 #ifdef RESET_PID
 	tst	ip, #CLONE_THREAD


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]