]>
Commit | Line | Data |
---|---|---|
ce460d04 | 1 | /* Thread-local data used by error handling for runtime dynamic linker. |
f7a9f785 | 2 | Copyright (C) 2002-2016 Free Software Foundation, Inc. |
ce460d04 RM |
3 | This file is part of the GNU C Library. |
4 | ||
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. | |
9 | ||
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. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
ce460d04 | 18 | |
bf2cc5fb | 19 | #ifdef _LIBC_REENTRANT |
ce460d04 | 20 | |
bf2cc5fb RM |
21 | # include <ldsodefs.h> |
22 | # include <tls.h> | |
23 | ||
24 | # ifndef SHARED | |
ce460d04 RM |
25 | |
26 | /* _dl_error_catch_tsd points to this for the single-threaded case. | |
27 | It's reset by the thread library for multithreaded programs | |
28 | if we're not using __thread. */ | |
216455bc RM |
29 | void ** __attribute__ ((const)) |
30 | _dl_initial_error_catch_tsd (void) | |
ce460d04 | 31 | { |
ce460d04 | 32 | static __thread void *data; |
ce460d04 RM |
33 | return &data; |
34 | } | |
35 | void **(*_dl_error_catch_tsd) (void) __attribute__ ((const)) | |
216455bc | 36 | = &_dl_initial_error_catch_tsd; |
ce460d04 | 37 | |
d063d164 | 38 | # else |
ce460d04 RM |
39 | |
40 | /* libpthread sets _dl_error_catch_tsd to point to this function. | |
41 | We define it here instead of in libpthread so that it doesn't | |
42 | need to have a TLS segment of its own just for this one pointer. */ | |
43 | ||
44 | void ** __attribute__ ((const)) | |
45 | __libc_dl_error_tsd (void) | |
46 | { | |
5eac4760 | 47 | static __thread void *data attribute_tls_model_ie; |
ce460d04 RM |
48 | return &data; |
49 | } | |
50 | ||
bf2cc5fb RM |
51 | # endif /* SHARED */ |
52 | ||
53 | #endif /* _LIBC_REENTRANT */ |