[RFC PATCH] Add cfi directives to i486 pthread_* and sem_post
Paul Pluzhnikov
ppluzhnikov@google.com
Tue May 27 17:30:00 GMT 2008
On Mon, May 26, 2008 at 11:00 PM, Ulrich Drepper <drepper@redhat.com> wrote:
> The changes were OK but
Thanks. Here is a resend with all problems fixed.
--
Paul Pluzhnikov
2008-05-23 Paul Pluzhnikov <ppluzhnikov@google.com>
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S:
Add cfi directives.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S:
Likewise.
Index: nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S,v
retrieving revision 1.14
diff -u -p -u -r1.14 pthread_barrier_wait.S
--- nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S 1 Aug 2007 04:30:20 -0000 1.14
+++ nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S 23 May 2008 19:22:29 -0000
@@ -27,7 +27,10 @@
.type pthread_barrier_wait,@function
.align 16
pthread_barrier_wait:
+ cfi_startproc
pushl %ebx
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%ebx, -8)
movl 8(%esp), %ebx
@@ -45,6 +48,8 @@ pthread_barrier_wait:
/* There are more threads to come. */
pushl %esi
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%esi, -12)
#if CURR_EVENT == 0
movl (%ebx), %edx
@@ -101,9 +106,16 @@ pthread_barrier_wait:
10: movl %esi, %eax /* != PTHREAD_BARRIER_SERIAL_THREAD */
popl %esi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%esi)
popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
ret
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%ebx, -8)
+
/* The necessary number of threads arrived. */
3:
#if CURR_EVENT == 0
@@ -140,8 +152,12 @@ pthread_barrier_wait:
5: orl $-1, %eax /* == PTHREAD_BARRIER_SERIAL_THREAD */
popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
ret
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%ebx, -8)
1: movl PRIVATE(%ebx), %ecx
leal MUTEX(%ebx), %edx
xorl $LLL_SHARED, %ecx
@@ -154,6 +170,8 @@ pthread_barrier_wait:
call __lll_unlock_wake
jmp 5b
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%esi, -12)
6: movl PRIVATE(%ebx), %ecx
leal MUTEX(%ebx), %eax
xorl $LLL_SHARED, %ecx
@@ -165,4 +183,5 @@ pthread_barrier_wait:
xorl $LLL_SHARED, %ecx
call __lll_unlock_wake
jmp 10b
+ cfi_endproc
.size pthread_barrier_wait,.-pthread_barrier_wait
Index: nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S,v
retrieving revision 1.16
diff -u -p -u -r1.16 pthread_cond_broadcast.S
--- nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S 14 Aug 2007 02:26:09 -0000 1.16
+++ nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S 23 May 2008 19:22:29 -0000
@@ -32,11 +32,19 @@
.type __pthread_cond_broadcast, @function
.align 16
__pthread_cond_broadcast:
-
+ cfi_startproc
pushl %ebx
+ cfi_adjust_cfa_offset(4)
pushl %esi
+ cfi_adjust_cfa_offset(4)
pushl %edi
+ cfi_adjust_cfa_offset(4)
pushl %ebp
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%ebx, -8)
+ cfi_offset(%esi, -12)
+ cfi_offset(%edi, -16)
+ cfi_offset(%ebp, -20)
movl 20(%esp), %ebx
@@ -114,11 +122,24 @@ __pthread_cond_broadcast:
10: xorl %eax, %eax
popl %ebp
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebp)
popl %edi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%edi)
popl %esi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%esi)
popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
ret
+ cfi_adjust_cfa_offset(16)
+ cfi_offset(%ebx, -8)
+ cfi_offset(%esi, -12)
+ cfi_offset(%edi, -16)
+ cfi_offset(%ebp, -20)
.align 16
/* Unlock. */
4: LOCK
@@ -127,11 +148,24 @@ __pthread_cond_broadcast:
6: xorl %eax, %eax
popl %ebp
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebp)
popl %edi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%edi)
popl %esi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%esi)
popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
ret
+ cfi_adjust_cfa_offset(16)
+ cfi_offset(%ebx, -8)
+ cfi_offset(%esi, -12)
+ cfi_offset(%edi, -16)
+ cfi_offset(%ebp, -20)
/* Initial locking failed. */
1:
#if cond_lock == 0
@@ -199,6 +233,7 @@ __pthread_cond_broadcast:
movl $SYS_futex, %eax
ENTER_KERNEL
jmp 10b
+ cfi_endproc
.size __pthread_cond_broadcast, .-__pthread_cond_broadcast
versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
GLIBC_2_3_2)
Index: nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S,v
retrieving revision 1.17
diff -u -p -u -r1.17 pthread_cond_signal.S
--- nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S 14 Aug 2007 02:26:35 -0000 1.17
+++ nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S 23 May 2008 19:22:29 -0000
@@ -33,8 +33,13 @@
.align 16
__pthread_cond_signal:
+ cfi_startproc
pushl %ebx
+ cfi_adjust_cfa_offset(4)
pushl %edi
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%ebx, -8)
+ cfi_offset(%edi, -12)
movl 12(%esp), %edi
@@ -69,7 +74,12 @@ __pthread_cond_signal:
/* Wake up one thread. */
pushl %esi
+ cfi_adjust_cfa_offset(4)
pushl %ebp
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%esi, -16)
+ cfi_offset(%ebp, -20)
+
#if FUTEX_PRIVATE_FLAG > 255
xorl %ecx, %ecx
#endif
@@ -91,7 +101,11 @@ __pthread_cond_signal:
ENTER_KERNEL */
int $0x80
popl %ebp
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebp)
popl %esi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%esi)
/* For any kind of error, we try again with WAKE.
The general test also covers running on old kernels. */
@@ -100,8 +114,16 @@ __pthread_cond_signal:
6: xorl %eax, %eax
popl %edi
- popl %ebx
- ret
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%edi)
+ popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
+ ret
+
+ cfi_adjust_cfa_offset(8)
+ cfi_offset(%ebx, -8)
+ cfi_offset(%edi, -12)
7: /* %ecx should be either FUTEX_WAKE_OP or
FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG from the previous syscall. */
@@ -152,6 +174,7 @@ __pthread_cond_signal:
call __lll_lock_wait
jmp 2b
+ cfi_endproc
.size __pthread_cond_signal, .-__pthread_cond_signal
versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
GLIBC_2_3_2)
Index: nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S,v
retrieving revision 1.16
diff -u -p -u -r1.16 pthread_rwlock_rdlock.S
--- nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S 11 May 2008 05:40:33 -0000 1.16
+++ nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S 23 May 2008 19:22:29 -0000
@@ -30,8 +30,13 @@
.type __pthread_rwlock_rdlock,@function
.align 16
__pthread_rwlock_rdlock:
+ cfi_startproc
pushl %esi
+ cfi_adjust_cfa_offset(4)
pushl %ebx
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%esi, -8)
+ cfi_offset(%ebx, -12)
xorl %esi, %esi
movl 12(%esp), %ebx
@@ -113,9 +118,16 @@ __pthread_rwlock_rdlock:
movl %edx, %eax
popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
popl %esi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%esi)
ret
+ cfi_adjust_cfa_offset(8)
+ cfi_offset(%esi, -8)
+ cfi_offset(%ebx, -12)
1:
#if MUTEX == 0
movl %ebx, %edx
@@ -171,6 +183,7 @@ __pthread_rwlock_rdlock:
movzbl PSHARED(%ebx), %ecx
call __lll_lock_wait
jmp 13b
+ cfi_endproc
.size __pthread_rwlock_rdlock,.-__pthread_rwlock_rdlock
.globl pthread_rwlock_rdlock
Index: nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S,v
retrieving revision 1.14
diff -u -p -u -r1.14 pthread_rwlock_unlock.S
--- nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S 11 May 2008 05:40:33 -0000 1.14
+++ nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S 23 May 2008 19:22:29 -0000
@@ -29,8 +29,13 @@
.type __pthread_rwlock_unlock,@function
.align 16
__pthread_rwlock_unlock:
+ cfi_startproc
pushl %ebx
+ cfi_adjust_cfa_offset(4)
pushl %edi
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%ebx, -8)
+ cfi_offset(%edi, -12)
movl 12(%esp), %edi
@@ -87,9 +92,16 @@ __pthread_rwlock_unlock:
xorl %eax, %eax
popl %edi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%edi)
popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
ret
+ cfi_adjust_cfa_offset(8)
+ cfi_offset(%ebx, -8)
+ cfi_offset(%edi, -12)
.align 16
6: LOCK
#if MUTEX == 0
@@ -133,7 +145,7 @@ __pthread_rwlock_unlock:
movzbl PSHARED(%edi), %ecx
call __lll_unlock_wake
jmp 8b
-
+ cfi_endproc
.size __pthread_rwlock_unlock,.-__pthread_rwlock_unlock
.globl pthread_rwlock_unlock
Index: nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S,v
retrieving revision 1.16
diff -u -p -u -r1.16 pthread_rwlock_wrlock.S
--- nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S 11 May 2008 05:40:33 -0000 1.16
+++ nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S 23 May 2008 19:22:29 -0000
@@ -30,8 +30,13 @@
.type __pthread_rwlock_wrlock,@function
.align 16
__pthread_rwlock_wrlock:
+ cfi_startproc
pushl %esi
+ cfi_adjust_cfa_offset(4)
pushl %ebx
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%esi, -8)
+ cfi_offset(%ebx, -12)
xorl %esi, %esi
movl 12(%esp), %ebx
@@ -111,9 +116,16 @@ __pthread_rwlock_wrlock:
movl %edx, %eax
popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
popl %esi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%esi)
ret
+ cfi_adjust_cfa_offset(8)
+ cfi_offset(%esi, -8)
+ cfi_offset(%ebx, -12)
1:
#if MUTEX == 0
movl %ebx, %edx
@@ -162,6 +174,7 @@ __pthread_rwlock_wrlock:
movzbl PSHARED(%ebx), %ecx
call __lll_lock_wait
jmp 13b
+ cfi_endproc
.size __pthread_rwlock_wrlock,.-__pthread_rwlock_wrlock
.globl pthread_rwlock_wrlock
Index: nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
===================================================================
RCS file: /cvs/glibc/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S,v
retrieving revision 1.14
diff -u -p -u -r1.14 sem_post.S
--- nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S 10 Jan 2008 18:34:30 -0000 1.14
+++ nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S 23 May 2008 19:22:29 -0000
@@ -30,7 +30,10 @@
.type __new_sem_post,@function
.align 16
__new_sem_post:
+ cfi_startproc
pushl %ebx
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%ebx, -8)
movl 8(%esp), %ebx
@@ -64,8 +67,12 @@ __new_sem_post:
2: xorl %eax, %eax
popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
ret
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%ebx, -8)
1:
#ifdef PIC
call __i686.get_pc_thunk.bx
@@ -116,14 +123,20 @@ __new_sem_post:
orl $-1, %eax
popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
ret
+ cfi_endproc
.size __new_sem_post,.-__new_sem_post
versioned_symbol(libpthread, __new_sem_post, sem_post, GLIBC_2_1)
#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
.global __old_sem_post
.type __old_sem_post,@function
__old_sem_post:
+ cfi_startproc
pushl %ebx
+ cfi_adjust_cfa_offset(4)
+ cfi_offset(%ebx, -8)
movl 8(%esp), %ebx
LOCK
@@ -139,7 +152,10 @@ __old_sem_post:
xorl %eax, %eax
popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
ret
+ cfi_endproc
.size __old_sem_post,.-__old_sem_post
compat_symbol(libpthread, __old_sem_post, sem_post, GLIBC_2_0)
#endif
More information about the Libc-alpha
mailing list