commit d8e2f76de22e99c197c000ccd4c1ecc097d312ba
parent 34a7b62dc2cc6c3b1d900e6441a00b8ecb7cab77
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 16 Mar 2023 03:16:10 +0100
driver/posix: Obey -o with -E
It makes sense to obey -o when used in combination with
-E and it does not make any sense to just ignore the
output file indicated with -o.
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/cmd/cc/posix/cc.c b/src/cmd/cc/posix/cc.c
@@ -255,7 +255,10 @@ settool(int tool, char *infile, int nexttool)
addarg(tool, ldcmd[n]);
break;
case TEEIR:
- t->outfile = outfname(infile, "ir");
+ if (Eflag && outfile)
+ t->outfile = xstrdup(outfile);
+ else
+ t->outfile = outfname(infile, "ir");
addarg(tool, t->outfile);
break;
case TEEQBE:
@@ -476,13 +479,15 @@ buildfile(char *file, int tool)
for (; tool < LAST_TOOL; tool = nexttool) {
switch (tool) {
case CC1:
- if (Eflag || Mflag)
+ if (Eflag && outfile)
+ nexttool = TEEIR;
+ else if (Eflag || Mflag)
nexttool = LAST_TOOL;
else
nexttool = kflag ? TEEIR : CC2;
break;
case TEEIR:
- nexttool = CC2;
+ nexttool = (Eflag) ? LAST_TOOL : CC2;
break;
case CC2:
if (Qflag)