shithub: scc

Download patch

ref: f9b321d259601b941e2308af8f158b37c573f4a7
parent: 5bd54ca2361691cc4c3e5310bca43b4b69eb4806
author: Quentin Rameau <quinq@fifth.space>
date: Wed Apr 21 17:42:38 EDT 2021

cmd/cc: Fix cc1 tool name generation

Since edabe2f, there is no targe-specific cc1, and this change was
forgotten in the driver.

--- a/src/cmd/cc/posix/cc.c
+++ b/src/cmd/cc/posix/cc.c
@@ -141,14 +141,14 @@
 		newitem(&t->args, arg);
 }
 
-static int
-qbe(int tool)
+static char *
+cc12fmt(int tool)
 {
-	if (tool != CC2 || !Qflag)
-		return 0;
-	if (!strcmp(arch, "amd64") && !strcmp(abi, "sysv"))
-		return 1;
-	return 0;
+	if (tool == CC1)
+		return "%s";
+	if (Qflag && !strcmp(arch, "amd64") && !strcmp(abi, "sysv"))
+		return "%s-qbe_%s-%s";
+	return "%s-%s-%s";
 }
 
 static int
@@ -170,7 +170,7 @@
 			addarg(tool, path(sysincludes[n]));
 		}
 	case CC2:
-		fmt = (qbe(tool)) ? "%s-qbe_%s-%s" : "%s-%s-%s";
+		fmt = cc12fmt(tool);
 		n = snprintf(t->bin, sizeof(t->bin), fmt, t->cmd, arch, abi);
 		if (n < 0 || n >= sizeof(t->bin))
 			die("cc: target tool name is too long");