This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc 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]

GNU C Library master sources branch master updated. glibc-2.19-385-ge0db651


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  e0db65176fa88b9497cbd6362b24e3225382bfb6 (commit)
      from  01eb16fdb6c143884dcaeadf45ffdd725207eed5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e0db65176fa88b9497cbd6362b24e3225382bfb6

commit e0db65176fa88b9497cbd6362b24e3225382bfb6
Author: Roland McGrath <roland@hack.frob.com>
Date:   Tue May 13 09:49:20 2014 -0700

    Clean up __exit_thread.

diff --git a/ChangeLog b/ChangeLog
index ddba88a..1bee32a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2014-05-13  Roland McGrath  <roland@hack.frob.com>
+
+	* sysdeps/generic/exit-thread.h: New file.
+	* sysdeps/unix/sysv/linux/exit-thread.h: New file.
+	* include/unistd.h (__exit_thread): Remove declaration.
+	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Drop exit-thread.
+	* sysdeps/unix/sysv/linux/exit-thread.S: File removed.
+	* csu/libc-start.c: Include <exit-thread.h>.
+	(LIBC_START_MAIN): Pass no argument to __exit_thread.
+	* nptl/pthread_create.c: Include <exit-thread.h>.
+	(start_thread): Call __exit_thread in place of __exit_thread_inline.
+	* nptl/sysdeps/i386/pthreaddef.h (__exit_thread_inline): Macro removed.
+	* nptl/sysdeps/powerpc/pthreaddef.h: Likewise.
+	* nptl/sysdeps/s390/pthreaddef.h: Likewise.
+	* nptl/sysdeps/sh/pthreaddef.h: Likewise.
+	* nptl/sysdeps/sparc/sparc32/pthreaddef.h: Likewise.
+	* nptl/sysdeps/sparc/sparc64/pthreaddef.h: Likewise.
+	* nptl/sysdeps/x86_64/pthreaddef.h: Likewise.
+	* sysdeps/aarch64/nptl/pthreaddef.h: Likewise.
+	* sysdeps/alpha/nptl/pthreaddef.h: Likewise.
+	* sysdeps/arm/nptl/pthreaddef.h: Likewise.
+	* sysdeps/hppa/nptl/pthreaddef.h: Likewise.
+	* sysdeps/ia64/nptl/pthreaddef.h: Likewise.
+	* sysdeps/m68k/nptl/pthreaddef.h: Likewise.
+	* sysdeps/microblaze/nptl/pthreaddef.h: Likewise.
+	* sysdeps/mips/nptl/pthreaddef.h: Likewise.
+	* sysdeps/tile/nptl/pthreaddef.h: Likewise.
+
 2014-05-13  Andreas Schwab  <schwab@suse.de>
 
 	* sysdeps/unix/grantpt.c (grantpt): Fix typo in assertion.
diff --git a/csu/libc-start.c b/csu/libc-start.c
index d571a1a..138418a 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <ldsodefs.h>
+#include <exit-thread.h>
 
 extern void __libc_init_first (int argc, char **argv, char **envp);
 #ifndef SHARED
@@ -312,7 +313,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
 
       if (! atomic_decrement_and_test (ptr))
 	/* Not much left to do but to exit the thread, not the process.  */
-	__exit_thread (0);
+	__exit_thread ();
     }
 #else
   /* Nothing fancy, just call the function.  */
diff --git a/include/unistd.h b/include/unistd.h
index a5cbc5d..5a016b1 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -161,9 +161,6 @@ extern int __libc_enable_secure_internal attribute_relro attribute_hidden;
 extern void __libc_check_standard_fds (void);
 
 
-/* Special exit function which only terminates the current thread.  */
-extern void __exit_thread (int val) __attribute__ ((noreturn));
-
 /* Internal name for fork function.  */
 extern __pid_t __libc_fork (void);
 
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 38e69cb..2997163 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -29,6 +29,7 @@
 #include <libc-internal.h>
 #include <resolv.h>
 #include <kernel-features.h>
+#include <exit-thread.h>
 
 #include <shlib-compat.h>
 
@@ -432,7 +433,7 @@ start_thread (void *arg)
 
      The exit code is zero since in case all threads exit by calling
      'pthread_exit' the exit status must be 0 (zero).  */
-  __exit_thread_inline (0);
+  __exit_thread ();
 
   /* NOTREACHED */
   return 0;
diff --git a/nptl/sysdeps/i386/pthreaddef.h b/nptl/sysdeps/i386/pthreaddef.h
index 3a1ea1c..bf00c00 100644
--- a/nptl/sysdeps/i386/pthreaddef.h
+++ b/nptl/sysdeps/i386/pthreaddef.h
@@ -38,16 +38,3 @@
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
-
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-/* While there is no such syscall.  */
-#define __exit_thread_inline(val) \
-  while (1) {								      \
-    if (__builtin_constant_p (val) && (val) == 0)			      \
-      asm volatile ("xorl %%ebx, %%ebx; int $0x80" :: "a" (__NR_exit));	      \
-    else								      \
-      asm volatile ("movl %1, %%ebx; int $0x80"				      \
-		    :: "a" (__NR_exit), "r" (val));			      \
-  }
diff --git a/nptl/sysdeps/powerpc/pthreaddef.h b/nptl/sysdeps/powerpc/pthreaddef.h
index a0db629..5c6a0cd 100644
--- a/nptl/sysdeps/powerpc/pthreaddef.h
+++ b/nptl/sysdeps/powerpc/pthreaddef.h
@@ -31,10 +31,3 @@
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
-
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-/* While there is no such syscall.  */
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/nptl/sysdeps/s390/pthreaddef.h b/nptl/sysdeps/s390/pthreaddef.h
index 70cb6a4..b2a7c05 100644
--- a/nptl/sysdeps/s390/pthreaddef.h
+++ b/nptl/sysdeps/s390/pthreaddef.h
@@ -31,10 +31,3 @@
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
-
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-/* While there is no such syscall.  */
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/nptl/sysdeps/sh/pthreaddef.h b/nptl/sysdeps/sh/pthreaddef.h
index f0b1ad7..7ea338e 100644
--- a/nptl/sysdeps/sh/pthreaddef.h
+++ b/nptl/sysdeps/sh/pthreaddef.h
@@ -32,17 +32,3 @@
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
-
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-/* While there is no such syscall.  */
-#define __exit_thread_inline(val) \
-  while (1) {								      \
-    if (__builtin_constant_p (val) && (val) == 0)			      \
-      asm volatile ("mov #0,r4; mov %0,r3; trapa #0x11\n\t" SYSCALL_INST_PAD  \
-		   :: "i" (__NR_exit));  \
-    else								      \
-      asm volatile ("mov %1,r4; mov %0,r3; trapa #0x11\n\t" SYSCALL_INST_PAD  \
-		    :: "i" (__NR_exit), "r" (val));			      \
-  }
diff --git a/nptl/sysdeps/sparc/sparc32/pthreaddef.h b/nptl/sysdeps/sparc/sparc32/pthreaddef.h
index 64d796b..eb8d33b 100644
--- a/nptl/sysdeps/sparc/sparc32/pthreaddef.h
+++ b/nptl/sysdeps/sparc/sparc32/pthreaddef.h
@@ -31,9 +31,3 @@
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME  (stack_pointer + (2 * 64))
 register char *stack_pointer __asm__("%sp");
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-/* While there is no such syscall.  */
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/nptl/sysdeps/sparc/sparc64/pthreaddef.h b/nptl/sysdeps/sparc/sparc64/pthreaddef.h
index de39eef..ee44bcf 100644
--- a/nptl/sysdeps/sparc/sparc64/pthreaddef.h
+++ b/nptl/sysdeps/sparc/sparc64/pthreaddef.h
@@ -31,9 +31,3 @@
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME  (stack_pointer + (2 * 128))
 register char *stack_pointer __asm__("%sp");
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-/* While there is no such syscall.  */
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/nptl/sysdeps/x86_64/pthreaddef.h b/nptl/sysdeps/x86_64/pthreaddef.h
index 18a15a1..485a625 100644
--- a/nptl/sysdeps/x86_64/pthreaddef.h
+++ b/nptl/sysdeps/x86_64/pthreaddef.h
@@ -42,10 +42,3 @@
 /* Location of current stack frame.  The frame pointer is not usable.  */
 #define CURRENT_STACK_FRAME \
   ({ register char *frame __asm__("rsp"); frame; })
-
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-/* While there is no such syscall.  */
-#define __exit_thread_inline(val) \
-  asm volatile ("syscall" :: "a" (__NR_exit), "D" (val))
diff --git a/sysdeps/aarch64/nptl/pthreaddef.h b/sysdeps/aarch64/nptl/pthreaddef.h
index 361a95c..9198314 100644
--- a/sysdeps/aarch64/nptl/pthreaddef.h
+++ b/sysdeps/aarch64/nptl/pthreaddef.h
@@ -30,8 +30,3 @@
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
-
-
-/* XXX Until we have a better place keep the definitions here.  */
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/sysdeps/alpha/nptl/pthreaddef.h b/sysdeps/alpha/nptl/pthreaddef.h
index 4e56fd9..f54400c 100644
--- a/sysdeps/alpha/nptl/pthreaddef.h
+++ b/sysdeps/alpha/nptl/pthreaddef.h
@@ -29,9 +29,3 @@
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-/* While there is no such syscall.  */
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/sysdeps/arm/nptl/pthreaddef.h b/sysdeps/arm/nptl/pthreaddef.h
index 2488af9..ab1b05b 100644
--- a/sysdeps/arm/nptl/pthreaddef.h
+++ b/sysdeps/arm/nptl/pthreaddef.h
@@ -39,8 +39,3 @@
    return the hard FP minus 12.  Of course, this makes no sense
    without the obsolete APCS stack layout...  */
 #define CURRENT_STACK_FRAME	(__builtin_frame_address (0) - 12)
-
-
-/* XXX Until we have a better place keep the definitions here.  */
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/sysdeps/unix/sysv/linux/exit-thread.S b/sysdeps/generic/exit-thread.h
similarity index 62%
rename from sysdeps/unix/sysv/linux/exit-thread.S
rename to sysdeps/generic/exit-thread.h
index 741cea4..779e61e 100644
--- a/sysdeps/unix/sysv/linux/exit-thread.S
+++ b/sysdeps/generic/exit-thread.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
+/* Call to terminate the current thread.  Stub version.
+   Copyright (C) 2014 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -15,8 +16,13 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sysdep.h>
+/* This causes the current thread to exit, without affecting other
+   threads in the process if there are any.  If there are no other
+   threads left, then this has the effect of _exit (0).  */
 
-PSEUDO (__exit_thread, exit, 1)
-	/* Shouldn't get here.  */
-PSEUDO_END(__exit_thread)
+static inline void __attribute__ ((noreturn, always_inline, unused))
+__exit_thread (void)
+{
+  while (1)
+    asm ("write me!");
+}
diff --git a/sysdeps/hppa/nptl/pthreaddef.h b/sysdeps/hppa/nptl/pthreaddef.h
index ee8765a..d0fffa0 100644
--- a/sysdeps/hppa/nptl/pthreaddef.h
+++ b/sysdeps/hppa/nptl/pthreaddef.h
@@ -31,9 +31,3 @@
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME  stack_pointer
 register char * stack_pointer __asm__ ("%r30");
-
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/sysdeps/ia64/nptl/pthreaddef.h b/sysdeps/ia64/nptl/pthreaddef.h
index cf4763c..8fdd9e3 100644
--- a/sysdeps/ia64/nptl/pthreaddef.h
+++ b/sysdeps/ia64/nptl/pthreaddef.h
@@ -34,9 +34,3 @@
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME	__stack_pointer
 register char *__stack_pointer __asm__ ("sp");
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-/* While there is no such syscall.  */
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/sysdeps/m68k/nptl/pthreaddef.h b/sysdeps/m68k/nptl/pthreaddef.h
index 68bf11a..72d2b3e 100644
--- a/sysdeps/m68k/nptl/pthreaddef.h
+++ b/sysdeps/m68k/nptl/pthreaddef.h
@@ -31,8 +31,3 @@
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
-
-
-/* XXX Until we have a better place keep the definitions here.  */
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/sysdeps/microblaze/nptl/pthreaddef.h b/sysdeps/microblaze/nptl/pthreaddef.h
index 37a44c1..38a61d1 100644
--- a/sysdeps/microblaze/nptl/pthreaddef.h
+++ b/sysdeps/microblaze/nptl/pthreaddef.h
@@ -33,8 +33,3 @@
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME __builtin_frame_address (0)
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/sysdeps/mips/nptl/pthreaddef.h b/sysdeps/mips/nptl/pthreaddef.h
index 60f57de..da2366f 100644
--- a/sysdeps/mips/nptl/pthreaddef.h
+++ b/sysdeps/mips/nptl/pthreaddef.h
@@ -30,9 +30,3 @@
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
-
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/sysdeps/tile/nptl/pthreaddef.h b/sysdeps/tile/nptl/pthreaddef.h
index f399725..646d09e 100644
--- a/sysdeps/tile/nptl/pthreaddef.h
+++ b/sysdeps/tile/nptl/pthreaddef.h
@@ -34,8 +34,3 @@
 
 /* Location of current stack frame.  */
 #define CURRENT_STACK_FRAME	__builtin_frame_address (0)
-
-/* XXX Until we have a better place keep the definitions here.  */
-
-#define __exit_thread_inline(val) \
-  INLINE_SYSCALL (exit, 1, (val))
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 692487f..02eda45 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -141,7 +141,7 @@ endif
 ifeq ($(subdir),posix)
 sysdep_headers += bits/initspin.h
 
-sysdep_routines += exit-thread sched_getcpu
+sysdep_routines += sched_getcpu
 
 tests += tst-getcpu
 endif
diff --git a/sysdeps/unix/sysv/linux/exit-thread.h b/sysdeps/unix/sysv/linux/exit-thread.h
new file mode 100644
index 0000000..52891dd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/exit-thread.h
@@ -0,0 +1,38 @@
+/* Call to terminate the current thread.  Linux version.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+/* This causes the current thread to exit, without affecting other
+   threads in the process if there are any.  If there are no other
+   threads left, then this has the effect of _exit (0).  */
+
+static inline void __attribute__ ((noreturn, always_inline, unused))
+__exit_thread (void)
+{
+  /* Doing this in a loop is mostly just to satisfy the compiler that the
+     function really qualifies as noreturn.  It also means that in some
+     pathological situation where the system call does not get made or does
+     not work, the thread will simply spin rather than running off the end
+     of the caller and doing unexpectedly strange things.  */
+  while (1)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      INTERNAL_SYSCALL (exit, err, 1, 0);
+    }
+}

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   28 ++++++++++++++++++
 csu/libc-start.c                                   |    3 +-
 include/unistd.h                                   |    3 --
 nptl/pthread_create.c                              |    3 +-
 nptl/sysdeps/i386/pthreaddef.h                     |   13 --------
 nptl/sysdeps/powerpc/pthreaddef.h                  |    7 ----
 nptl/sysdeps/s390/pthreaddef.h                     |    7 ----
 nptl/sysdeps/sh/pthreaddef.h                       |   14 ---------
 nptl/sysdeps/sparc/sparc32/pthreaddef.h            |    6 ----
 nptl/sysdeps/sparc/sparc64/pthreaddef.h            |    6 ----
 nptl/sysdeps/x86_64/pthreaddef.h                   |    7 ----
 sysdeps/aarch64/nptl/pthreaddef.h                  |    5 ---
 sysdeps/alpha/nptl/pthreaddef.h                    |    6 ----
 sysdeps/arm/nptl/pthreaddef.h                      |    5 ---
 .../generic/exit-thread.h                          |   15 +++++----
 sysdeps/hppa/nptl/pthreaddef.h                     |    6 ----
 sysdeps/ia64/nptl/pthreaddef.h                     |    6 ----
 sysdeps/m68k/nptl/pthreaddef.h                     |    5 ---
 sysdeps/microblaze/nptl/pthreaddef.h               |    5 ---
 sysdeps/mips/nptl/pthreaddef.h                     |    6 ----
 sysdeps/tile/nptl/pthreaddef.h                     |    5 ---
 sysdeps/unix/sysv/linux/Makefile                   |    2 +-
 sysdeps/unix/sysv/linux/exit-thread.S              |   22 --------------
 .../sysv/linux/exit-thread.h}                      |   31 +++++++++++--------
 24 files changed, 59 insertions(+), 157 deletions(-)
 copy benchtests/bench-timing-type.c => sysdeps/generic/exit-thread.h (67%)
 delete mode 100644 sysdeps/unix/sysv/linux/exit-thread.S
 copy sysdeps/{powerpc/powerpc64/fpu/multiarch/s_finite-power8.S => unix/sysv/linux/exit-thread.h} (50%)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]