summaryrefslogtreecommitdiff
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-03-19 18:49:56 -0400
committermidipix <writeonce@midipix.org>2016-03-19 18:49:56 -0400
commitf0c096a6c41b51fe344423347910b6c299c3bbcd (patch)
treef599a5e960267c8814d080b6747c3d0eec07f424 /src/logic
parent680670904bb1a91a167d66a404e093b07ccb46d1 (diff)
downloadslibtool-f0c096a6c41b51fe344423347910b6c299c3bbcd.tar.bz2
slibtool-f0c096a6c41b51fe344423347910b6c299c3bbcd.tar.xz
slbt_exec_ctx_alloc(): account for link-specific objects.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_ctx.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c
index 6bae3fd..fcab308 100644
--- a/src/logic/slbt_exec_ctx.c
+++ b/src/logic/slbt_exec_ctx.c
@@ -67,7 +67,7 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc(
/* clerical [worst-case] buffer size (guard, .libs, version) */
size = strlen(".lo") + sizeof('\0');
- size += 6 * (strlen(".libs/") + sizeof('\0'));
+ size += 8 * (strlen(".libs/") + sizeof('\0'));
size += 36 * (strlen(".0000") + sizeof('\0'));
/* buffer size (cargv, -Wc) */
@@ -87,6 +87,17 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc(
/* buffer size (.libs/%.o, pessimistic) */
size += argc * strlen(".libs/");
+ /* buffer size (linking) */
+ if (dctx->cctx->mode == SLBT_MODE_LINK)
+ size += strlen(dctx->cctx->settings.arprefix) + sizeof('\0')
+ + strlen(dctx->cctx->settings.arsuffix) + sizeof('\0')
+ + strlen(dctx->cctx->settings.dsoprefix) + sizeof('\0')
+ + strlen(dctx->cctx->settings.dsoprefix) + sizeof('\0')
+ + strlen(dctx->cctx->settings.exeprefix) + sizeof('\0')
+ + strlen(dctx->cctx->settings.exeprefix) + sizeof('\0')
+ + strlen(dctx->cctx->settings.impprefix) + sizeof('\0')
+ + strlen(dctx->cctx->settings.impprefix) + sizeof('\0');
+
/* alloc */
if (!(args = malloc(size)))
return 0;