aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-27 18:41:59 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-27 18:41:59 +0000
commit574f2f43948bb21d6e4187936ba5a5afccba25f6 (patch)
tree0b39aca564149e5ad30b3cc791228655ff1b1827 /libbb
parentfe66a0eca1bfeae0abc0fc1e7d3709f271e05e82 (diff)
downloadbusybox-w32-574f2f43948bb21d6e4187936ba5a5afccba25f6.tar.gz
busybox-w32-574f2f43948bb21d6e4187936ba5a5afccba25f6.tar.bz2
busybox-w32-574f2f43948bb21d6e4187936ba5a5afccba25f6.zip
*: add optimization barrier to all "G trick" locations
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Kbuild1
-rw-r--r--libbb/appletlib.c1
-rw-r--r--libbb/lineedit.c1
-rw-r--r--libbb/messages.c4
-rw-r--r--libbb/ptr_to_globals.c11
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
69lib-y += printable.o 69lib-y += printable.o
70lib-y += process_escape_sequence.o 70lib-y += process_escape_sequence.o
71lib-y += procps.o 71lib-y += procps.o
72lib-y += ptr_to_globals.o
72lib-y += read.o 73lib-y += read.o
73lib-y += recursive_action.o 74lib-y += recursive_action.o
74lib-y += remove_file.o 75lib-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)
127{ 127{
128#ifdef __GLIBC__ 128#ifdef __GLIBC__
129 (*(int **)&bb_errno) = __errno_location(); 129 (*(int **)&bb_errno) = __errno_location();
130 barrier();
130#endif 131#endif
131 applet_name = applet; 132 applet_name = applet;
132 133
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")));
146 146
147#define INIT_S() do { \ 147#define INIT_S() do { \
148 (*(struct statics**)&ptr_to_statics) = xzalloc(sizeof(S)); \ 148 (*(struct statics**)&ptr_to_statics) = xzalloc(sizeof(S)); \
149 barrier(); \
149 cmdedit_termw = 80; \ 150 cmdedit_termw = 80; \
150 USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \ 151 USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines = 1;) \
151 USE_FEATURE_GETUSERNAME_AND_HOMEDIR(home_pwd_buf = (char*)null_str;) \ 152 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 =
71 * Since gcc insists on aligning struct global's members, it would be a pity 71 * Since gcc insists on aligning struct global's members, it would be a pity
72 * (and an alignment fault on some CPUs) to mess it up. */ 72 * (and an alignment fault on some CPUs) to mess it up. */
73char bb_common_bufsiz1[COMMON_BUFSIZE] __attribute__(( aligned(sizeof(long long)) )); 73char bb_common_bufsiz1[COMMON_BUFSIZE] __attribute__(( aligned(sizeof(long long)) ));
74
75struct globals;
76/* Make it reside in R/W memory: */
77struct 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 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details.
6 */
7
8/* We cheat here. It is declared as const ptr in libbb.h,
9 * but here we make it live in R/W memory */
10struct globals;
11struct globals *ptr_to_globals;