aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2024-01-03 14:29:11 +0000
committerRon Yorston <rmy@pobox.com>2024-01-03 14:29:11 +0000
commit306601c86fa1cc6c210b7f18d597b8c0821ab19a (patch)
tree94177968ffcce05238e97847a5f4ae6481a73fb6 /shell
parentcca8c8e806db11810e25c8fa9446e86431aa2a53 (diff)
downloadbusybox-w32-306601c86fa1cc6c210b7f18d597b8c0821ab19a.tar.gz
busybox-w32-306601c86fa1cc6c210b7f18d597b8c0821ab19a.tar.bz2
busybox-w32-306601c86fa1cc6c210b7f18d597b8c0821ab19a.zip
win32: make the clang build less crashy
busybox-w32 binaries built using clang crashed so frequently that they were pretty much unusable. The main issue seems to be with assignments to the structures containing global variables which are used in most applets. Upstream commit 5156b2455 (Make const ptr assign as function call in clang) addresses this, but is insufficient for the build on Windows. Extend the idea to the ASSIGN_CONST_PTR() macro too. Costs 32-80 bytes in the gcc build.
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 8b7c6c627..adab63fa7 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -17279,8 +17279,6 @@ forkshell_init(const char *idstr)
17279 struct forkshell *fs; 17279 struct forkshell *fs;
17280 void *map_handle; 17280 void *map_handle;
17281 HANDLE h; 17281 HANDLE h;
17282 struct globals_var **gvpp;
17283 struct globals_misc **gmpp;
17284 int i; 17282 int i;
17285 char **ptr; 17283 char **ptr;
17286 char *lrelocate; 17284 char *lrelocate;
@@ -17323,10 +17321,8 @@ forkshell_init(const char *idstr)
17323 fs->gmp->trap_ptr = fs->gmp->trap; 17321 fs->gmp->trap_ptr = fs->gmp->trap;
17324 17322
17325 /* Set global variables */ 17323 /* Set global variables */
17326 gvpp = (struct globals_var **)&ash_ptr_to_globals_var; 17324 ASSIGN_CONST_PTR(&ash_ptr_to_globals_var, fs->gvp);
17327 *gvpp = fs->gvp; 17325 ASSIGN_CONST_PTR(&ash_ptr_to_globals_misc, fs->gmp);
17328 gmpp = (struct globals_misc **)&ash_ptr_to_globals_misc;
17329 *gmpp = fs->gmp;
17330 cmdtable = fs->cmdtable; 17326 cmdtable = fs->cmdtable;
17331#if ENABLE_ASH_ALIAS 17327#if ENABLE_ASH_ALIAS
17332 atab = fs->atab; /* will be NULL for FS_SHELLEXEC */ 17328 atab = fs->atab; /* will be NULL for FS_SHELLEXEC */