[Glibc-bsd-commits] r1572 - in trunk/glibc-2.3-head: . linuxthreads/kfreebsd/i386 sysdeps/kfreebsd/i386

Petr Salinger ps-guest at costa.debian.org
Mon May 22 08:21:22 UTC 2006


Author: ps-guest
Date: 2006-05-22 08:21:22 +0000 (Mon, 22 May 2006)
New Revision: 1572

Added:
   trunk/glibc-2.3-head/glibc24-cfi-sysdeps.diff
Modified:
   trunk/glibc-2.3-head/NOTES-2.4
   trunk/glibc-2.3-head/linuxthreads/kfreebsd/i386/sysdep-cancel.h
   trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/rfork.S
   trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/start_thread.S
   trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/syscall.S
   trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/sysdep.h
   trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/vfork.S
Log:
* disable cfi marking for i386
  for 2.4.x it is mandatory everywhere
  for amd64/2.3.x it is (at least) allowed, but
  for i386/2.3.x it is not allowed (missing basic cfi marking in main $src/sysdeps/i386/sysdep.h)
  


Modified: trunk/glibc-2.3-head/NOTES-2.4
===================================================================
--- trunk/glibc-2.3-head/NOTES-2.4	2006-05-21 19:58:02 UTC (rev 1571)
+++ trunk/glibc-2.3-head/NOTES-2.4	2006-05-22 08:21:22 UTC (rev 1572)
@@ -51,6 +51,8 @@
 	i386/sysdep.h - drop definition of SETUP_PIC_REG(reg)
 	dl-osinfo.h - add function _dl_setup_stack_chk_guard()
 
+* enable mandatory cfi marking 
+	see glibc24-cfi-sysdeps.diff 
 
 ../src/configure --enable-add-ons=linuxthreads --with-tls --with-__thread i486-kfreebsd --prefix=...
 

Added: trunk/glibc-2.3-head/glibc24-cfi-sysdeps.diff
===================================================================
--- trunk/glibc-2.3-head/glibc24-cfi-sysdeps.diff	2006-05-21 19:58:02 UTC (rev 1571)
+++ trunk/glibc-2.3-head/glibc24-cfi-sysdeps.diff	2006-05-22 08:21:22 UTC (rev 1572)
@@ -0,0 +1,144 @@
+ patch to kfreebsd sysdeps to enable cfi for glibc 2.4 snapshot
+ see also NOTES-2.4
+
+
+Index: linuxthreads/kfreebsd/i386/sysdep-cancel.h
+===================================================================
+--- linuxthreads/kfreebsd/i386/sysdep-cancel.h	(revision 1568)
++++ linuxthreads/kfreebsd/i386/sysdep-cancel.h	(revision 1570)
+@@ -61,12 +61,13 @@
+ 	fork()
+ 	vfork()
+ 	rfork()
++	pipe()
+    
+    none of them is cancelable, therefore
+ */
+ 
+-# define PUSHRESULT	pushl %eax; pushfl
+-# define POPRESULT	popfl; popl %eax
++# define PUSHRESULT	pushl %eax; cfi_adjust_cfa_offset (4);  pushfl;    cfi_adjust_cfa_offset (4)
++# define POPRESULT	popfl;      cfi_adjust_cfa_offset (-4); popl %eax; cfi_adjust_cfa_offset (-4)
+ 
+ # ifdef IS_IN_libpthread
+ #  define CENABLE	call __pthread_enable_asynccancel;
+@@ -74,15 +75,23 @@
+ # elif defined IS_IN_librt
+ #  ifdef PIC
+ #   define CENABLE	pushl %ebx; \
++			cfi_adjust_cfa_offset (4); \
++			cfi_rel_offset (ebx, 0); \
+ 			call __i686.get_pc_thunk.bx; \
+ 			addl     $_GLOBAL_OFFSET_TABLE_, %ebx; \
+ 			call __librt_enable_asynccancel at PLT; \
+-			popl %ebx;
++			popl %ebx; \
++			cfi_adjust_cfa_offset (-4); \
++			cfi_restore (ebx);
+ #   define CDISABLE	pushl %ebx; \
++			cfi_adjust_cfa_offset (4); \
++			cfi_rel_offset (ebx, 0); \
+ 			call __i686.get_pc_thunk.bx; \
+ 			addl     $_GLOBAL_OFFSET_TABLE_, %ebx; \
+ 			call __librt_disable_asynccancel at PLT; \
+-			popl %ebx;
++			popl %ebx; \
++			cfi_adjust_cfa_offset (-4); \
++			cfi_restore (ebx);
+ #  else
+ #   define CENABLE	call __librt_enable_asynccancel;
+ #   define CDISABLE	call __librt_disable_asynccancel
+Index: sysdeps/kfreebsd/i386/rfork.S
+===================================================================
+--- sysdeps/kfreebsd/i386/rfork.S	(revision 1568)
++++ sysdeps/kfreebsd/i386/rfork.S	(revision 1570)
+@@ -33,6 +33,7 @@
+ 	andl %edx, %eax
+ 
+ 	popl %edx
++	cfi_adjust_cfa_offset(-4)
+ 	jmp  *%ecx
+ 
+ L(pseudo_end):
+Index: sysdeps/kfreebsd/i386/start_thread.S
+===================================================================
+--- sysdeps/kfreebsd/i386/start_thread.S	(revision 1568)
++++ sysdeps/kfreebsd/i386/start_thread.S	(revision 1570)
+@@ -28,6 +28,10 @@
+ 
+ 	.text
+ ENTRY (__start_thread)
++	/* End FDE now, because in the child the unwind info will be
++	   wrong.  */
++	cfi_endproc
++
+ 	/* There is a window of a few instructions, right after the rfork
+ 	   system call, where the handling of a signal would write garbage
+ 	   into the stack shared by the parent and the child (assuming
+@@ -199,4 +203,5 @@
+ 	popl	%ebx
+ 	popl	%ebp
+ 	jmp	SYSCALL_ERROR_LABEL
++	cfi_startproc
+ PSEUDO_END (__start_thread)
+Index: sysdeps/kfreebsd/i386/vfork.S
+===================================================================
+--- sysdeps/kfreebsd/i386/vfork.S	(revision 1568)
++++ sysdeps/kfreebsd/i386/vfork.S	(revision 1570)
+@@ -27,6 +27,7 @@
+ 
+ 	/* Pop the return PC value into ECX.  */
+ 	popl	%ecx
++	cfi_adjust_cfa_offset(-4)
+ 
+ 	/* Perform the system call.  */
+ 	DO_CALL (vfork, 0)
+@@ -45,6 +46,7 @@
+ L(error):
+ 	/* Push back the return PC.  */
+ 	pushl	%ecx
++	cfi_adjust_cfa_offset(4)
+ 
+ 	/* Branch to the error handler, hidden in PSEUDO_END.  */
+ 	jmp	SYSCALL_ERROR_LABEL
+Index: sysdeps/kfreebsd/i386/sysdep.h
+===================================================================
+--- sysdeps/kfreebsd/i386/sysdep.h	(revision 1568)
++++ sysdeps/kfreebsd/i386/sysdep.h	(revision 1570)
+@@ -136,14 +136,20 @@
+ #  else
+ #   define SYSCALL_ERROR_HANDLER					      \
+ 0:pushl %ebx;								      \
++  cfi_adjust_cfa_offset (4);                                                  \
++  cfi_rel_offset (ebx, 0);                                                    \
+   SETUP_PIC_REG (bx);							      \
+   addl $_GLOBAL_OFFSET_TABLE_, %ebx;					      \
+   pushl %eax;								      \
++  cfi_adjust_cfa_offset (4);                                                  \
+   PUSH_ERRNO_LOCATION_RETURN;						      \
+   call BP_SYM (__errno_location)@PLT;					      \
+   POP_ERRNO_LOCATION_RETURN;						      \
+   popl %ecx;								      \
++  cfi_adjust_cfa_offset (-4);                                                 \
+   popl %ebx;								      \
++  cfi_adjust_cfa_offset (-4);                                                 \
++  cfi_restore (ebx);                                                          \
+   movl %ecx, (%eax);							      \
+   orl $-1, %eax;							      \
+   jmp L(pseudo_end);
+Index: sysdeps/kfreebsd/i386/syscall.S
+===================================================================
+--- sysdeps/kfreebsd/i386/syscall.S	(revision 1568)
++++ sysdeps/kfreebsd/i386/syscall.S	(revision 1570)
+@@ -21,9 +21,11 @@
+ 	  .text;
+ ENTRY (syscall)
+ 	popl %ecx		/* Pop return address into %ecx.  */
++	cfi_adjust_cfa_offset (-4)
+ 	movl 0(%esp), %eax	/* Load syscall number into %eax. */
+ 	int $0x80		/* Do the system call.  */
+ 	pushl %ecx		/* Push back return address.  */
++	cfi_adjust_cfa_offset (4)
+ 	jb SYSCALL_ERROR_LABEL;	/* Jump to error handler if error.  */
+ 
+ L(pseudo_end):

Modified: trunk/glibc-2.3-head/linuxthreads/kfreebsd/i386/sysdep-cancel.h
===================================================================
--- trunk/glibc-2.3-head/linuxthreads/kfreebsd/i386/sysdep-cancel.h	2006-05-21 19:58:02 UTC (rev 1571)
+++ trunk/glibc-2.3-head/linuxthreads/kfreebsd/i386/sysdep-cancel.h	2006-05-22 08:21:22 UTC (rev 1572)
@@ -61,13 +61,12 @@
 	fork()
 	vfork()
 	rfork()
-	pipe()
    
    none of them is cancelable, therefore
 */
 
-# define PUSHRESULT	pushl %eax; cfi_adjust_cfa_offset (4);  pushfl;    cfi_adjust_cfa_offset (4)
-# define POPRESULT	popfl;      cfi_adjust_cfa_offset (-4); popl %eax; cfi_adjust_cfa_offset (-4)
+# define PUSHRESULT	pushl %eax; pushfl
+# define POPRESULT	popfl; popl %eax
 
 # ifdef IS_IN_libpthread
 #  define CENABLE	call __pthread_enable_asynccancel;
@@ -75,23 +74,15 @@
 # elif defined IS_IN_librt
 #  ifdef PIC
 #   define CENABLE	pushl %ebx; \
-			cfi_adjust_cfa_offset (4); \
-			cfi_rel_offset (ebx, 0); \
 			call __i686.get_pc_thunk.bx; \
 			addl     $_GLOBAL_OFFSET_TABLE_, %ebx; \
 			call __librt_enable_asynccancel at PLT; \
-			popl %ebx; \
-			cfi_adjust_cfa_offset (-4); \
-			cfi_restore (ebx);
+			popl %ebx;
 #   define CDISABLE	pushl %ebx; \
-			cfi_adjust_cfa_offset (4); \
-			cfi_rel_offset (ebx, 0); \
 			call __i686.get_pc_thunk.bx; \
 			addl     $_GLOBAL_OFFSET_TABLE_, %ebx; \
 			call __librt_disable_asynccancel at PLT; \
-			popl %ebx; \
-			cfi_adjust_cfa_offset (-4); \
-			cfi_restore (ebx);
+			popl %ebx;
 #  else
 #   define CENABLE	call __librt_enable_asynccancel;
 #   define CDISABLE	call __librt_disable_asynccancel

Modified: trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/rfork.S
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/rfork.S	2006-05-21 19:58:02 UTC (rev 1571)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/rfork.S	2006-05-22 08:21:22 UTC (rev 1572)
@@ -33,7 +33,6 @@
 	andl %edx, %eax
 
 	popl %edx
-	cfi_adjust_cfa_offset(-4)
 	jmp  *%ecx
 
 L(pseudo_end):

Modified: trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/start_thread.S
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/start_thread.S	2006-05-21 19:58:02 UTC (rev 1571)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/start_thread.S	2006-05-22 08:21:22 UTC (rev 1572)
@@ -28,10 +28,6 @@
 
 	.text
 ENTRY (__start_thread)
-	/* End FDE now, because in the child the unwind info will be
-	   wrong.  */
-	cfi_endproc
-
 	/* There is a window of a few instructions, right after the rfork
 	   system call, where the handling of a signal would write garbage
 	   into the stack shared by the parent and the child (assuming
@@ -203,5 +199,4 @@
 	popl	%ebx
 	popl	%ebp
 	jmp	SYSCALL_ERROR_LABEL
-	cfi_startproc
 PSEUDO_END (__start_thread)

Modified: trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/syscall.S
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/syscall.S	2006-05-21 19:58:02 UTC (rev 1571)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/syscall.S	2006-05-22 08:21:22 UTC (rev 1572)
@@ -21,11 +21,9 @@
 	  .text;
 ENTRY (syscall)
 	popl %ecx		/* Pop return address into %ecx.  */
-	cfi_adjust_cfa_offset (-4)
 	movl 0(%esp), %eax	/* Load syscall number into %eax. */
 	int $0x80		/* Do the system call.  */
 	pushl %ecx		/* Push back return address.  */
-	cfi_adjust_cfa_offset (4)
 	jb SYSCALL_ERROR_LABEL;	/* Jump to error handler if error.  */
 
 L(pseudo_end):

Modified: trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/sysdep.h
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/sysdep.h	2006-05-21 19:58:02 UTC (rev 1571)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/sysdep.h	2006-05-22 08:21:22 UTC (rev 1572)
@@ -136,20 +136,14 @@
 #  else
 #   define SYSCALL_ERROR_HANDLER					      \
 0:pushl %ebx;								      \
-  cfi_adjust_cfa_offset (4);                                                  \
-  cfi_rel_offset (ebx, 0);                                                    \
   SETUP_PIC_REG (bx);							      \
   addl $_GLOBAL_OFFSET_TABLE_, %ebx;					      \
   pushl %eax;								      \
-  cfi_adjust_cfa_offset (4);                                                  \
   PUSH_ERRNO_LOCATION_RETURN;						      \
   call BP_SYM (__errno_location)@PLT;					      \
   POP_ERRNO_LOCATION_RETURN;						      \
   popl %ecx;								      \
-  cfi_adjust_cfa_offset (-4);                                                 \
   popl %ebx;								      \
-  cfi_adjust_cfa_offset (-4);                                                 \
-  cfi_restore (ebx);                                                          \
   movl %ecx, (%eax);							      \
   orl $-1, %eax;							      \
   jmp L(pseudo_end);

Modified: trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/vfork.S
===================================================================
--- trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/vfork.S	2006-05-21 19:58:02 UTC (rev 1571)
+++ trunk/glibc-2.3-head/sysdeps/kfreebsd/i386/vfork.S	2006-05-22 08:21:22 UTC (rev 1572)
@@ -27,7 +27,6 @@
 
 	/* Pop the return PC value into ECX.  */
 	popl	%ecx
-	cfi_adjust_cfa_offset(-4)
 
 	/* Perform the system call.  */
 	DO_CALL (vfork, 0)
@@ -46,7 +45,6 @@
 L(error):
 	/* Push back the return PC.  */
 	pushl	%ecx
-	cfi_adjust_cfa_offset(4)
 
 	/* Branch to the error handler, hidden in PSEUDO_END.  */
 	jmp	SYSCALL_ERROR_LABEL




More information about the Glibc-bsd-commits mailing list