shithub: scc

Download patch

ref: 4cdc5ac5e85a06bfd6f12d9aa29f367ca7342714
parent: ee35a53bd9302e84cfe2d29f2e0919b352c478eb
author: Quentin Rameau <quinq@fifth.space>
date: Thu Jun 2 15:17:14 EDT 2016

[driver] write as(1) output files to .o

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -42,7 +42,7 @@
 
 char *argv0;
 static char *arch;
-static char *outfiles[NR_TOOLS];
+static char *outfiles[NR_TOOLS + 1];
 static int failedtool = NR_TOOLS;
 static int Eflag, Sflag, kflag;
 
@@ -51,7 +51,7 @@
 {
 	int i;
 
-	for (i = 0; i < NR_TOOLS; ++i) {
+	for (i = 0; i < NR_TOOLS + 1; ++i) {
 		if (outfiles[i]) {
 			if (i > failedtool)
 				unlink(outfiles[i]);
@@ -99,6 +99,9 @@
 				die("scc: target tool path too long");
 			strcat(t->cmd, t->bin);
 			break;
+		case AS:
+			t->args[1] = "-o";
+			break;
 		default:
 			break;
 		}
@@ -142,6 +145,10 @@
 	switch (tool) {
 	case CC1:
 		t->args[1] = input;
+		break;
+	case AS:
+		outfiles[output] = newfileext(input, "o");
+		t->args[2] = outfiles[output];
 		break;
 	case TEE:
 		switch (output) {