shithub: scc

Download patch

ref: 045135ee7f1ed7f646321a08fed76edeff108eb8
parent: 6d5bea0f5b5b0e0f4c92bce3b1819f4cd52892f7
author: Quentin Rameau <quinq@fifth.space>
date: Sat Jun 4 09:12:17 EDT 2016

[driver] add o flag for linking to specified file

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -160,10 +160,9 @@
 		t->args[2] = t->outfile;
 		break;
 	case LD:
-		if (!t->outfile) {
+		if (!t->outfile)
 			t->outfile = "a.out";
-			t->args[2] = t->outfile;
-		}
+		t->args[2] = t->outfile;
 		break;
 	case TEE:
 		switch (nexttool) {
@@ -354,7 +353,7 @@
 static void
 usage(void)
 {
-	die("usage: %s [-E|-kS] [-m arch] [-D macro[=val]]... "
+	die("usage: %s [-E|-kS] [-m arch] [-o binout] [-D macro[=val]]... "
 	    "[-I dir]... file ...", argv0);
 }
 
@@ -386,6 +385,9 @@
 		break;
 	case 'm':
 		arch = EARGF(usage());
+		break;
+	case 'o':
+		tools[LD].outfile = EARGF(usage());
 		break;
 	case '-':
 		fprintf(stderr,