Start 1.33.0 development cycle
[oweals/busybox.git] / libbb / ptr_to_globals.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4  *
5  * Licensed under GPLv2, see file LICENSE in this source tree.
6  */
7 #include <errno.h>
8
9 struct globals;
10
11 #ifndef GCC_COMBINE
12
13 /* We cheat here. It is declared as const ptr in libbb.h,
14  * but here we make it live in R/W memory */
15 struct globals *ptr_to_globals;
16
17 #ifdef __GLIBC__
18 int *bb_errno;
19 #endif
20
21
22 #else
23
24
25 /* gcc -combine will see through and complain */
26 /* Using alternative method which is more likely to break
27  * on weird architectures, compilers, linkers and so on */
28 struct globals *const ptr_to_globals __attribute__ ((section (".data")));
29
30 #ifdef __GLIBC__
31 int *const bb_errno __attribute__ ((section (".data")));
32 #endif
33
34 #endif