summaryrefslogtreecommitdiff
path: root/src/logic/slbt_exec_ctx.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-07-10 15:14:36 +0000
committermidipix <writeonce@midipix.org>2018-07-11 02:30:33 -0400
commit46aa6f554c0f2ef1affa5ae292fffec6907ff4b3 (patch)
tree9d76ad72f2d0ea2b1865b03b59085ddfaae646b5 /src/logic/slbt_exec_ctx.c
parent6185379aed8fab5a5d230e4a828258c6a5516743 (diff)
downloadslibtool-46aa6f554c0f2ef1affa5ae292fffec6907ff4b3.tar.bz2
slibtool-46aa6f554c0f2ef1affa5ae292fffec6907ff4b3.tar.xz
link mode: properly handle explicit archive input arguments.
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];