aboutsummaryrefslogtreecommitdiff
path: root/libbb/ptr_to_globals.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/ptr_to_globals.c')
-rw-r--r--libbb/ptr_to_globals.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libbb/ptr_to_globals.c b/libbb/ptr_to_globals.c
index 48cf8d86c..5f30e2a64 100644
--- a/libbb/ptr_to_globals.c
+++ b/libbb/ptr_to_globals.c
@@ -5,6 +5,8 @@
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this tarball for details.
6 */ 6 */
7 7
8#include <errno.h>
9
8struct globals; 10struct globals;
9 11
10#ifndef GCC_COMBINE 12#ifndef GCC_COMBINE
@@ -13,12 +15,21 @@ struct globals;
13 * but here we make it live in R/W memory */ 15 * but here we make it live in R/W memory */
14struct globals *ptr_to_globals; 16struct globals *ptr_to_globals;
15 17
18#ifdef __GLIBC__
19int *bb_errno;
20#endif
21
22
16#else 23#else
17 24
25
18/* gcc -combine will see through and complain */ 26/* gcc -combine will see through and complain */
19/* Using alternative method which is more likely to break 27/* Using alternative method which is more likely to break
20 * on weird architectures, compilers, linkers and so on */ 28 * on weird architectures, compilers, linkers and so on */
21struct globals *const ptr_to_globals __attribute__ ((section (".data"))); 29struct globals *const ptr_to_globals __attribute__ ((section (".data")));
22 30
31#ifdef __GLIBC__
32int *const bb_errno __attribute__ ((section (".data")));
23#endif 33#endif
24 34
35#endif