diff options
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/Kbuild | 8 | ||||
| -rw-r--r-- | coreutils/test.c | 13 |
2 files changed, 10 insertions, 11 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); |
