about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-01-06 14:57:16 +0000
committerJakub Jelinek <jakub@redhat.com>2005-01-06 14:57:16 +0000
commit0ecfa2580d1aedb744deb5af1b60f92c69b9e9e0 (patch)
tree1ef0d0dc09dba23037800d5f3794a77d9b45554f /nptl
parente4f5d077e9190f57abd49684bd7afcf4325bd348 (diff)
downloadglibc-0ecfa2580d1aedb744deb5af1b60f92c69b9e9e0.tar.gz
glibc-0ecfa2580d1aedb744deb5af1b60f92c69b9e9e0.tar.xz
glibc-0ecfa2580d1aedb744deb5af1b60f92c69b9e9e0.zip
Updated to fedora-glibc-20050106T1443
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog13
-rw-r--r--nptl/Makefile2
-rw-r--r--nptl/init.c2
-rw-r--r--nptl/sysdeps/i386/Makefile2
-rw-r--r--nptl/sysdeps/i386/tls.h7
-rw-r--r--nptl/tst-align2.c87
6 files changed, 109 insertions, 4 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index de90f2a66d..ec4d10b7ad 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,16 @@
+2004-12-27  Ulrich Drepper  <drepper@redhat.com>
+
+	* init.c (__pthread_initialize_minimal_internal): Use __sigemptyset.
+
+2004-12-21  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/i386/tls.h (CALL_THREAD_FCT): Maintain 16 byte alignment of
+	%esp.
+	* Makefile (tests): Add tst-align2.
+	* tst-align2.c: New test.
+	* sysdeps/i386/Makefile (CFLAGS-tst-align{,2}.c): Add
+	-mpreferred-stack-boundary=4.
+
 2004-12-18  Roland McGrath  <roland@redhat.com>
 
 	* sysdeps/unix/sysv/linux/powerpc/powerpc64/bits/local_lim.h:
diff --git a/nptl/Makefile b/nptl/Makefile
index d42f356131..8d18946e6f 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -205,7 +205,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
 	tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
 	tst-sem8 tst-sem9 \
 	tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
-	tst-align \
+	tst-align tst-align2 \
 	tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
 	tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
 	tst-raise1 \
diff --git a/nptl/init.c b/nptl/init.c
index 3751e6be77..86745af8d1 100644
--- a/nptl/init.c
+++ b/nptl/init.c
@@ -262,7 +262,7 @@ __pthread_initialize_minimal_internal (void)
   struct sigaction sa;
   sa.sa_sigaction = sigcancel_handler;
   sa.sa_flags = SA_SIGINFO;
-  sigemptyset (&sa.sa_mask);
+  __sigemptyset (&sa.sa_mask);
 
   (void) __libc_sigaction (SIGCANCEL, &sa, NULL);
 
diff --git a/nptl/sysdeps/i386/Makefile b/nptl/sysdeps/i386/Makefile
index 693fb0569f..2f0d88f303 100644
--- a/nptl/sysdeps/i386/Makefile
+++ b/nptl/sysdeps/i386/Makefile
@@ -22,4 +22,6 @@ endif
 
 ifeq ($(subdir),nptl)
 CFLAGS-pthread_create.c += -mpreferred-stack-boundary=4
+CFLAGS-tst-align.c += -mpreferred-stack-boundary=4
+CFLAGS-tst-align2.c += -mpreferred-stack-boundary=4
 endif
diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h
index 18b038f93e..945a4c71d6 100644
--- a/nptl/sysdeps/i386/tls.h
+++ b/nptl/sysdeps/i386/tls.h
@@ -397,9 +397,12 @@ union user_desc_init
 #define CALL_THREAD_FCT(descr) \
   ({ void *__res;							      \
      int __ignore1, __ignore2;						      \
-     asm volatile ("pushl %%gs:%P4\n\t"					      \
+     asm volatile ("pushl %%eax\n\t"					      \
+		   "pushl %%eax\n\t"					      \
+		   "pushl %%eax\n\t"					      \
+		   "pushl %%gs:%P4\n\t"					      \
 		   "call *%%gs:%P3\n\t"					      \
-		   "addl $4, %%esp"					      \
+		   "addl $16, %%esp"					      \
 		   : "=a" (__res), "=c" (__ignore1), "=d" (__ignore2)	      \
 		   : "i" (offsetof (struct pthread, start_routine)),	      \
 		     "i" (offsetof (struct pthread, arg)));		      \
diff --git a/nptl/tst-align2.c b/nptl/tst-align2.c
new file mode 100644
index 0000000000..ec85f435b6
--- /dev/null
+++ b/nptl/tst-align2.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sched.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <tst-stack-align.h>
+
+static int
+f (void *arg)
+{
+  bool ok = true;
+
+  if (TEST_STACK_ALIGN ())
+    ok = false;
+
+  return ok ? 0 : 1;
+}
+
+static int
+do_test (void)
+{
+  bool ok = true;
+
+  puts ("in main");
+
+  if (TEST_STACK_ALIGN ())
+    ok = false;
+
+#ifdef __ia64__
+  extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
+		       size_t __child_stack_size, int __flags,
+		       void *__arg, ...);
+  char st[256 * 1024];
+  pid_t p = __clone2 (f, st, sizeof (st), 0, 0);
+#else
+  char st[128 * 1024];
+  pid_t p = clone (f, st + sizeof (st), 0, 0);
+#endif
+  if (p == -1)
+    {
+      printf("clone failed: %m\n");
+      return 1;
+    }
+
+  int e;
+  if (waitpid (p, &e, __WCLONE) != p)
+    {
+      puts ("waitpid failed");
+      kill (p, SIGKILL);
+      return 1;
+    }
+  if (!WIFEXITED (e))
+    {
+      if (WIFSIGNALED (e))
+	printf ("died from signal %s\n", strsignal (WTERMSIG (e)));
+      else
+	puts ("did not terminate correctly");
+      return 1;
+    }
+  if (WEXITSTATUS (e) != 0)
+    ok = false;
+
+  return ok ? 0 : 1;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"