summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-02-14 01:46:59 +0000
committermidipix <writeonce@midipix.org>2024-02-14 01:57:27 +0000
commitb4058c47a4dbd27e8012d13697aaf30c447effbd (patch)
treec6956fc05c9f4b1024d50c59b91e48501b134a2c
parent6bc1706e77c607947ac30f96ec0bce3e056b3026 (diff)
downloadslibtool-b4058c47a4dbd27e8012d13697aaf30c447effbd.tar.bz2
slibtool-b4058c47a4dbd27e8012d13697aaf30c447effbd.tar.xz
driver: rlibtool mode: also derive AS from the located libtool script.
-rw-r--r--src/driver/slbt_driver_ctx.c7
-rw-r--r--src/driver/slbt_host_params.c5
-rw-r--r--src/internal/slibtool_driver_impl.h1
-rw-r--r--src/internal/slibtool_lconf_impl.c11
4 files changed, 22 insertions, 2 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index deb8cdc..15c2cf5 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -339,6 +339,7 @@ int slbt_get_driver_ctx(
const char * lconf;
uint64_t lflags;
const char * cfgmeta_ar;
+ const char * cfgmeta_as;
const char * cfgmeta_ranlib;
const char * cfgmeta_dlltool;
@@ -395,6 +396,7 @@ int slbt_get_driver_ctx(
cmdnoshared = 0;
cfgmeta_ar = 0;
+ cfgmeta_as = 0;
cfgmeta_ranlib = 0;
cfgmeta_dlltool = 0;
@@ -595,6 +597,7 @@ int slbt_get_driver_ctx(
case TAG_AS:
cctx.host.as = entry->arg;
+ cfgmeta_as = cfgexplicit;
break;
case TAG_RANLIB:
@@ -816,6 +819,9 @@ int slbt_get_driver_ctx(
if (ctx->cctx.host.ar && !cfgmeta_ar)
cfgmeta_ar = cfglconf;
+ if (ctx->cctx.host.as && !cfgmeta_as)
+ cfgmeta_as = cfglconf;
+
if (ctx->cctx.host.ranlib && !cfgmeta_ranlib)
cfgmeta_ranlib = cfglconf;
@@ -862,6 +868,7 @@ int slbt_get_driver_ctx(
&ctx->cctx.host,
&ctx->cctx.cfgmeta,
cfgmeta_ar,
+ cfgmeta_as,
cfgmeta_ranlib,
cfgmeta_dlltool))
return slbt_get_driver_ctx_fail(&ctx->ctx,0);
diff --git a/src/driver/slbt_host_params.c b/src/driver/slbt_host_params.c
index 6414ec1..58e0612 100644
--- a/src/driver/slbt_host_params.c
+++ b/src/driver/slbt_host_params.c
@@ -137,6 +137,7 @@ int slbt_init_host_params(
struct slbt_host_params * host,
struct slbt_host_params * cfgmeta,
const char * cfgmeta_ar,
+ const char * cfgmeta_as,
const char * cfgmeta_ranlib,
const char * cfgmeta_dlltool)
{
@@ -371,7 +372,7 @@ int slbt_init_host_params(
/* as */
if (host->as)
- cfgmeta->as = cfgexplicit;
+ cfgmeta->as = cfgmeta_as ? cfgmeta_as : cfgexplicit;
else {
if (!(drvhost->as = calloc(1,toollen)))
return -1;
@@ -644,7 +645,7 @@ int slbt_set_alternate_host(
&ictx->ctx.ahost,
&ictx->ctx.cctx.ahost,
&ictx->ctx.cctx.acfgmeta,
- 0,0,0)) {
+ 0,0,0,0)) {
slbt_free_host_params(&ictx->ctx.ahost);
return SLBT_CUSTOM_ERROR(ctx,SLBT_ERR_HOST_INIT);
}
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index 34ab775..3f04b79 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -247,6 +247,7 @@ int slbt_init_host_params(
struct slbt_host_params * host,
struct slbt_host_params * cfgmeta,
const char * cfgmeta_ar,
+ const char * cfgmeta_as,
const char * cfgmeta_ranlib,
const char * cfgmeta_dlltool);
diff --git a/src/internal/slibtool_lconf_impl.c b/src/internal/slibtool_lconf_impl.c
index 4956b24..f1747df 100644
--- a/src/internal/slibtool_lconf_impl.c
+++ b/src/internal/slibtool_lconf_impl.c
@@ -806,6 +806,17 @@ int slbt_get_lconf_flags(
}
+ /* as tool (optional) */
+ if (!ctx->cctx.host.as) {
+ if (!slbt_get_lconf_var(addr,cap,"AS=",&val)) {
+ if (val[0] && !(ctx->host.as = strdup(val)))
+ return SLBT_SYSTEM_ERROR(dctx,0);
+
+ ctx->cctx.host.as = ctx->host.as;
+ }
+ }
+
+
/* dlltool tool (optional) */
if (!ctx->cctx.host.dlltool) {
if (!slbt_get_lconf_var(addr,cap,"DLLTOOL=",&val)) {