diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-03-15 19:48:35 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-03-15 19:48:35 +0000 |
commit | d6361d08a794e0e761dc06ea330eb7113496d72c (patch) | |
tree | 820b303027a64c7ce81bc084ce30140792b36d3a | |
parent | 5a7eb67e30594b1b96c679cfe41336aaf5815d93 (diff) | |
download | busybox-w32-d6361d08a794e0e761dc06ea330eb7113496d72c.tar.gz busybox-w32-d6361d08a794e0e761dc06ea330eb7113496d72c.tar.bz2 busybox-w32-d6361d08a794e0e761dc06ea330eb7113496d72c.zip |
gzip: Improve ptr_to_globals trick, allowing gcc
to optimize better. -480 bytes.
git-svn-id: svn://busybox.net/trunk/busybox@18121 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | archival/gzip.c | 4 | ||||
-rw-r--r-- | include/libbb.h | 5 | ||||
-rw-r--r-- | libbb/messages.c | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/archival/gzip.c b/archival/gzip.c index 6af6c1886..c2333e3b1 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -2045,8 +2045,8 @@ int gzip_main(int argc, char **argv) | |||
2045 | } | 2045 | } |
2046 | #endif | 2046 | #endif |
2047 | 2047 | ||
2048 | ptr_to_globals = xzalloc(sizeof(struct globals) + sizeof(struct globals2)); | 2048 | PTR_TO_GLOBALS = xzalloc(sizeof(struct globals) + sizeof(struct globals2)) |
2049 | ptr_to_globals++; | 2049 | + sizeof(struct globals); |
2050 | G2.l_desc.dyn_tree = G2.dyn_ltree; | 2050 | G2.l_desc.dyn_tree = G2.dyn_ltree; |
2051 | G2.l_desc.static_tree = G2.static_ltree; | 2051 | G2.l_desc.static_tree = G2.static_ltree; |
2052 | G2.l_desc.extra_bits = extra_lbits; | 2052 | G2.l_desc.extra_bits = extra_lbits; |
diff --git a/include/libbb.h b/include/libbb.h index 90fb0ad91..d68519dfa 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -804,7 +804,10 @@ extern char bb_common_bufsiz1[BUFSIZ+1]; | |||
804 | /* This struct is deliberately not defined. */ | 804 | /* This struct is deliberately not defined. */ |
805 | /* See docs/keep_data_small.txt */ | 805 | /* See docs/keep_data_small.txt */ |
806 | struct globals; | 806 | struct globals; |
807 | extern struct globals *ptr_to_globals; | 807 | /* Magic prevents this from going into rodata */ |
808 | /* If you want to assign a value, use PTR_TO_GLOBALS = xxx */ | ||
809 | extern struct globals *const ptr_to_globals; | ||
810 | #define PTR_TO_GLOBALS (*(struct globals**)&ptr_to_globals) | ||
808 | 811 | ||
809 | /* You can change LIBBB_DEFAULT_LOGIN_SHELL, but don't use it, | 812 | /* You can change LIBBB_DEFAULT_LOGIN_SHELL, but don't use it, |
810 | * use bb_default_login_shell and following defines. | 813 | * use bb_default_login_shell and following defines. |
diff --git a/libbb/messages.c b/libbb/messages.c index 1a10a8c9e..12a165ad7 100644 --- a/libbb/messages.c +++ b/libbb/messages.c | |||
@@ -57,4 +57,5 @@ WTMP_FILE; | |||
57 | char bb_common_bufsiz1[BUFSIZ+1]; | 57 | char bb_common_bufsiz1[BUFSIZ+1]; |
58 | 58 | ||
59 | struct globals; | 59 | struct globals; |
60 | struct globals *ptr_to_globals; | 60 | /* Make it reside in R/W memory: */ |
61 | struct globals *const ptr_to_globals __attribute__ ((section (".data"))); | ||