summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-05 16:44:11 -0400
committermidipix <writeonce@midipix.org>2016-04-05 22:06:49 -0400
commitb6184d6ffcd5f7b8b3416a3d2e9be5511c3a1086 (patch)
treea032c8e906d93616be22da482139c1b58a4fb7c3
parentf6ccbe0809c9ee290474b098cbf04b6c8358e163 (diff)
downloadslibtool-b6184d6ffcd5f7b8b3416a3d2e9be5511c3a1086.tar.bz2
slibtool-b6184d6ffcd5f7b8b3416a3d2e9be5511c3a1086.tar.xz
execution context: account for supplementary linker arguments.
-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");
}
}