Compiler error missing __attribute_tls_model_ie define
Peter S. Mazinger
ps.m at gmx.net
Thu Aug 24 16:34:48 UTC 2006
On Thu, 24 Aug 2006, Khem Raj wrote:
>
>
> Peter S. Mazinger said the following on 8/24/2006 3:31 AM:
> > On Thu, 24 Aug 2006, Khem Raj wrote:
> >
> >
> >> Hi Peter
> >>
> >> I am getting this error on trunk
> >> ./include/bits/uClibc_errno.h: At top level:
> >> ./include/bits/uClibc_errno.h:22: error: expected '=', ',', ';', 'asm'
> >> or '__attribute__' before '__attribute_tls_model_ie'
> >>
> >
> > You should also tell me, that you somehow enabled TLS (USE___THREAD is
> > on for you, I wonder how you managed that, are you maybe using some
> > trunk-nptlbranch mixup?),
> yes I am working on ARM NPTL and was trying to revive the patch on
> latest trunk. So it is enabled intentionally.
> >>
> >
> >
The tls.h handling diverge somewhat in NPTL and what I tried to do
I have include/tls.h and include bits/tls.h (being the same files as in
arch/tls.h in glibc), in NPTL it uses include_next tls.h to get the arch
specific one.
Let's make an UCLIBC_USE_TLS config option added and handle this case and
guard with this attribute_tls_model_ie in libc-internal.h
attached a pre-patch, I have also added some other config options (the
last hunk for Rules.mak is also to ease porting NPTL providing some
variables used in glibc)
Comments?
Peter
--
Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2
-------------- next part --------------
Index: include/libc-internal.h
===================================================================
--- include/libc-internal.h (revision 15970)
+++ include/libc-internal.h (working copy)
@@ -27,7 +27,7 @@
# define attribute_relro
#endif
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#ifdef __UCLIBC_USE_TLS__
# define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
#endif
Index: include/tls.h
===================================================================
--- include/tls.h (revision 0)
+++ include/tls.h (revision 0)
@@ -0,0 +1,30 @@
+/* This file defines USE___THREAD to 1 or 0 to cut down on the #if mess. */
+
+#ifndef _include_tls_h
+#define _include_tls_h 1
+
+#include <features.h>
+
+#ifdef __UCLIBC_USE_TLS__
+# ifdef __UCLIBC_HAS_THREADS_NATIVE__
+# include_next <tls.h>
+# else
+# include <bits/tls.h>
+# endif
+#else
+# undef USE_TLS
+# undef HAVE___THREAD
+#endif
+
+#if USE_TLS && HAVE___THREAD \
+ && (!defined NOT_IN_libc || defined IS_IN_libpthread)
+
+# define USE___THREAD 1
+
+#else
+
+# define USE___THREAD 0
+
+#endif
+
+#endif
Index: Rules.mak
===================================================================
--- Rules.mak (revision 15647)
+++ Rules.mak (working copy)
@@ -412,27 +412,17 @@
endif
endif
PTDIR := $(top_builddir)libpthread/$(PTNAME)
-# set up system dependencies include dirs (NOTE: order matters!)
-ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-PTINC:= -I$(PTDIR) \
- -I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
- -I$(PTDIR)/sysdeps/$(TARGET_ARCH) \
- -I$(PTDIR)/sysdeps/unix/sysv/linux \
- -I$(PTDIR)/sysdeps/pthread \
- -I$(PTDIR)/sysdeps/pthread/bits \
- -I$(PTDIR)/sysdeps/generic \
- -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) \
- -I$(top_srcdir)ldso/include
+ifeq ($(UCLIBC_USE_TLS),y)
#
-# Test for TLS if NPTL support was selected.
+# Test for __thread if TLS use was selected.
#
GCC_HAS_TLS=$(shell \
- echo "extern __thread int foo;" | $(CC) -o /dev/null -S -xc - 2>&1)
+ echo "extern __thread int foo;" | $(CC) -o /dev/null -S -xc - > /dev/null 2>&1)
ifneq ($(GCC_HAS_TLS),)
gcc_tls_test_fail:
@echo "####";
@echo "#### Your compiler does not support TLS and you are trying to build uClibc";
- @echo "#### with NPTL support. Upgrade your binutils and gcc to versions which";
+ @echo "#### with TLS support. Upgrade your binutils and gcc to versions which";
@echo "#### support TLS for your architecture. Do not contact uClibc maintainers";
@echo "#### about this problem.";
@echo "####";
@@ -440,6 +430,18 @@
@echo "####";
@exit 1;
endif
+endif
+# set up system dependencies include dirs (NOTE: order matters!)
+ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+PTINC:= -I$(PTDIR) \
+ -I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
+ -I$(PTDIR)/sysdeps/$(TARGET_ARCH) \
+ -I$(PTDIR)/sysdeps/unix/sysv/linux \
+ -I$(PTDIR)/sysdeps/pthread \
+ -I$(PTDIR)/sysdeps/pthread/bits \
+ -I$(PTDIR)/sysdeps/generic \
+ -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) \
+ -I$(top_srcdir)ldso/include
else
PTINC := \
-I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \
@@ -469,6 +471,13 @@
CFLAGS:=$(CFLAGS:-O0=-O1)
endif
+exceptions := $(call check_gcc,-fexceptions,)
+uses-callbacks := $(exceptions)
+
+nodelete-yes := $(call check_ld,--enable-new-dtags -z nodelete)
+initfirst-yes := $(call check_ld,--enable-new-dtags -z initfirst)
+znodelete-yes := $(shell if echo "$(nodelete-yes)" | grep -q nodelete ; then echo -DHAVE_Z_NODELETE; fi)
+
# Keep the check_as from being needlessly executed
ifndef ASFLAGS_NOEXEC
ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
Index: extra/Configs/Config.in
===================================================================
--- extra/Configs/Config.in (revision 15970)
+++ extra/Configs/Config.in (working copy)
@@ -366,6 +366,44 @@
the latest code from glibc, so it may be the only choice for the
newer ports (like alpha/amd64/64bit arches and hppa).
+config LINUXTHREADS_HAS_OBSOLETED
+ bool "Enable obsoleted functions in linuxthreads"
+ default n
+ depends on UCLIBC_HAS_THREADS
+ depends on !LINUXTHREADS_OLD
+ help
+ Enable obsoleted functions in linuxthreads.
+
+config UCLIBC_HAS_POSIX_SPINLOCKS
+ bool "Enable POSIX spinlocks in linuxthreads"
+ default y
+ depends on UCLIBC_HAS_THREADS
+ depends on !LINUXTHREADS_OLD
+ help
+ Enable POSIX spinlocks in linuxthreads.
+
+config UCLIBC_HAS_POSIX_BARRIERS
+ bool "Enable POSIX barriers in linuxthreads"
+ default y
+ depends on UCLIBC_HAS_THREADS
+ depends on !LINUXTHREADS_OLD
+ help
+ Enable POSIX barriers in linuxthreads.
+
+config UCLIBC_HAS_POSIX_TIMERS
+ bool "Enable POSIX timers in linuxthreads and librt"
+ default y
+ help
+ Enable POSIX timers in linuxthreads and/or librt.
+
+config UCLIBC_USE_TLS
+ bool "Enable TLS use"
+ default n
+ depends on UCLIBC_HAS_THREADS
+ depends on !LINUXTHREADS_OLD
+ help
+ Enable ThreadLocalSupport.
+
config UCLIBC_HAS_LFS
bool "Large File Support"
default y
More information about the uClibc
mailing list