summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread/nptl/sysdeps/powerpc')
-rw-r--r--libpthread/nptl/sysdeps/powerpc/Makefile21
-rw-r--r--libpthread/nptl/sysdeps/powerpc/Makefile.arch50
-rw-r--r--libpthread/nptl/sysdeps/powerpc/pthread_spin_lock.c5
-rw-r--r--libpthread/nptl/sysdeps/powerpc/pthread_spin_trylock.c5
-rw-r--r--libpthread/nptl/sysdeps/powerpc/tls.h9
5 files changed, 62 insertions, 28 deletions
diff --git a/libpthread/nptl/sysdeps/powerpc/Makefile b/libpthread/nptl/sysdeps/powerpc/Makefile
deleted file mode 100644
index 3af245600..000000000
--- a/libpthread/nptl/sysdeps/powerpc/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2003 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.
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/libpthread/nptl/sysdeps/powerpc/Makefile.arch b/libpthread/nptl/sysdeps/powerpc/Makefile.arch
new file mode 100644
index 000000000..bd34063b5
--- /dev/null
+++ b/libpthread/nptl/sysdeps/powerpc/Makefile.arch
@@ -0,0 +1,50 @@
+# Makefile for uClibc NPTL
+#
+# Copyright (C) 2009 Bernhard Reutner-Fischer <uclibc@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+PTHREAD_ARCH_DIR := $(top_srcdir)libpthread/nptl/sysdeps/powerpc
+PTHREAD_ARCH_OUT := $(top_builddir)libpthread/nptl/sysdeps/powerpc
+
+libpthread_SSRC =
+libpthread_CSRC = pthread_spin_lock.c pthread_spin_trylock.c
+
+PTHREAD_ARCH_OBJ := $(patsubst %.S,$(PTHREAD_ARCH_OUT)/%.o,$(libpthread_SSRC))
+PTHREAD_ARCH_OBJ += $(patsubst %.c,$(PTHREAD_ARCH_OUT)/%.o,$(libpthread_CSRC))
+
+ifeq ($(DOPIC),y)
+libpthread-a-y += $(PTHREAD_ARCH_OBJ:.o=.os)
+else
+libpthread-a-y += $(PTHREAD_ARCH_OBJ)
+endif
+libpthread-so-y += $(PTHREAD_ARCH_OBJ:.o=.oS)
+
+libpthread-nomulti-y += $(PTHREAD_ARCH_OBJ)
+
+CFLAGS-powerpc = $(SSP_ALL_CFLAGS)
+
+#
+# Create 'tcb-offsets.h' header file.
+#
+CFLAGS-tcb-offsets.c = -S
+
+$(PTHREAD_ARCH_OUT)/tcb-offsets.c: $(PTHREAD_ARCH_DIR)/tcb-offsets.sym
+ $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
+
+$(PTHREAD_ARCH_OUT)/tcb-offsets.s: $(PTHREAD_ARCH_OUT)/tcb-offsets.c
+ $(compile.c)
+
+$(PTHREAD_ARCH_OUT)/tcb-offsets.h: $(PTHREAD_ARCH_OUT)/tcb-offsets.s
+ $(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
+
+pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(PTHREAD_ARCH_OUT)/tcb-offsets.h
+
+nptl_arch_headers_clean:
+ $(RM) $(PTHREAD_ARCH_OUT)/tcb-offsets.c \
+ $(PTHREAD_ARCH_OUT)/tcb-offsets.s \
+ $(PTHREAD_ARCH_OUT)/tcb-offsets.h
+
+nptl_arch_objclean:
+ $(RM) $(PTHREAD_ARCH_OUT)/*.{o,os,oS}
diff --git a/libpthread/nptl/sysdeps/powerpc/pthread_spin_lock.c b/libpthread/nptl/sysdeps/powerpc/pthread_spin_lock.c
index e2293fda1..9334d4217 100644
--- a/libpthread/nptl/sysdeps/powerpc/pthread_spin_lock.c
+++ b/libpthread/nptl/sysdeps/powerpc/pthread_spin_lock.c
@@ -20,12 +20,11 @@
#include "pthreadP.h"
int
-pthread_spin_lock (lock)
- pthread_spinlock_t *lock;
+pthread_spin_lock (pthread_spinlock_t *lock)
{
unsigned int __tmp;
- asm volatile (
+ __asm__ __volatile__ (
"1: lwarx %0,0,%1\n"
" cmpwi 0,%0,0\n"
" bne- 2f\n"
diff --git a/libpthread/nptl/sysdeps/powerpc/pthread_spin_trylock.c b/libpthread/nptl/sysdeps/powerpc/pthread_spin_trylock.c
index d8e1dbcc8..a2757e207 100644
--- a/libpthread/nptl/sysdeps/powerpc/pthread_spin_trylock.c
+++ b/libpthread/nptl/sysdeps/powerpc/pthread_spin_trylock.c
@@ -21,13 +21,12 @@
#include "pthreadP.h"
int
-pthread_spin_trylock (lock)
- pthread_spinlock_t *lock;
+pthread_spin_trylock (pthread_spinlock_t *lock)
{
unsigned int old;
int err = EBUSY;
- asm ("1: lwarx %0,0,%2\n"
+ __asm__ ("1: lwarx %0,0,%2\n"
" cmpwi 0,%0,0\n"
" bne 2f\n"
" stwcx. %3,0,%2\n"
diff --git a/libpthread/nptl/sysdeps/powerpc/tls.h b/libpthread/nptl/sysdeps/powerpc/tls.h
index ce5559eef..990972eaa 100644
--- a/libpthread/nptl/sysdeps/powerpc/tls.h
+++ b/libpthread/nptl/sysdeps/powerpc/tls.h
@@ -40,6 +40,13 @@ typedef union dtv
# include <tcb-offsets.h>
#endif /* __ASSEMBLER__ */
+/* We require TLS support in the tools. */
+#define HAVE_TLS_SUPPORT 1
+#define HAVE_TLS_MODEL_ATTRIBUTE 1
+#define HAVE___THREAD 1
+
+/* Signal that TLS support is available. */
+#define USE_TLS 1
/* We require TLS support in the tools. */
#ifndef HAVE_TLS_SUPPORT
@@ -61,7 +68,7 @@ typedef union dtv
#define TLS_MULTIPLE_THREADS_IN_TCB 1
/* Get the thread descriptor definition. */
-# include <nptl/descr.h>
+# include <../../descr.h>
/* The stack_guard is accessed directly by GCC -fstack-protector code,
so it is a part of public ABI. The dtv and pointer_guard fields