summaryrefslogtreecommitdiffhomepage
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
parente7323083cef75db971720fd4367c78cfc3ec4d08 (diff)
downloadslibtool-c67e64bc2f3e482943ef699d1010499fa8ac642b.tar.bz2
slibtool-c67e64bc2f3e482943ef699d1010499fa8ac642b.tar.xz
driver: accommodate hosts that occasionally use '-portbld-' in their triple.
-rw-r--r--src/driver/slbt_driver_ctx.c17
-rw-r--r--src/helper/slbt_dump_machine.c6
-rw-r--r--src/internal/slibtool_driver_impl.h1
3 files changed, 21 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);
diff --git a/src/helper/slbt_dump_machine.c b/src/helper/slbt_dump_machine.c
index b062fb1..0704386 100644
--- a/src/helper/slbt_dump_machine.c
+++ b/src/helper/slbt_dump_machine.c
@@ -56,6 +56,7 @@ int slbt_dump_machine(
int fd[2];
FILE * fmachine;
char * newline;
+ char * mark;
char check[2];
char program[PATH_MAX];
@@ -108,5 +109,10 @@ int slbt_dump_machine(
close(fd[1]);
}
+ /* support the portbld <--> unknown synonym */
+ if (newline)
+ if ((mark = strstr(machine,"-portbld-")))
+ memcpy(mark,"-unknown",8);
+
return newline ? 0 : -1;
}
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index 132e0e5..9a4a750 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -60,6 +60,7 @@ enum app_tags {
};
struct slbt_host_strs {
+ char * machine;
char * host;
char * flavor;
char * ar;