diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-22 00:08:27 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-22 00:08:27 +0000 |
| commit | 5d89fbaa2e00a8a26e530306d76b78bf91d12ec8 (patch) | |
| tree | 44d54f6dfbd0f6270fb0b1aba0195bc53db8bef4 | |
| parent | 9137341851f3ab89f5c6a54a6baff68f0f4a5e17 (diff) | |
| download | busybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.tar.gz busybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.tar.bz2 busybox-w32-5d89fbaa2e00a8a26e530306d76b78bf91d12ec8.zip | |
*: remove remaining instances of ".data" hack
| -rw-r--r-- | coreutils/Kbuild | 8 | ||||
| -rw-r--r-- | coreutils/test.c | 13 | ||||
| -rw-r--r-- | libbb/Kbuild | 2 | ||||
| -rw-r--r-- | libbb/appletlib.c | 5 | ||||
| -rw-r--r-- | libbb/lineedit.c | 13 | ||||
| -rw-r--r-- | libbb/ptr_to_globals.c | 11 |
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 | |||
| 71 | lib-$(CONFIG_TAC) += tac.o | 71 | lib-$(CONFIG_TAC) += tac.o |
| 72 | lib-$(CONFIG_TAIL) += tail.o | 72 | lib-$(CONFIG_TAIL) += tail.o |
| 73 | lib-$(CONFIG_TEE) += tee.o | 73 | lib-$(CONFIG_TEE) += tee.o |
| 74 | lib-$(CONFIG_TEST) += test.o | 74 | lib-$(CONFIG_TEST) += test.o test_ptr_hack.o |
| 75 | lib-$(CONFIG_ASH) += test.o # used by ash | 75 | lib-$(CONFIG_ASH) += test.o test_ptr_hack.o # used by ash |
| 76 | lib-$(CONFIG_HUSH) += test.o # used by hush | 76 | lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o # used by hush |
| 77 | lib-$(CONFIG_MSH) += test.o # used by msh | 77 | lib-$(CONFIG_MSH) += test.o test_ptr_hack.o # used by msh |
| 78 | lib-$(CONFIG_TOUCH) += touch.o | 78 | lib-$(CONFIG_TOUCH) += touch.o |
| 79 | lib-$(CONFIG_TR) += tr.o | 79 | lib-$(CONFIG_TR) += tr.o |
| 80 | lib-$(CONFIG_TRUE) += true.o | 80 | lib-$(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. */ |
| 162 | struct statics { | 162 | struct 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. */ | 171 | extern struct test_statics *const test_ptr_to_statics; |
| 172 | static 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 | ||
| 189 | static arith_t primary(enum token n); | 188 | static 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 | |||
| 50 | lib-y += isdirectory.o | 50 | lib-y += isdirectory.o |
| 51 | lib-y += kernel_version.o | 51 | lib-y += kernel_version.o |
| 52 | lib-y += last_char_is.o | 52 | lib-y += last_char_is.o |
| 53 | lib-y += lineedit.o | 53 | lib-y += lineedit.o lineedit_ptr_hack.o |
| 54 | lib-y += llist.o | 54 | lib-y += llist.o |
| 55 | lib-y += login.o | 55 | lib-y += login.o |
| 56 | lib-y += make_directory.o | 56 | lib-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: */ | ||
| 182 | int *const bb_errno __attribute__ ((section (".data"))); | ||
| 183 | #endif | ||
| 184 | |||
| 185 | void lbb_prepare(const char *applet | 180 | void 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. */ |
| 77 | struct statics { | 77 | struct 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. */ | 124 | extern struct lineedit_statics *const lineedit_ptr_to_statics; |
| 125 | static 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 | |||
| 8 | struct globals; | 10 | struct 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 */ |
| 14 | struct globals *ptr_to_globals; | 16 | struct globals *ptr_to_globals; |
| 15 | 17 | ||
| 18 | #ifdef __GLIBC__ | ||
| 19 | int *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 */ |
| 21 | struct globals *const ptr_to_globals __attribute__ ((section (".data"))); | 29 | struct globals *const ptr_to_globals __attribute__ ((section (".data"))); |
| 22 | 30 | ||
| 31 | #ifdef __GLIBC__ | ||
| 32 | int *const bb_errno __attribute__ ((section (".data"))); | ||
| 23 | #endif | 33 | #endif |
| 24 | 34 | ||
| 35 | #endif | ||
