summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-10-24 14:17:53 -0400
committermidipix <writeonce@midipix.org>2018-10-24 14:17:53 -0400
commitd9887764b73c7aa2b8e2b8f3e173747fd663e66e (patch)
treeaa2ab4404a3694976f5d7ba3a1889f61b3e3be8b /src
parent85f619d7a434e9d72ad9efa622127a996546646b (diff)
downloadslibtool-d9887764b73c7aa2b8e2b8f3e173747fd663e66e.tar.bz2
slibtool-d9887764b73c7aa2b8e2b8f3e173747fd663e66e.tar.xz
driver: execution context: added slbt_reset_argvector().
Diffstat (limited to 'src')
-rw-r--r--src/internal/slibtool_driver_impl.h2
-rw-r--r--src/logic/slbt_exec_ctx.c38
2 files changed, 40 insertions, 0 deletions
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index 415e99a..69b3675 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -119,6 +119,8 @@ struct slbt_exec_ctx_impl {
size_t size;
struct slbt_exec_ctx ctx;
int fdwrapper;
+ char ** lout[2];
+ char ** mout[2];
char * vbuffer[];
};
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c
index baddab7..256e941 100644
--- a/src/logic/slbt_exec_ctx.c
+++ b/src/logic/slbt_exec_ctx.c
@@ -143,6 +143,8 @@ int slbt_get_exec_ctx(
{
struct slbt_exec_ctx_impl * ictx;
char ** parg;
+ char ** src;
+ char ** dst;
char * ch;
char * mark;
const char * dmark;
@@ -458,6 +460,19 @@ int slbt_get_exec_ctx(
/* argument strings shadow copy */
memcpy(ictx->shadow,ictx->args,ictx->size);
+ /* compile mode: argument vector shadow copy */
+ if (dctx->cctx->mode == SLBT_MODE_COMPILE)
+ for (src=ictx->ctx.argv, dst=ictx->ctx.xargv; *src; src++, dst++)
+ *dst = *src;
+
+ /* save the full vector's lout, mout */
+ ictx->lout[0] = ictx->ctx.lout[0];
+ ictx->lout[1] = ictx->ctx.lout[1];
+
+ ictx->mout[0] = ictx->ctx.mout[0];
+ ictx->mout[1] = ictx->ctx.mout[1];
+
+ /* all done */
*ectx = &ictx->ctx;
return 0;
}
@@ -502,6 +517,29 @@ void slbt_reset_arguments(struct slbt_exec_ctx * ectx)
}
+void slbt_reset_argvector(struct slbt_exec_ctx * ectx)
+{
+ struct slbt_exec_ctx_impl * ictx;
+ uintptr_t addr;
+ char ** src;
+ char ** dst;
+
+ addr = (uintptr_t)ectx - offsetof(struct slbt_exec_ctx_impl,ctx);
+ ictx = (struct slbt_exec_ctx_impl *)addr;
+
+ for (src=ectx->xargv, dst=ectx->argv; *src; src++, dst++)
+ *dst = *src;
+
+ *dst = 0;
+
+ ectx->lout[0] = ictx->lout[0];
+ ectx->lout[1] = ictx->lout[1];
+
+ ectx->mout[0] = ictx->mout[0];
+ ectx->mout[1] = ictx->mout[1];
+}
+
+
void slbt_reset_placeholders(struct slbt_exec_ctx * ectx)
{
*ectx->dpic = "-USLIBTOOL_PLACEHOLDER_DPIC";