*: add optimization barrier to all "G trick" locations

This commit is contained in:
Denis Vlasenko
2008-02-27 18:41:59 +00:00
parent fe66a0eca1
commit 574f2f4394
32 changed files with 97 additions and 64 deletions

View File

@@ -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

View File

@@ -127,6 +127,7 @@ void lbb_prepare(const char *applet, char **argv)
{
#ifdef __GLIBC__
(*(int **)&bb_errno) = __errno_location();
barrier();
#endif
applet_name = applet;

View File

@@ -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;) \

View File

@@ -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")));

11
libbb/ptr_to_globals.c Normal file
View File

@@ -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;