cc.h: add `little' flag; lex.c: recognise -l, sort the list of options; swt.c: don't do big-endian adjustment under -l. Reference: /n/sources/patch/applied/vc-l Date: Sat Mar 25 08:39:40 CET 2006 Signed-off-by: geoff@collyer.net --- /sys/src/cmd/cc/cc.h Sat Mar 25 08:38:18 2006 +++ /sys/src/cmd/cc/cc.h Sat Mar 25 08:38:15 2006 @@ -476,6 +476,7 @@ EXTERN int fproundflg; EXTERN int profileflg; EXTERN Bits zbits; +EXTERN int little; extern char *onames[], *tnames[], *gnames[]; extern char *cnames[], *qnames[], *bnames[]; --- /sys/src/cmd/cc/lex.c Sat Mar 25 08:38:34 2006 +++ /sys/src/cmd/cc/lex.c Sat Mar 25 08:38:29 2006 @@ -7,27 +7,28 @@ /* * known debug flags - * -o file output file - * -D name define - * -I path include * -a acid declaration output - * -M constant multiplication - * -B non ANSI * -A !B + * -B non ANSI * -d print declarations - * -t print type trees - * -L print every NAME symbol - * -i print initialization + * -D name define * -F format specification check - * -r print registerization - * -v verbose printing - * -X abort on error - * -w print warnings + * -i print initialization + * -I path include + * -l generate little-endian code + * -L print every NAME symbol + * -M constant multiplication * -m print add/sub/mul trees - * -s print structure offsets (with -a or -aa) * -n print acid to file (%.c=%.acid) (with -a or -aa) + * -o file output file * -p use standard cpp ANSI preprocessor (not on windows) + * -r print registerization + * -s print structure offsets (with -a or -aa) + * -t print type trees * -V enable void* conversion warnings + * -v verbose printing + * -w print warnings + * -X abort on error */ void @@ -52,6 +53,12 @@ c = ARGC(); if(c >= 0 && c < sizeof(debug)) debug[c]++; + break; + + case 'l': /* for little-endian mips */ + thechar = '0'; + thestring = "spim"; + little = 1; break; case 'o': --- /sys/src/cmd/vc/swt.c Sat Mar 25 08:38:52 2006 +++ /sys/src/cmd/vc/swt.c Sat Mar 25 08:38:48 2006 @@ -636,7 +636,8 @@ w = SZ_LONG; break; } - o += SZ_LONG - w; /* big endian adjustment */ + if (!little) + o += SZ_LONG - w; /* big endian adjustment */ w = 1; break;