aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-22 00:08:27 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-22 00:08:27 +0000
commit5d89fbaa2e00a8a26e530306d76b78bf91d12ec8 (patch)
tree44d54f6dfbd0f6270fb0b1aba0195bc53db8bef4 /libbb
parent9137341851f3ab89f5c6a54a6baff68f0f4a5e17 (diff)
downloadbusybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.tar.gz
busybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.tar.bz2
busybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.zip
*: remove remaining instances of ".data" hack
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Kbuild2
-rw-r--r--libbb/appletlib.c5
-rw-r--r--libbb/lineedit.c13
-rw-r--r--libbb/ptr_to_globals.c11
4 files changed, 18 insertions, 13 deletions
diff --git a/libbb/Kbuild b/libbb/Kbuild
index 3a68efc28..d943628aa 100644
--- a/libbb/Kbuild
+++ b/libbb/Kbuild
@@ -50,7 +50,7 @@ lib-y += inode_hash.o
50lib-y += isdirectory.o 50lib-y += isdirectory.o
51lib-y += kernel_version.o 51lib-y += kernel_version.o
52lib-y += last_char_is.o 52lib-y += last_char_is.o
53lib-y += lineedit.o 53lib-y += lineedit.o lineedit_ptr_hack.o
54lib-y += llist.o 54lib-y += llist.o
55lib-y += login.o 55lib-y += login.o
56lib-y += make_directory.o 56lib-y += make_directory.o
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index ed7d3912b..90fca8c13 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -177,11 +177,6 @@ int find_applet_by_name(const char *name)
177} 177}
178 178
179 179
180#ifdef __GLIBC__
181/* Make it reside in R/W memory: */
182int *const bb_errno __attribute__ ((section (".data")));
183#endif
184
185void lbb_prepare(const char *applet 180void lbb_prepare(const char *applet
186 USE_FEATURE_INDIVIDUAL(, char **argv)) 181 USE_FEATURE_INDIVIDUAL(, char **argv))
187 MAIN_EXTERNALLY_VISIBLE; 182 MAIN_EXTERNALLY_VISIBLE;
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 4ba61c143..6de66ba83 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -74,7 +74,7 @@ static const char null_str[] ALIGN1 = "";
74#endif 74#endif
75 75
76/* We try to minimize both static and stack usage. */ 76/* We try to minimize both static and stack usage. */
77struct statics { 77struct lineedit_statics {
78 line_input_t *state; 78 line_input_t *state;
79 79
80 volatile unsigned cmdedit_termw; /* = 80; */ /* actual terminal width */ 80 volatile unsigned cmdedit_termw; /* = 80; */ /* actual terminal width */
@@ -120,11 +120,10 @@ struct statics {
120#endif 120#endif
121}; 121};
122 122
123/* Make it reside in writable memory, yet make compiler understand 123/* See lineedit_ptr_hack.c */
124 * that it is not going to change. */ 124extern struct lineedit_statics *const lineedit_ptr_to_statics;
125static struct statics *const ptr_to_statics __attribute__ ((section (".data")));
126 125
127#define S (*ptr_to_statics) 126#define S (*lineedit_ptr_to_statics)
128#define state (S.state ) 127#define state (S.state )
129#define cmdedit_termw (S.cmdedit_termw ) 128#define cmdedit_termw (S.cmdedit_termw )
130#define previous_SIGWINCH_handler (S.previous_SIGWINCH_handler) 129#define previous_SIGWINCH_handler (S.previous_SIGWINCH_handler)
@@ -145,7 +144,7 @@ static struct statics *const ptr_to_statics __attribute__ ((section (".data")));
145#define delbuf (S.delbuf ) 144#define delbuf (S.delbuf )
146 145
147#define INIT_S() do { \ 146#define INIT_S() do { \
148 (*(struct statics**)&ptr_to_statics) = xzalloc(sizeof(S)); \ 147 (*(struct lineedit_statics**)&lineedit_ptr_to_statics) = xzalloc(sizeof(S)); \
149 barrier(); \ 148 barrier(); \
150 cmdedit_termw = 80; \ 149 cmdedit_termw = 80; \
151 USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \ 150 USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \
@@ -163,7 +162,7 @@ static void deinit_S(void)
163 if (home_pwd_buf != null_str) 162 if (home_pwd_buf != null_str)
164 free(home_pwd_buf); 163 free(home_pwd_buf);
165#endif 164#endif
166 free(ptr_to_statics); 165 free(lineedit_ptr_to_statics);
167} 166}
168#define DEINIT_S() deinit_S() 167#define DEINIT_S() deinit_S()
169 168
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