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>
This commit is contained in:
parent
f56fb5eb11
commit
93e1aaa1c7
@ -58,11 +58,11 @@ char bb_common_bufsiz1[COMMON_BUFSIZE] ALIGNED(sizeof(long long));
|
|||||||
* It is not defined as a dummy macro.
|
* It is not defined as a dummy macro.
|
||||||
* It means we have to provide this function.
|
* It means we have to provide this function.
|
||||||
*/
|
*/
|
||||||
char* bb_common_bufsiz1;
|
char *const bb_common_bufsiz1 __attribute__ ((section (".data")));
|
||||||
void setup_common_bufsiz(void)
|
void setup_common_bufsiz(void)
|
||||||
{
|
{
|
||||||
if (!bb_common_bufsiz1)
|
if (!bb_common_bufsiz1)
|
||||||
bb_common_bufsiz1 = xzalloc(COMMON_BUFSIZE);
|
*(char**)&bb_common_bufsiz1 = xzalloc(COMMON_BUFSIZE);
|
||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
# ifndef bb_common_bufsiz1
|
# ifndef bb_common_bufsiz1
|
||||||
|
@ -77,7 +77,7 @@ if test $REM -lt 1024; then
|
|||||||
# users will need to malloc it.
|
# users will need to malloc it.
|
||||||
{
|
{
|
||||||
echo "enum { COMMON_BUFSIZE = 1024 };"
|
echo "enum { COMMON_BUFSIZE = 1024 };"
|
||||||
echo "extern char *bb_common_bufsiz1;"
|
echo "extern char *const bb_common_bufsiz1;"
|
||||||
echo "void setup_common_bufsiz(void);"
|
echo "void setup_common_bufsiz(void);"
|
||||||
} | regenerate "$common_bufsiz_h"
|
} | regenerate "$common_bufsiz_h"
|
||||||
# Check that we aren't left with a buggy binary:
|
# Check that we aren't left with a buggy binary:
|
||||||
|
Loading…
Reference in New Issue
Block a user