ref: ab3858dbbcf5547532bec3065777159af41beca2
parent: adda8658b4dcc5aa6b0ad7be0ba7b8ef3707112c
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Aug 23 15:35:11 EDT 2017
[driver] Add complex logic to determine if qbe is needed Qbe use depends of the value of Qflag, tool and the selected target, so it is better to use a different function and keep the logic there.
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -98,6 +98,16 @@
}
static int
+qbe(int tool)
+{
+ if (tool != CC2 || !Qflag)
+ return 0;
+ if (!strcmp(arch, "amd64") && !strcmp(abi, "sysv"))
+ return 1;
+ return 0;
+}
+
+static int
inittool(int tool)
{
struct tool *t = &tools[tool];
@@ -110,7 +120,7 @@
switch (tool) {
case CC1: /* FALLTHROUGH */
case CC2:
- fmt = (Qflag && tool == CC2) ? "%s-qbe_%s-%s" : "%s-%s-%s";
+ fmt = (qbe(tool)) ? "%s-qbe_%s-%s" : "%s-%s-%s";
n = snprintf(t->bin, sizeof(t->bin), fmt, t->cmd, arch, abi);
if (n < 0 || n >= sizeof(t->bin))
die("scc: target tool name too long");