aboutsummaryrefslogtreecommitdiff
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
parent9137341851f3ab89f5c6a54a6baff68f0f4a5e17 (diff)
downloadbusybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.tar.gz
busybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.tar.bz2
busybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.zip
*: remove remaining instances of ".data" hack
-rw-r--r--coreutils/Kbuild8
-rw-r--r--coreutils/test.c13
-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
6 files changed, 28 insertions, 24 deletions
diff --git a/coreutils/Kbuild b/coreutils/Kbuild
index 253eb6da8..cb4543912 100644
--- a/coreutils/Kbuild
+++ b/coreutils/Kbuild
@@ -71,10 +71,10 @@ lib-$(CONFIG_SYNC) += sync.o
71lib-$(CONFIG_TAC) += tac.o 71lib-$(CONFIG_TAC) += tac.o
72lib-$(CONFIG_TAIL) += tail.o 72lib-$(CONFIG_TAIL) += tail.o
73lib-$(CONFIG_TEE) += tee.o 73lib-$(CONFIG_TEE) += tee.o
74lib-$(CONFIG_TEST) += test.o 74lib-$(CONFIG_TEST) += test.o test_ptr_hack.o
75lib-$(CONFIG_ASH) += test.o # used by ash 75lib-$(CONFIG_ASH) += test.o test_ptr_hack.o # used by ash
76lib-$(CONFIG_HUSH) += test.o # used by hush 76lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o # used by hush
77lib-$(CONFIG_MSH) += test.o # used by msh 77lib-$(CONFIG_MSH) += test.o test_ptr_hack.o # used by msh
78lib-$(CONFIG_TOUCH) += touch.o 78lib-$(CONFIG_TOUCH) += touch.o
79lib-$(CONFIG_TR) += tr.o 79lib-$(CONFIG_TR) += tr.o
80lib-$(CONFIG_TRUE) += true.o 80lib-$(CONFIG_TRUE) += true.o
diff --git a/coreutils/test.c b/coreutils/test.c
index 2f5b6b8a1..3c725a245 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -159,7 +159,7 @@ typedef int arith_t;
159 159
160 160
161/* We try to minimize both static and stack usage. */ 161/* We try to minimize both static and stack usage. */
162struct statics { 162struct test_statics {
163 char **t_wp; 163 char **t_wp;
164 const struct t_op *t_wp_op; 164 const struct t_op *t_wp_op;
165 gid_t *group_array; 165 gid_t *group_array;
@@ -167,11 +167,10 @@ struct statics {
167 jmp_buf leaving; 167 jmp_buf leaving;
168}; 168};
169 169
170/* Make it reside in writable memory, yet make compiler understand 170/* See test_ptr_hack.c */
171 * that it is not going to change. */ 171extern struct test_statics *const test_ptr_to_statics;
172static struct statics *const ptr_to_statics __attribute__ ((section (".data")));
173 172
174#define S (*ptr_to_statics) 173#define S (*test_ptr_to_statics)
175#define t_wp (S.t_wp ) 174#define t_wp (S.t_wp )
176#define t_wp_op (S.t_wp_op ) 175#define t_wp_op (S.t_wp_op )
177#define group_array (S.group_array ) 176#define group_array (S.group_array )
@@ -179,11 +178,11 @@ static struct statics *const ptr_to_statics __attribute__ ((section (".data")));
179#define leaving (S.leaving ) 178#define leaving (S.leaving )
180 179
181#define INIT_S() do { \ 180#define INIT_S() do { \
182 (*(struct statics**)&ptr_to_statics) = xzalloc(sizeof(S)); \ 181 (*(struct test_statics**)&test_ptr_to_statics) = xzalloc(sizeof(S)); \
183 barrier(); \ 182 barrier(); \
184} while (0) 183} while (0)
185#define DEINIT_S() do { \ 184#define DEINIT_S() do { \
186 free(ptr_to_statics); \ 185 free(test_ptr_to_statics); \
187} while (0) 186} while (0)
188 187
189static arith_t primary(enum token n); 188static arith_t primary(enum token n);
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