summaryrefslogtreecommitdiffhomepage
path: root/src/logic/slbt_exec_ctx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/logic/slbt_exec_ctx.c')
-rw-r--r--src/logic/slbt_exec_ctx.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c
index 230dd7f..baddab7 100644
--- a/src/logic/slbt_exec_ctx.c
+++ b/src/logic/slbt_exec_ctx.c
@@ -110,8 +110,13 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc(
return 0;
}
+ /* ictx, argv, xargv */
+ vsize = sizeof(*ictx);
+ vsize += sizeof(char *) * (argc + 1);
+ vsize += sizeof(char *) * (argc + 1);
+
/* altv: duplicate set, -Wl,--whole-archive, -Wl,--no-whole-archive */
- vsize = sizeof(*ictx) + 4*(argc+1)*sizeof(char *);
+ vsize += sizeof(char *) * (argc + 1) * 3;
if (!(ictx = calloc(1,vsize))) {
free(args);
@@ -155,7 +160,8 @@ int slbt_get_exec_ctx(
/* init with guard for later .lo check */
ch = ictx->args + strlen(".lo");
ictx->ctx.argv = ictx->vbuffer;
- ictx->ctx.altv = &ictx->vbuffer[ictx->argc + 1];
+ ictx->ctx.xargv = &ictx->ctx.argv [ictx->argc + 1];
+ ictx->ctx.altv = &ictx->ctx.xargv[ictx->argc + 1];
/* <compiler> */
ictx->ctx.compiler = dctx->cctx->cargv[0];