From 9bc8c2b17dda448d2bfee74ec4639b9429c32dce Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 3 Mar 2024 18:16:54 +0000 Subject: slbt_ectx_get_exec_ctx(): init dlopensrc and dlopenobj in all modes as needed. --- src/logic/slbt_exec_ctx.c | 46 +++++++++++++++++++++++++++++++++------------- 1 file 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( -- cgit v1.2.3