initializer syntax to C99.
[glibc/pb-stable.git] / elf / dl-tsd.c
blobf44fa7d365b8614a3a0c1d9e7f506f22d948c9a9
1 /* Thread-local data used by error handling for runtime dynamic linker.
2 Copyright (C) 2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifdef _LIBC_REENTRANT
22 # include <ldsodefs.h>
23 # include <tls.h>
25 # ifndef SHARED
27 /* _dl_error_catch_tsd points to this for the single-threaded case.
28 It's reset by the thread library for multithreaded programs
29 if we're not using __thread. */
30 void ** __attribute__ ((const))
31 _dl_initial_error_catch_tsd (void)
33 # if USE___THREAD
34 static __thread void *data;
35 # else
36 static void *data;
37 # endif
38 return &data;
40 void **(*_dl_error_catch_tsd) (void) __attribute__ ((const))
41 = &_dl_initial_error_catch_tsd;
43 # elif USE___THREAD
45 /* libpthread sets _dl_error_catch_tsd to point to this function.
46 We define it here instead of in libpthread so that it doesn't
47 need to have a TLS segment of its own just for this one pointer. */
49 void ** __attribute__ ((const))
50 __libc_dl_error_tsd (void)
52 static __thread void *data;
53 return &data;
56 # endif /* SHARED */
58 #endif /* _LIBC_REENTRANT */