diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-04-21 21:47:45 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-04-21 21:47:45 +0200 |
commit | 93e1aaa1c7e5ed6d2704262700ec28837bdfc9b7 (patch) | |
tree | ff6196f459e660dcce943bf0e1f79a46cf09e6fc /libbb | |
parent | f56fb5eb1120a92bdfb6d0ce64b3430b42a2efa0 (diff) | |
download | busybox-w32-93e1aaa1c7e5ed6d2704262700ec28837bdfc9b7.tar.gz busybox-w32-93e1aaa1c7e5ed6d2704262700ec28837bdfc9b7.tar.bz2 busybox-w32-93e1aaa1c7e5ed6d2704262700ec28837bdfc9b7.zip |
libbb: constify *bb_common_bufsiz1 (if it is compiled to be a pointer)
This lets gcc optimize much better:
text data bss dec hex filename
922846 910 13056 936812 e4b6c busybox_unstripped.nonconst
920255 910 13056 934221 e414d busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/common_bufsiz.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/common_bufsiz.c b/libbb/common_bufsiz.c index 26faafcbb..1a3585169 100644 --- a/libbb/common_bufsiz.c +++ b/libbb/common_bufsiz.c | |||
@@ -58,11 +58,11 @@ char bb_common_bufsiz1[COMMON_BUFSIZE] ALIGNED(sizeof(long long)); | |||
58 | * It is not defined as a dummy macro. | 58 | * It is not defined as a dummy macro. |
59 | * It means we have to provide this function. | 59 | * It means we have to provide this function. |
60 | */ | 60 | */ |
61 | char* bb_common_bufsiz1; | 61 | char *const bb_common_bufsiz1 __attribute__ ((section (".data"))); |
62 | void setup_common_bufsiz(void) | 62 | void setup_common_bufsiz(void) |
63 | { | 63 | { |
64 | if (!bb_common_bufsiz1) | 64 | if (!bb_common_bufsiz1) |
65 | bb_common_bufsiz1 = xzalloc(COMMON_BUFSIZE); | 65 | *(char**)&bb_common_bufsiz1 = xzalloc(COMMON_BUFSIZE); |
66 | } | 66 | } |
67 | # else | 67 | # else |
68 | # ifndef bb_common_bufsiz1 | 68 | # ifndef bb_common_bufsiz1 |