summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2025-03-30 23:27:59 +0000
committermidipix <writeonce@midipix.org>2025-03-31 02:30:49 +0000
commit9e90beda5fd3fd4f93eac229e41bb5f3b9f86982 (patch)
treef5d3274582d4753ac7df5b146f6312425942d9d8 /src/logic
parentd2b130bdd92c2bee08c8a7f20766bd014ad4a362 (diff)
downloadslibtool-9e90beda5fd3fd4f93eac229e41bb5f3b9f86982.tar.bz2
slibtool-9e90beda5fd3fd4f93eac229e41bb5f3b9f86982.tar.xz
driver: --prefer-sltdl: implementation and link-mode integration.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/linkcmd/slbt_linkcmd_argv.c16
-rw-r--r--src/logic/slbt_exec_ctx.c8
2 files changed, 24 insertions, 0 deletions
diff --git a/src/logic/linkcmd/slbt_linkcmd_argv.c b/src/logic/linkcmd/slbt_linkcmd_argv.c
index 013317f..546c8d5 100644
--- a/src/logic/linkcmd/slbt_linkcmd_argv.c
+++ b/src/logic/linkcmd/slbt_linkcmd_argv.c
@@ -1027,6 +1027,22 @@ slbt_hidden int slbt_exec_link_finalize_argument_vector(
}
}
+ /* replace -lltdl with -lsltdl as needed */
+ if (dctx->cctx->drvflags & SLBT_DRIVER_PREFER_SLTDL) {
+ struct slbt_exec_ctx_impl * ictx;
+
+ ictx = slbt_get_exec_ictx(ectx);
+
+ for (src=ectx->argv; *src; src++)
+ if ((src[0][0] == '-') && (src[0][1] == 'l'))
+ if ((src[0][2] == 'l')
+ && (src[0][3] == 't')
+ && (src[0][4] == 'd')
+ && (src[0][5] == 'l'))
+ if (!src[0][6])
+ *src = ictx->lsltdl;
+ }
+
/* properly null-terminate argv, accounting for redundant -l arguments */
*dst = 0;
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c
index 223be17..f76990a 100644
--- a/src/logic/slbt_exec_ctx.c
+++ b/src/logic/slbt_exec_ctx.c
@@ -131,6 +131,9 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc(
size += exts * SLBT_ECTX_LIB_EXTRAS;
}
+ /* -lsltdl (--prefer-sltdl impl.) */
+ size += 8;
+
/* string buffers: args, shadow */
if (!(args = malloc(size)))
return 0;
@@ -629,6 +632,11 @@ int slbt_ectx_get_exec_ctx(
}
+ /* -lsltdl (--prefer-sltdl impl.) */
+ ictx->lsltdl = ch;
+ strcpy(ch,"-lsltdl");
+ ch += 8;
+
/* dlopen, dlpreopen */
if ((dlopenv = idctx->dlopenv), (dlactxv = ictx->dlactxv)) {
if (slbt_ar_get_varchive_ctx(dctx,dlactxv) < 0)