Use ENTRY/END in sysdeps/x86_64/nptl/pthread_spin*.S
Commit Message
Greetings,
Currently, x86_64 pthread_spin_{lock,unlock,trylock} lack unwind
descriptors, which causes tools like GDB and libunwind to guess how to
unwind from them. Libunwind happens to guess incorrectly, leading to
either bad stack trace, or a crash.
Attached patch fixes this. Tested on Linux/x86_64. Ok for trunk?
P.S. I'd like to excise other instances of functions that lack unwind
descriptors in a follow-up patch, if that's ok.
2016-01-18 Paul Pluzhnikov <ppluzhnikov@google.com>
* sysdeps/x86_64/nptl/pthread_spin_lock.S (pthread_spin_lock):
Use ENTRY/END
* sysdeps/x86_64/nptl/pthread_spin_trylock.S
(pthread_spin_trylock): Likewise
* sysdeps/x86_64/nptl/pthread_spin_unlock.S
(pthread_spin_unlock): Likewise
Comments
On 01/18/2016 04:11 PM, Paul Pluzhnikov wrote:
> Greetings,
>
> Currently, x86_64 pthread_spin_{lock,unlock,trylock} lack unwind
> descriptors, which causes tools like GDB and libunwind to guess how to
> unwind from them. Libunwind happens to guess incorrectly, leading to
> either bad stack trace, or a crash.
>
> Attached patch fixes this. Tested on Linux/x86_64. Ok for trunk?
>
> P.S. I'd like to excise other instances of functions that lack unwind
> descriptors in a follow-up patch, if that's ok.
>
> 2016-01-18 Paul Pluzhnikov <ppluzhnikov@google.com>
>
> * sysdeps/x86_64/nptl/pthread_spin_lock.S (pthread_spin_lock):
> Use ENTRY/END
> * sysdeps/x86_64/nptl/pthread_spin_trylock.S
> (pthread_spin_trylock): Likewise
> * sysdeps/x86_64/nptl/pthread_spin_unlock.S
> (pthread_spin_unlock): Likewise
>
Modulo your broken mail client wrapping the Changelog this looks good to me.
It needs a public bug though.
Cheers,
Carlos.
On Mon, Jan 18, 2016 at 2:18 PM, Carlos O'Donell <carlos@redhat.com> wrote:
> It needs a public bug though.
I opened https://sourceware.org/bugzilla/show_bug.cgi?id=19490
Thanks,
@@ -16,11 +16,9 @@
<http://www.gnu.org/licenses/>. */
#include <lowlevellock.h>
+#include <sysdep.h>
- .globl pthread_spin_lock
- .type pthread_spin_lock,@function
- .align 16
-pthread_spin_lock:
+ENTRY(pthread_spin_lock)
1: LOCK
decl 0(%rdi)
jne 2f
@@ -33,4 +31,4 @@ pthread_spin_lock:
cmpl $0, 0(%rdi)
jg 1b
jmp 2b
- .size pthread_spin_lock,.-pthread_spin_lock
+END(pthread_spin_lock)
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <pthread-errnos.h>
+#include <sysdep.h>
#ifdef UP
@@ -25,10 +26,7 @@
# define LOCK lock
#endif
- .globl pthread_spin_trylock
- .type pthread_spin_trylock,@function
- .align 16
-pthread_spin_trylock:
+ENTRY(pthread_spin_trylock)
movl $1, %eax
xorl %ecx, %ecx
LOCK
@@ -36,4 +34,4 @@ pthread_spin_trylock:
movl $EBUSY, %eax
cmovel %ecx, %eax
retq
- .size pthread_spin_trylock,.-pthread_spin_trylock
+END(pthread_spin_trylock)
@@ -16,14 +16,13 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
- .globl pthread_spin_unlock
- .type pthread_spin_unlock,@function
- .align 16
-pthread_spin_unlock:
+#include <sysdep.h>
+
+ENTRY(pthread_spin_unlock)
movl $1, (%rdi)
xorl %eax, %eax
retq
- .size pthread_spin_unlock,.-pthread_spin_unlock
+END(pthread_spin_unlock)
/* The implementation of pthread_spin_init is identical. */
.globl pthread_spin_init