Denis Vlasenko | 574f2f4 | 2008-02-27 18:41:59 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* |
| 3 | * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com> |
| 4 | * |
Denys Vlasenko | 0ef64bd | 2010-08-16 20:14:46 +0200 | [diff] [blame] | 5 | * Licensed under GPLv2, see file LICENSE in this source tree. |
Denis Vlasenko | 574f2f4 | 2008-02-27 18:41:59 +0000 | [diff] [blame] | 6 | */ |
Denis Vlasenko | 5d89fba | 2008-04-22 00:08:27 +0000 | [diff] [blame] | 7 | #include <errno.h> |
| 8 | |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 9 | struct globals; |
| 10 | |
| 11 | #ifndef GCC_COMBINE |
| 12 | |
Denis Vlasenko | 574f2f4 | 2008-02-27 18:41:59 +0000 | [diff] [blame] | 13 | /* We cheat here. It is declared as const ptr in libbb.h, |
| 14 | * but here we make it live in R/W memory */ |
Denis Vlasenko | 574f2f4 | 2008-02-27 18:41:59 +0000 | [diff] [blame] | 15 | struct globals *ptr_to_globals; |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 16 | |
Denys Vlasenko | b1c7a66 | 2020-10-01 00:34:44 +0200 | [diff] [blame] | 17 | #ifdef errno |
Denis Vlasenko | 5d89fba | 2008-04-22 00:08:27 +0000 | [diff] [blame] | 18 | int *bb_errno; |
| 19 | #endif |
| 20 | |
| 21 | |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 22 | #else |
| 23 | |
Denis Vlasenko | 5d89fba | 2008-04-22 00:08:27 +0000 | [diff] [blame] | 24 | |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 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 | |
Denys Vlasenko | b1c7a66 | 2020-10-01 00:34:44 +0200 | [diff] [blame] | 30 | #ifdef errno |
Denis Vlasenko | 5d89fba | 2008-04-22 00:08:27 +0000 | [diff] [blame] | 31 | int *const bb_errno __attribute__ ((section (".data"))); |
Denis Vlasenko | 93b8263 | 2008-04-11 11:27:29 +0000 | [diff] [blame] | 32 | #endif |
| 33 | |
Denis Vlasenko | 5d89fba | 2008-04-22 00:08:27 +0000 | [diff] [blame] | 34 | #endif |