summaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32/0001-nptl-fix-calling-convention-for-__pthread_mutex_cond.patch
blob: 55edc51c9afa345c9ba76cfda3e57bcc7280028e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
From ed8017b08bee868eb5ea11c0b57074875267a3f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Fri, 6 Aug 2010 13:26:25 +0300
Subject: [PATCH] nptl: fix calling convention for __pthread_mutex_cond_lock
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The assembly versions of pthread_cond_wait calls
__pthread_mutex_cond_lock and __pthread_mutex_cond_lock_adjust
using internal calling convention (which differs from default
calling convention at least on x86). Thus these two functions
must be defined with internal_function or the call sequence goes
wrong.

__pthread_mutex_cond_lock resides in
sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c, but it does
evil macro definitions and includes pthread_mutex_lock.c, so
we need to add some extra kludge to pthread_mutex_lock.c to get
the prototypes correctly.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
---
 libpthread/nptl/pthreadP.h           |    6 ++++--
 libpthread/nptl/pthread_mutex_lock.c |    7 ++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h
index 85601d4..c45bd11 100644
--- a/libpthread/nptl/pthreadP.h
+++ b/libpthread/nptl/pthreadP.h
@@ -414,8 +414,10 @@ extern int __pthread_mutex_trylock (pthread_mutex_t *_mutex);
 extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
 extern int __pthread_mutex_lock_internal (pthread_mutex_t *__mutex)
      attribute_hidden;
-extern int __pthread_mutex_cond_lock (pthread_mutex_t *__mutex);
-extern void __pthread_mutex_cond_lock_adjust (pthread_mutex_t *__mutex);
+extern int __pthread_mutex_cond_lock (pthread_mutex_t *__mutex)
+     attribute_hidden internal_function;
+extern void __pthread_mutex_cond_lock_adjust (pthread_mutex_t *__mutex)
+     attribute_hidden internal_function;
 extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
 extern int __pthread_mutex_unlock_internal (pthread_mutex_t *__mutex)
      attribute_hidden;
diff --git a/libpthread/nptl/pthread_mutex_lock.c b/libpthread/nptl/pthread_mutex_lock.c
index 78b6671..77147db 100644
--- a/libpthread/nptl/pthread_mutex_lock.c
+++ b/libpthread/nptl/pthread_mutex_lock.c
@@ -42,7 +42,11 @@ static int __pthread_mutex_lock_full (pthread_mutex_t *mutex)
 
 
 int
+#ifdef NO_INCR
+attribute_hidden internal_function
+#else
 attribute_protected
+#endif
 __pthread_mutex_lock (
      pthread_mutex_t *mutex)
 {
@@ -477,7 +481,8 @@ strong_alias (__pthread_mutex_lock, __pthread_mutex_lock_internal)
 
 
 #ifdef NO_INCR
-void attribute_protected
+void
+attribute_hidden internal_function
 __pthread_mutex_cond_lock_adjust (
      pthread_mutex_t *mutex)
 {
-- 
1.7.0.4