diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-12 20:58:27 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-12 20:58:27 +0000 |
commit | 6ca409e0e4c198fe3081346eebbae3f068fe605a (patch) | |
tree | 060cb05d99220a1eda399194d1209c269f0e8cd8 /shell/ash.c | |
parent | 4185548984357df91311f30c8e43d95f33922576 (diff) | |
download | busybox-w32-6ca409e0e4c198fe3081346eebbae3f068fe605a.tar.gz busybox-w32-6ca409e0e4c198fe3081346eebbae3f068fe605a.tar.bz2 busybox-w32-6ca409e0e4c198fe3081346eebbae3f068fe605a.zip |
trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts
size saving: 0.5k
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/shell/ash.c b/shell/ash.c index d34f5207f..9aec8ee0a 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -91,10 +91,10 @@ static const char *const optletters_optnames[] = { | |||
91 | "a" "allexport", | 91 | "a" "allexport", |
92 | "b" "notify", | 92 | "b" "notify", |
93 | "u" "nounset", | 93 | "u" "nounset", |
94 | "\0" "vi", | 94 | "\0" "vi" |
95 | #if DEBUG | 95 | #if DEBUG |
96 | "\0" "nolog", | 96 | ,"\0" "nolog" |
97 | "\0" "debug", | 97 | ,"\0" "debug" |
98 | #endif | 98 | #endif |
99 | }; | 99 | }; |
100 | 100 | ||
@@ -103,7 +103,7 @@ static const char *const optletters_optnames[] = { | |||
103 | 103 | ||
104 | enum { NOPTS = ARRAY_SIZE(optletters_optnames) }; | 104 | enum { NOPTS = ARRAY_SIZE(optletters_optnames) }; |
105 | 105 | ||
106 | static char optlist[NOPTS]; | 106 | static char optlist[NOPTS] ALIGN1; |
107 | 107 | ||
108 | #define eflag optlist[0] | 108 | #define eflag optlist[0] |
109 | #define fflag optlist[1] | 109 | #define fflag optlist[1] |
@@ -127,12 +127,12 @@ static char optlist[NOPTS]; | |||
127 | 127 | ||
128 | /* ============ Misc data */ | 128 | /* ============ Misc data */ |
129 | 129 | ||
130 | static char nullstr[1]; /* zero length string */ | 130 | static char nullstr[1] ALIGN1; /* zero length string */ |
131 | static const char homestr[] = "HOME"; | 131 | static const char homestr[] ALIGN1 = "HOME"; |
132 | static const char snlfmt[] = "%s\n"; | 132 | static const char snlfmt[] ALIGN1 = "%s\n"; |
133 | static const char illnum[] = "Illegal number: %s"; | 133 | static const char illnum[] ALIGN1 = "Illegal number: %s"; |
134 | 134 | ||
135 | static char *minusc; /* argument to -c option */ | 135 | static char *minusc; /* argument to -c option */ |
136 | 136 | ||
137 | /* pid of main shell */ | 137 | /* pid of main shell */ |
138 | static int rootpid; | 138 | static int rootpid; |
@@ -447,7 +447,9 @@ out2str(const char *p) | |||
447 | #define VSTRIMLEFTMAX 0x9 /* ${var##pattern} */ | 447 | #define VSTRIMLEFTMAX 0x9 /* ${var##pattern} */ |
448 | #define VSLENGTH 0xa /* ${#var} */ | 448 | #define VSLENGTH 0xa /* ${#var} */ |
449 | 449 | ||
450 | static const char dolatstr[] = { CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0' }; | 450 | static const char dolatstr[] ALIGN1 = { |
451 | CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0' | ||
452 | }; | ||
451 | 453 | ||
452 | #define NCMD 0 | 454 | #define NCMD 0 |
453 | #define NPIPE 1 | 455 | #define NPIPE 1 |
@@ -1583,10 +1585,10 @@ static unsigned long rseed; | |||
1583 | #endif | 1585 | #endif |
1584 | 1586 | ||
1585 | #ifdef IFS_BROKEN | 1587 | #ifdef IFS_BROKEN |
1586 | static const char defifsvar[] = "IFS= \t\n"; | 1588 | static const char defifsvar[] ALIGN1 = "IFS= \t\n"; |
1587 | #define defifs (defifsvar + 4) | 1589 | #define defifs (defifsvar + 4) |
1588 | #else | 1590 | #else |
1589 | static const char defifs[] = " \t\n"; | 1591 | static const char defifs[] ALIGN1 = " \t\n"; |
1590 | #endif | 1592 | #endif |
1591 | 1593 | ||
1592 | struct shparam { | 1594 | struct shparam { |
@@ -2548,16 +2550,16 @@ static const char S_I_T[][3] = { | |||
2548 | static int | 2550 | static int |
2549 | SIT(int c, int syntax) | 2551 | SIT(int c, int syntax) |
2550 | { | 2552 | { |
2551 | static const char spec_symbls[] = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~"; | 2553 | static const char spec_symbls[] ALIGN1 = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~"; |
2552 | #if ENABLE_ASH_ALIAS | 2554 | #if ENABLE_ASH_ALIAS |
2553 | static const char syntax_index_table[] = { | 2555 | static const char syntax_index_table[] ALIGN1 = { |
2554 | 1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */ | 2556 | 1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */ |
2555 | 7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */ | 2557 | 7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */ |
2556 | 3, 1, 3, 3, 9, 3, 10, 1, /* "=>?[\\]`|" */ | 2558 | 3, 1, 3, 3, 9, 3, 10, 1, /* "=>?[\\]`|" */ |
2557 | 11, 3 /* "}~" */ | 2559 | 11, 3 /* "}~" */ |
2558 | }; | 2560 | }; |
2559 | #else | 2561 | #else |
2560 | static const char syntax_index_table[] = { | 2562 | static const char syntax_index_table[] ALIGN1 = { |
2561 | 0, 1, 0, 2, 3, 4, 0, 5, /* "\t\n !\"$&'" */ | 2563 | 0, 1, 0, 2, 3, 4, 0, 5, /* "\t\n !\"$&'" */ |
2562 | 6, 7, 2, 2, 2, 2, 0, 0, /* "()*-/:;<" */ | 2564 | 6, 7, 2, 2, 2, 2, 0, 0, /* "()*-/:;<" */ |
2563 | 2, 0, 2, 2, 8, 2, 9, 0, /* "=>?[\\]`|" */ | 2565 | 2, 0, 2, 2, 8, 2, 9, 0, /* "=>?[\\]`|" */ |
@@ -5003,7 +5005,7 @@ esclen(const char *start, const char *p) | |||
5003 | static char * | 5005 | static char * |
5004 | _rmescapes(char *str, int flag) | 5006 | _rmescapes(char *str, int flag) |
5005 | { | 5007 | { |
5006 | static const char qchars[] = { CTLESC, CTLQUOTEMARK, '\0' }; | 5008 | static const char qchars[] ALIGN1 = { CTLESC, CTLQUOTEMARK, '\0' }; |
5007 | 5009 | ||
5008 | char *p, *q, *r; | 5010 | char *p, *q, *r; |
5009 | unsigned inquotes; | 5011 | unsigned inquotes; |
@@ -5420,7 +5422,7 @@ static char *evalvar(char *p, int flag); | |||
5420 | static void | 5422 | static void |
5421 | argstr(char *p, int flag) | 5423 | argstr(char *p, int flag) |
5422 | { | 5424 | { |
5423 | static const char spclchars[] = { | 5425 | static const char spclchars[] ALIGN1 = { |
5424 | '=', | 5426 | '=', |
5425 | ':', | 5427 | ':', |
5426 | CTLQUOTEMARK, | 5428 | CTLQUOTEMARK, |
@@ -6266,7 +6268,7 @@ expsort(struct strlist *str) | |||
6266 | static void | 6268 | static void |
6267 | expandmeta(struct strlist *str, int flag) | 6269 | expandmeta(struct strlist *str, int flag) |
6268 | { | 6270 | { |
6269 | static const char metachars[] = { | 6271 | static const char metachars[] ALIGN1 = { |
6270 | '*', '?', '[', 0 | 6272 | '*', '?', '[', 0 |
6271 | }; | 6273 | }; |
6272 | /* TODO - EXP_REDIR */ | 6274 | /* TODO - EXP_REDIR */ |
@@ -10200,7 +10202,7 @@ parsesub: { | |||
10200 | int typeloc; | 10202 | int typeloc; |
10201 | int flags; | 10203 | int flags; |
10202 | char *p; | 10204 | char *p; |
10203 | static const char types[] = "}-+?="; | 10205 | static const char types[] ALIGN1 = "}-+?="; |
10204 | 10206 | ||
10205 | c = pgetc(); | 10207 | c = pgetc(); |
10206 | if ( | 10208 | if ( |
@@ -10496,13 +10498,15 @@ parsearith: { | |||
10496 | #define NEW_xxreadtoken | 10498 | #define NEW_xxreadtoken |
10497 | #ifdef NEW_xxreadtoken | 10499 | #ifdef NEW_xxreadtoken |
10498 | /* singles must be first! */ | 10500 | /* singles must be first! */ |
10499 | static const char xxreadtoken_chars[7] = { '\n', '(', ')', '&', '|', ';', 0 }; | 10501 | static const char xxreadtoken_chars[7] ALIGN1 = { |
10502 | '\n', '(', ')', '&', '|', ';', 0 | ||
10503 | }; | ||
10500 | 10504 | ||
10501 | static const char xxreadtoken_tokens[] = { | 10505 | static const char xxreadtoken_tokens[] ALIGN1 = { |
10502 | TNL, TLP, TRP, /* only single occurrence allowed */ | 10506 | TNL, TLP, TRP, /* only single occurrence allowed */ |
10503 | TBACKGND, TPIPE, TSEMI, /* if single occurrence */ | 10507 | TBACKGND, TPIPE, TSEMI, /* if single occurrence */ |
10504 | TEOF, /* corresponds to trailing nul */ | 10508 | TEOF, /* corresponds to trailing nul */ |
10505 | TAND, TOR, TENDCASE, /* if double occurrence */ | 10509 | TAND, TOR, TENDCASE /* if double occurrence */ |
10506 | }; | 10510 | }; |
10507 | 10511 | ||
10508 | #define xxreadtoken_doubles \ | 10512 | #define xxreadtoken_doubles \ |
@@ -11379,7 +11383,7 @@ unsetcmd(int argc, char **argv) | |||
11379 | 11383 | ||
11380 | #include <sys/times.h> | 11384 | #include <sys/times.h> |
11381 | 11385 | ||
11382 | static const unsigned char timescmd_str[] = { | 11386 | static const unsigned char timescmd_str[] ALIGN1 = { |
11383 | ' ', offsetof(struct tms, tms_utime), | 11387 | ' ', offsetof(struct tms, tms_utime), |
11384 | '\n', offsetof(struct tms, tms_stime), | 11388 | '\n', offsetof(struct tms, tms_stime), |
11385 | ' ', offsetof(struct tms, tms_cutime), | 11389 | ' ', offsetof(struct tms, tms_cutime), |
@@ -11659,9 +11663,9 @@ readcmd(int argc, char **argv) | |||
11659 | static int | 11663 | static int |
11660 | umaskcmd(int argc, char **argv) | 11664 | umaskcmd(int argc, char **argv) |
11661 | { | 11665 | { |
11662 | static const char permuser[3] = "ugo"; | 11666 | static const char permuser[3] ALIGN1 = "ugo"; |
11663 | static const char permmode[3] = "rwx"; | 11667 | static const char permmode[3] ALIGN1 = "rwx"; |
11664 | static const short int permmask[] = { | 11668 | static const short permmask[] ALIGN2 = { |
11665 | S_IRUSR, S_IWUSR, S_IXUSR, | 11669 | S_IRUSR, S_IWUSR, S_IXUSR, |
11666 | S_IRGRP, S_IWGRP, S_IXGRP, | 11670 | S_IRGRP, S_IWGRP, S_IXGRP, |
11667 | S_IROTH, S_IWOTH, S_IXOTH | 11671 | S_IROTH, S_IWOTH, S_IXOTH |
@@ -12318,7 +12322,7 @@ arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr) | |||
12318 | } | 12322 | } |
12319 | 12323 | ||
12320 | /* longest must be first */ | 12324 | /* longest must be first */ |
12321 | static const char op_tokens[] = { | 12325 | static const char op_tokens[] ALIGN1 = { |
12322 | '<','<','=',0, TOK_LSHIFT_ASSIGN, | 12326 | '<','<','=',0, TOK_LSHIFT_ASSIGN, |
12323 | '>','>','=',0, TOK_RSHIFT_ASSIGN, | 12327 | '>','>','=',0, TOK_RSHIFT_ASSIGN, |
12324 | '<','<', 0, TOK_LSHIFT, | 12328 | '<','<', 0, TOK_LSHIFT, |