blob: 1074538f3bad71f99bcbf5eb7448d0d539befbfb [file] [log] [blame]
Denis Vlasenko574f2f42008-02-27 18:41:59 +00001/* vi: set sw=4 ts=4: */
2/*
3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4 *
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02005 * Licensed under GPLv2, see file LICENSE in this source tree.
Denis Vlasenko574f2f42008-02-27 18:41:59 +00006 */
7
Denis Vlasenko5d89fba2008-04-22 00:08:27 +00008#include <errno.h>
9
Denis Vlasenko93b82632008-04-11 11:27:29 +000010struct globals;
11
12#ifndef GCC_COMBINE
13
Denis Vlasenko574f2f42008-02-27 18:41:59 +000014/* We cheat here. It is declared as const ptr in libbb.h,
15 * but here we make it live in R/W memory */
Denis Vlasenko574f2f42008-02-27 18:41:59 +000016struct globals *ptr_to_globals;
Denis Vlasenko93b82632008-04-11 11:27:29 +000017
Denis Vlasenko5d89fba2008-04-22 00:08:27 +000018#ifdef __GLIBC__
19int *bb_errno;
20#endif
21
22
Denis Vlasenko93b82632008-04-11 11:27:29 +000023#else
24
Denis Vlasenko5d89fba2008-04-22 00:08:27 +000025
Denis Vlasenko93b82632008-04-11 11:27:29 +000026/* gcc -combine will see through and complain */
27/* Using alternative method which is more likely to break
28 * on weird architectures, compilers, linkers and so on */
29struct globals *const ptr_to_globals __attribute__ ((section (".data")));
30
Denis Vlasenko5d89fba2008-04-22 00:08:27 +000031#ifdef __GLIBC__
32int *const bb_errno __attribute__ ((section (".data")));
Denis Vlasenko93b82632008-04-11 11:27:29 +000033#endif
34
Denis Vlasenko5d89fba2008-04-22 00:08:27 +000035#endif