summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-03 18:16:54 +0000
committermidipix <writeonce@midipix.org>2024-03-03 22:10:11 +0000
commit9bc8c2b17dda448d2bfee74ec4639b9429c32dce (patch)
treec7021ff629ef9063b6a4a9505f8e19f84bef8847
parentb7e6e8e7c85853fa872201290dd880c8b53124b6 (diff)
downloadslibtool-9bc8c2b17dda448d2bfee74ec4639b9429c32dce.tar.bz2
slibtool-9bc8c2b17dda448d2bfee74ec4639b9429c32dce.tar.xz
slbt_ectx_get_exec_ctx(): init dlopensrc and dlopenobj in all modes as needed.
-rw-r--r--src/logic/slbt_exec_ctx.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c
index 7c5bd87..69aecc1 100644
--- a/src/logic/slbt_exec_ctx.c
+++ b/src/logic/slbt_exec_ctx.c
@@ -554,6 +554,39 @@ int slbt_ectx_get_exec_ctx(
ch++;
}
+
+ /* linking: exefilename */
+ } else if (dctx->cctx->mode == SLBT_MODE_LINK) {
+ ictx->ctx.exefilename = ch;
+
+ if ((slash = strrchr(dctx->cctx->output,'/'))) {
+ strcpy(ch,dctx->cctx->output);
+ mark = ch + (slash - dctx->cctx->output);
+ sprintf(++mark,".libs/%s",++slash);
+ ch += strlen(ch) + 1;
+ } else
+ ch += sprintf(ch,".libs/%s",dctx->cctx->output) + 1;
+ }
+
+ /* dlopensrc, dlopenobj: executable program */
+ if (idctx->dlopenv && !dctx->cctx->libname) {
+ ictx->ctx.dlopensrc = ch;
+ ch += sprintf(ch,"%s.dlopen.c",
+ ictx->ctx.exefilename);
+
+ ch++;
+
+ ictx->ctx.dlopenobj = ch;
+ ch += sprintf(ch,"%s.dlopen.o",
+ ictx->ctx.exefilename);
+
+ ch++;
+
+ ictx->ctx.dlunit = ch;
+ ch += sprintf(ch,"%s",
+ "@PROGRAM@");
+
+ ch++;
}
/* dlopen, dlpreopen */
@@ -587,19 +620,6 @@ int slbt_ectx_get_exec_ctx(
SLBT_NESTED_ERROR(dctx));
}
- /* linking: exefilename */
- if (dctx->cctx->mode == SLBT_MODE_LINK && !dctx->cctx->libname) {
- ictx->ctx.exefilename = ch;
-
- if ((slash = strrchr(dctx->cctx->output,'/'))) {
- strcpy(ch,dctx->cctx->output);
- mark = ch + (slash - dctx->cctx->output);
- sprintf(++mark,".libs/%s",++slash);
- ch += strlen(ch) + 1;
- } else
- ch += sprintf(ch,".libs/%s",dctx->cctx->output) + 1;
- }
-
/* vector of exported symbols (raw input via -export-symbols) */
if (dctx->cctx->expsyms)
if (slbt_lib_get_symlist_ctx(