diff options
-rw-r--r-- | libbb/common_bufsiz.c | 4 | ||||
-rwxr-xr-x | scripts/generate_BUFSIZ.sh | 2 |
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)); | |||
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 |
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 | |||
77 | # users will need to malloc it. | 77 | # users will need to malloc it. |
78 | { | 78 | { |
79 | echo "enum { COMMON_BUFSIZE = 1024 };" | 79 | echo "enum { COMMON_BUFSIZE = 1024 };" |
80 | echo "extern char *bb_common_bufsiz1;" | 80 | echo "extern char *const bb_common_bufsiz1;" |
81 | echo "void setup_common_bufsiz(void);" | 81 | echo "void setup_common_bufsiz(void);" |
82 | } | regenerate "$common_bufsiz_h" | 82 | } | regenerate "$common_bufsiz_h" |
83 | # Check that we aren't left with a buggy binary: | 83 | # Check that we aren't left with a buggy binary: |