mirror of
https://github.com/sheumann/hush.git
synced 2024-12-26 10:32:02 +00:00
*: remove remaining instances of ".data" hack
This commit is contained in:
parent
9137341851
commit
5d89fbaa2e
@ -71,10 +71,10 @@ lib-$(CONFIG_SYNC) += sync.o
|
|||||||
lib-$(CONFIG_TAC) += tac.o
|
lib-$(CONFIG_TAC) += tac.o
|
||||||
lib-$(CONFIG_TAIL) += tail.o
|
lib-$(CONFIG_TAIL) += tail.o
|
||||||
lib-$(CONFIG_TEE) += tee.o
|
lib-$(CONFIG_TEE) += tee.o
|
||||||
lib-$(CONFIG_TEST) += test.o
|
lib-$(CONFIG_TEST) += test.o test_ptr_hack.o
|
||||||
lib-$(CONFIG_ASH) += test.o # used by ash
|
lib-$(CONFIG_ASH) += test.o test_ptr_hack.o # used by ash
|
||||||
lib-$(CONFIG_HUSH) += test.o # used by hush
|
lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o # used by hush
|
||||||
lib-$(CONFIG_MSH) += test.o # used by msh
|
lib-$(CONFIG_MSH) += test.o test_ptr_hack.o # used by msh
|
||||||
lib-$(CONFIG_TOUCH) += touch.o
|
lib-$(CONFIG_TOUCH) += touch.o
|
||||||
lib-$(CONFIG_TR) += tr.o
|
lib-$(CONFIG_TR) += tr.o
|
||||||
lib-$(CONFIG_TRUE) += true.o
|
lib-$(CONFIG_TRUE) += true.o
|
||||||
|
@ -159,7 +159,7 @@ typedef int arith_t;
|
|||||||
|
|
||||||
|
|
||||||
/* We try to minimize both static and stack usage. */
|
/* We try to minimize both static and stack usage. */
|
||||||
struct statics {
|
struct test_statics {
|
||||||
char **t_wp;
|
char **t_wp;
|
||||||
const struct t_op *t_wp_op;
|
const struct t_op *t_wp_op;
|
||||||
gid_t *group_array;
|
gid_t *group_array;
|
||||||
@ -167,11 +167,10 @@ struct statics {
|
|||||||
jmp_buf leaving;
|
jmp_buf leaving;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Make it reside in writable memory, yet make compiler understand
|
/* See test_ptr_hack.c */
|
||||||
* that it is not going to change. */
|
extern struct test_statics *const test_ptr_to_statics;
|
||||||
static struct statics *const ptr_to_statics __attribute__ ((section (".data")));
|
|
||||||
|
|
||||||
#define S (*ptr_to_statics)
|
#define S (*test_ptr_to_statics)
|
||||||
#define t_wp (S.t_wp )
|
#define t_wp (S.t_wp )
|
||||||
#define t_wp_op (S.t_wp_op )
|
#define t_wp_op (S.t_wp_op )
|
||||||
#define group_array (S.group_array )
|
#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 leaving (S.leaving )
|
||||||
|
|
||||||
#define INIT_S() do { \
|
#define INIT_S() do { \
|
||||||
(*(struct statics**)&ptr_to_statics) = xzalloc(sizeof(S)); \
|
(*(struct test_statics**)&test_ptr_to_statics) = xzalloc(sizeof(S)); \
|
||||||
barrier(); \
|
barrier(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define DEINIT_S() do { \
|
#define DEINIT_S() do { \
|
||||||
free(ptr_to_statics); \
|
free(test_ptr_to_statics); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static arith_t primary(enum token n);
|
static arith_t primary(enum token n);
|
||||||
|
@ -50,7 +50,7 @@ lib-y += inode_hash.o
|
|||||||
lib-y += isdirectory.o
|
lib-y += isdirectory.o
|
||||||
lib-y += kernel_version.o
|
lib-y += kernel_version.o
|
||||||
lib-y += last_char_is.o
|
lib-y += last_char_is.o
|
||||||
lib-y += lineedit.o
|
lib-y += lineedit.o lineedit_ptr_hack.o
|
||||||
lib-y += llist.o
|
lib-y += llist.o
|
||||||
lib-y += login.o
|
lib-y += login.o
|
||||||
lib-y += make_directory.o
|
lib-y += make_directory.o
|
||||||
|
@ -177,11 +177,6 @@ int find_applet_by_name(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
|
||||||
/* Make it reside in R/W memory: */
|
|
||||||
int *const bb_errno __attribute__ ((section (".data")));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void lbb_prepare(const char *applet
|
void lbb_prepare(const char *applet
|
||||||
USE_FEATURE_INDIVIDUAL(, char **argv))
|
USE_FEATURE_INDIVIDUAL(, char **argv))
|
||||||
MAIN_EXTERNALLY_VISIBLE;
|
MAIN_EXTERNALLY_VISIBLE;
|
||||||
|
@ -74,7 +74,7 @@ static const char null_str[] ALIGN1 = "";
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We try to minimize both static and stack usage. */
|
/* We try to minimize both static and stack usage. */
|
||||||
struct statics {
|
struct lineedit_statics {
|
||||||
line_input_t *state;
|
line_input_t *state;
|
||||||
|
|
||||||
volatile unsigned cmdedit_termw; /* = 80; */ /* actual terminal width */
|
volatile unsigned cmdedit_termw; /* = 80; */ /* actual terminal width */
|
||||||
@ -120,11 +120,10 @@ struct statics {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Make it reside in writable memory, yet make compiler understand
|
/* See lineedit_ptr_hack.c */
|
||||||
* that it is not going to change. */
|
extern struct lineedit_statics *const lineedit_ptr_to_statics;
|
||||||
static struct statics *const ptr_to_statics __attribute__ ((section (".data")));
|
|
||||||
|
|
||||||
#define S (*ptr_to_statics)
|
#define S (*lineedit_ptr_to_statics)
|
||||||
#define state (S.state )
|
#define state (S.state )
|
||||||
#define cmdedit_termw (S.cmdedit_termw )
|
#define cmdedit_termw (S.cmdedit_termw )
|
||||||
#define previous_SIGWINCH_handler (S.previous_SIGWINCH_handler)
|
#define previous_SIGWINCH_handler (S.previous_SIGWINCH_handler)
|
||||||
@ -145,7 +144,7 @@ static struct statics *const ptr_to_statics __attribute__ ((section (".data")));
|
|||||||
#define delbuf (S.delbuf )
|
#define delbuf (S.delbuf )
|
||||||
|
|
||||||
#define INIT_S() do { \
|
#define INIT_S() do { \
|
||||||
(*(struct statics**)&ptr_to_statics) = xzalloc(sizeof(S)); \
|
(*(struct lineedit_statics**)&lineedit_ptr_to_statics) = xzalloc(sizeof(S)); \
|
||||||
barrier(); \
|
barrier(); \
|
||||||
cmdedit_termw = 80; \
|
cmdedit_termw = 80; \
|
||||||
USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \
|
USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \
|
||||||
@ -163,7 +162,7 @@ static void deinit_S(void)
|
|||||||
if (home_pwd_buf != null_str)
|
if (home_pwd_buf != null_str)
|
||||||
free(home_pwd_buf);
|
free(home_pwd_buf);
|
||||||
#endif
|
#endif
|
||||||
free(ptr_to_statics);
|
free(lineedit_ptr_to_statics);
|
||||||
}
|
}
|
||||||
#define DEINIT_S() deinit_S()
|
#define DEINIT_S() deinit_S()
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
* Licensed under GPLv2, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
struct globals;
|
struct globals;
|
||||||
|
|
||||||
#ifndef GCC_COMBINE
|
#ifndef GCC_COMBINE
|
||||||
@ -13,12 +15,21 @@ struct globals;
|
|||||||
* but here we make it live in R/W memory */
|
* but here we make it live in R/W memory */
|
||||||
struct globals *ptr_to_globals;
|
struct globals *ptr_to_globals;
|
||||||
|
|
||||||
|
#ifdef __GLIBC__
|
||||||
|
int *bb_errno;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
||||||
/* gcc -combine will see through and complain */
|
/* gcc -combine will see through and complain */
|
||||||
/* Using alternative method which is more likely to break
|
/* Using alternative method which is more likely to break
|
||||||
* on weird architectures, compilers, linkers and so on */
|
* on weird architectures, compilers, linkers and so on */
|
||||||
struct globals *const ptr_to_globals __attribute__ ((section (".data")));
|
struct globals *const ptr_to_globals __attribute__ ((section (".data")));
|
||||||
|
|
||||||
|
#ifdef __GLIBC__
|
||||||
|
int *const bb_errno __attribute__ ((section (".data")));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user