summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-09-18 23:59:03 -0400
committermidipix <writeonce@midipix.org>2016-09-19 00:11:04 -0400
commitc67e64bc2f3e482943ef699d1010499fa8ac642b (patch)
tree596e1b71e61a925d94b5103ad1f1b00c361a9789 /src/driver
parente7323083cef75db971720fd4367c78cfc3ec4d08 (diff)
downloadslibtool-c67e64bc2f3e482943ef699d1010499fa8ac642b.tar.bz2
slibtool-c67e64bc2f3e482943ef699d1010499fa8ac642b.tar.xz
driver: accommodate hosts that occasionally use '-portbld-' in their triple.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/slbt_driver_ctx.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 9c664d3..1379731 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -374,6 +374,7 @@ static int slbt_init_host_params(
size_t toollen;
char * dash;
char * base;
+ char * mark;
const char * machine;
bool ftarget = false;
bool fhost = false;
@@ -391,6 +392,13 @@ static int slbt_init_host_params(
if ((cctx->mode == SLBT_MODE_COMPILE) || (cctx->mode == SLBT_MODE_LINK))
fdumpmachine = true;
+ /* support the portbld <--> unknown synonym */
+ if (!(drvhost->machine = strdup(SLBT_MACHINE)))
+ return -1;
+
+ if ((mark = strstr(drvhost->machine,"-portbld-")))
+ memcpy(mark,"-unknown",8);
+
/* host */
if (host->host) {
cfgmeta->host = cfgexplicit;
@@ -416,10 +424,10 @@ static int slbt_init_host_params(
host->host = drvhost->host;
fcompiler = true;
- fnative = (!(strcmp(host->host,SLBT_MACHINE)));
+ fnative = (!(strcmp(host->host,drvhost->machine)));
cfgmeta->host = fnative ? cfgnmachine : cfgxmachine;
} else {
- host->host = SLBT_MACHINE;
+ host->host = drvhost->machine;
cfgmeta->host = cfgnmachine;
fnative = true;
}
@@ -438,7 +446,7 @@ static int slbt_init_host_params(
machine = drvhost->host;
cfgmeta->flavor = cfgcompiler;
} else {
- machine = SLBT_MACHINE;
+ machine = drvhost->machine;
cfgmeta->flavor = cfgnmachine;
}
@@ -537,6 +545,9 @@ static int slbt_init_host_params(
static void slbt_free_host_params(struct slbt_host_strs * host)
{
+ if (host->machine)
+ free(host->machine);
+
if (host->host)
free(host->host);