summaryrefslogtreecommitdiff
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.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c
index df7f693..c9cefdc 100644
--- a/src/logic/slbt_exec_ctx.c
+++ b/src/logic/slbt_exec_ctx.c
@@ -89,8 +89,12 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc(
else if ((csrc = slbt_source_file(dctx->cctx->cargv)))
size += 4*strlen(csrc);
+ /* pessimistic argc: .libs/libfoo.so --> -L.libs -lfoo */
+ argc *= 2;
+ argc += SLBT_ARGV_SPARE_PTRS;
+
/* buffer size (.libs/%.o, pessimistic) */
- size += argc * strlen(".libs/");
+ size += argc * strlen(".libs/-L-l");
/* buffer size (linking) */
if (dctx->cctx->mode == SLBT_MODE_LINK)
@@ -112,7 +116,8 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc(
return 0;
}
- vsize = sizeof(*ictx) + (2*(argc+1)+SLBT_ARGV_SPARE_PTRS)*sizeof(char *);
+ /* altv: duplicate set, -Wl,--whole-archive, -Wl,--no-whole-archive */
+ vsize = sizeof(*ictx) + 4*(argc+1)*sizeof(char *);
if (!(ictx = calloc(1,vsize))) {
free(args);
@@ -213,7 +218,7 @@ int slbt_get_exec_ctx(
} else {
ictx->ctx.argv[i++] = ch;
ch += sprintf(ch,"%s",*parg);
- ch += strlen(".libs/");
+ ch += strlen(".libs/-L-l");
}
}