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: socket syscall stub infrastructure


Hello!

This patch adds CFI statements to the socket syscall stub infrastructure.
This patch should *not* be committed -- I noticed that this file is not
used at all for EABI NPTL glibc configurations only after having amended
it already, unfortunately.  Thus, I'm posting it only (unverified,
untested) in case that it's helpful for someone else.


diff --git a/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/socket.S b/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/socket.S
index 22d0c1a..0388395 100644
--- a/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/socket.S
+++ b/glibc-ports-mainline/sysdeps/unix/sysv/linux/arm/socket.S
@@ -41,19 +41,41 @@
 # endif
 #endif
 
-#define PUSHARGS_1	str a1, [sp, $-4]!
-#define PUSHARGS_2	stmfd sp!, {a1, a2}
-#define PUSHARGS_3	stmfd sp!, {a1, a2, a3}
-#define PUSHARGS_4	stmfd sp!, {a1, a2, a3, a4}
-#define PUSHARGS_5	stmfd sp!, {a1, a2, a3, a4}	/* Caller has already pushed arg 5 */
-#define PUSHARGS_6	stmfd sp!, {a1, a2, a3, a4}
-
-#define POPARGS_1	add sp, sp, #4
-#define POPARGS_2	add sp, sp, #8
-#define POPARGS_3	add sp, sp, #12
-#define POPARGS_4	add sp, sp, #16
-#define POPARGS_5	add sp, sp, #16
-#define POPARGS_6	add sp, sp, #16
+#define PUSHARGS_1 \
+  str a1, [sp, $-4]!; \
+  cfi_adjust_cfa_offset (4)
+#define PUSHARGS_2 \
+  stmfd sp!, {a1, a2}; \
+  cfi_adjust_cfa_offset (8)
+#define PUSHARGS_3 \
+  stmfd sp!, {a1, a2, a3}; \
+  cfi_adjust_cfa_offset (12)
+#define PUSHARGS_4 \
+  stmfd sp!, {a1, a2, a3, a4}; \
+  cfi_adjust_cfa_offset (16)
+#define PUSHARGS_5 \
+  /* Caller has already pushed arg 5.  */
+  PUSHARGS_4
+#define PUSHARGS_6 \
+  /* Caller has already pushed args 5, 6.  */
+  PUSHARGS_4
+
+#define POPARGS_1 \
+  add sp, sp, #4; \
+  cfi_adjust_cfa_offset (-4)
+#define POPARGS_2 \
+  add sp, sp, #8; \
+  cfi_adjust_cfa_offset (-8)
+#define POPARGS_3 \
+  add sp, sp, #12; \
+  cfi_adjust_cfa_offset (-12)
+#define POPARGS_4 \
+  add sp, sp, #16; \
+  cfi_adjust_cfa_offset (-16)
+#define POPARGS_5 \
+  POPARGS_4
+#define POPARGS_6 \
+  POPARGS_4
 
 #ifndef NARGS
 #define NARGS 3			/* If we were called with no wrapper, this is really socket() */
@@ -81,6 +103,7 @@ ENTRY (__socket)
 #if defined NEED_CANCELLATION && defined CENABLE
 	SINGLE_THREAD_P
 	bne 1f
+	cfi_remember_state
 #endif
 
         /* Do the system call trap.  */
@@ -97,8 +120,12 @@ ENTRY (__socket)
 	b PLTJMP(SYSCALL_ERROR)
 
 #if defined NEED_CANCELLATION && defined CENABLE
+	cfi_restore_state
 1:
 	str lr, [sp, #-4]!
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (lr, 0)
+
 	CENABLE
 	mov ip, r0
 
@@ -107,10 +134,14 @@ ENTRY (__socket)
 	swi SYS_ify(socketcall)
 
 	str r0, [sp, #-4]!
+	cfi_adjust_cfa_offset (4)
 	mov r0, ip
 	CDISABLE
 	ldr r0, [sp], #4
+	cfi_adjust_cfa_offset (-4)
 	ldr lr, [sp], #4
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (lr)
 
 	P(POPARGS_,NARGS)
 


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]