summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--libbb/common_bufsiz.c4
-rwxr-xr-xscripts/generate_BUFSIZ.sh2
2 files changed, 3 insertions, 3 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));
* It is not defined as a dummy macro.
* 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)
{
if (!bb_common_bufsiz1)
- bb_common_bufsiz1 = xzalloc(COMMON_BUFSIZE);
+ *(char**)&bb_common_bufsiz1 = xzalloc(COMMON_BUFSIZE);
}
# else
# ifndef bb_common_bufsiz1
diff --git a/scripts/generate_BUFSIZ.sh b/scripts/generate_BUFSIZ.sh
index d54142597..1914fa0f5 100755
--- a/scripts/generate_BUFSIZ.sh
+++ b/scripts/generate_BUFSIZ.sh
@@ -77,7 +77,7 @@ if test $REM -lt 1024; then
# users will need to malloc it.
{
echo "enum { COMMON_BUFSIZE = 1024 };"
- echo "extern char *bb_common_bufsiz1;"
+ echo "extern char *const bb_common_bufsiz1;"
echo "void setup_common_bufsiz(void);"
} | regenerate "$common_bufsiz_h"
# Check that we aren't left with a buggy binary: