diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-27 18:41:59 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-27 18:41:59 +0000 |
commit | 574f2f43948bb21d6e4187936ba5a5afccba25f6 (patch) | |
tree | 0b39aca564149e5ad30b3cc791228655ff1b1827 /include | |
parent | fe66a0eca1bfeae0abc0fc1e7d3709f271e05e82 (diff) | |
download | busybox-574f2f43948bb21d6e4187936ba5a5afccba25f6.tar.gz |
*: add optimization barrier to all "G trick" locations
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index 707e8d69b..8305e59fc 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1208,10 +1208,14 @@ extern char bb_common_bufsiz1[COMMON_BUFSIZE]; struct globals; /* '*const' ptr makes gcc optimize code much better. * Magic prevents ptr_to_globals from going into rodata. - * If you want to assign a value, use PTR_TO_GLOBALS = xxx */ + * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */ extern struct globals *const ptr_to_globals; -#define PTR_TO_GLOBALS (*(struct globals**)&ptr_to_globals) - +/* At least gcc 3.4.6 on mipsel system needs optimization barrier */ +#define barrier() asm volatile("":::"memory") +#define SET_PTR_TO_GLOBALS(x) do { \ + (*(struct globals**)&ptr_to_globals) = (x); \ + barrier(); \ +} while (0) /* You can change LIBBB_DEFAULT_LOGIN_SHELL, but don't use it, * use bb_default_login_shell and following defines. |