diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Kbuild | 1 | ||||
-rw-r--r-- | libbb/appletlib.c | 1 | ||||
-rw-r--r-- | libbb/lineedit.c | 1 | ||||
-rw-r--r-- | libbb/messages.c | 4 | ||||
-rw-r--r-- | libbb/ptr_to_globals.c | 11 |
5 files changed, 14 insertions, 4 deletions
diff --git a/libbb/Kbuild b/libbb/Kbuild index fc87f625b..fd366559a 100644 --- a/libbb/Kbuild +++ b/libbb/Kbuild @@ -69,6 +69,7 @@ lib-y += pidfile.o lib-y += printable.o lib-y += process_escape_sequence.o lib-y += procps.o +lib-y += ptr_to_globals.o lib-y += read.o lib-y += recursive_action.o lib-y += remove_file.o diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 793e3dc96..fec99c5ce 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -127,6 +127,7 @@ void lbb_prepare(const char *applet, char **argv) { #ifdef __GLIBC__ (*(int **)&bb_errno) = __errno_location(); + barrier(); #endif applet_name = applet; diff --git a/libbb/lineedit.c b/libbb/lineedit.c index c6aa45c93..d716169d4 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -146,6 +146,7 @@ static struct statics *const ptr_to_statics __attribute__ ((section (".data"))); #define INIT_S() do { \ (*(struct statics**)&ptr_to_statics) = xzalloc(sizeof(S)); \ + barrier(); \ cmdedit_termw = 80; \ USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \ USE_FEATURE_GETUSERNAME_AND_HOMEDIR(home_pwd_buf = (char*)null_str;) \ diff --git a/libbb/messages.c b/libbb/messages.c index 2a011f815..74a070c49 100644 --- a/libbb/messages.c +++ b/libbb/messages.c @@ -71,7 +71,3 @@ const char bb_path_wtmp_file[] ALIGN1 = * Since gcc insists on aligning struct global's members, it would be a pity * (and an alignment fault on some CPUs) to mess it up. */ char bb_common_bufsiz1[COMMON_BUFSIZE] __attribute__(( aligned(sizeof(long long)) )); - -struct globals; -/* Make it reside in R/W memory: */ -struct globals *const ptr_to_globals __attribute__ ((section (".data"))); diff --git a/libbb/ptr_to_globals.c b/libbb/ptr_to_globals.c new file mode 100644 index 000000000..f8ccbf142 --- /dev/null +++ b/libbb/ptr_to_globals.c @@ -0,0 +1,11 @@ +/* vi: set sw=4 ts=4: */ +/* + * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com> + * + * Licensed under GPLv2, see file LICENSE in this tarball for details. + */ + +/* We cheat here. It is declared as const ptr in libbb.h, + * but here we make it live in R/W memory */ +struct globals; +struct globals *ptr_to_globals; |