From 5d89fbaa2e00a8a26e530306d76b78bf91d12ec8 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 22 Apr 2008 00:08:27 +0000 Subject: *: remove remaining instances of ".data" hack --- coreutils/Kbuild | 8 ++++---- coreutils/test.c | 13 ++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'coreutils') 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 lib-$(CONFIG_TAC) += tac.o lib-$(CONFIG_TAIL) += tail.o lib-$(CONFIG_TEE) += tee.o -lib-$(CONFIG_TEST) += test.o -lib-$(CONFIG_ASH) += test.o # used by ash -lib-$(CONFIG_HUSH) += test.o # used by hush -lib-$(CONFIG_MSH) += test.o # used by msh +lib-$(CONFIG_TEST) += test.o test_ptr_hack.o +lib-$(CONFIG_ASH) += test.o test_ptr_hack.o # used by ash +lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o # used by hush +lib-$(CONFIG_MSH) += test.o test_ptr_hack.o # used by msh lib-$(CONFIG_TOUCH) += touch.o lib-$(CONFIG_TR) += tr.o 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; /* We try to minimize both static and stack usage. */ -struct statics { +struct test_statics { char **t_wp; const struct t_op *t_wp_op; gid_t *group_array; @@ -167,11 +167,10 @@ struct statics { jmp_buf leaving; }; -/* Make it reside in writable memory, yet make compiler understand - * that it is not going to change. */ -static struct statics *const ptr_to_statics __attribute__ ((section (".data"))); +/* See test_ptr_hack.c */ +extern struct test_statics *const test_ptr_to_statics; -#define S (*ptr_to_statics) +#define S (*test_ptr_to_statics) #define t_wp (S.t_wp ) #define t_wp_op (S.t_wp_op ) #define group_array (S.group_array ) @@ -179,11 +178,11 @@ static struct statics *const ptr_to_statics __attribute__ ((section (".data"))); #define leaving (S.leaving ) #define INIT_S() do { \ - (*(struct statics**)&ptr_to_statics) = xzalloc(sizeof(S)); \ + (*(struct test_statics**)&test_ptr_to_statics) = xzalloc(sizeof(S)); \ barrier(); \ } while (0) #define DEINIT_S() do { \ - free(ptr_to_statics); \ + free(test_ptr_to_statics); \ } while (0) static arith_t primary(enum token n); -- cgit v1.2.3