From b6184d6ffcd5f7b8b3416a3d2e9be5511c3a1086 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 5 Apr 2016 16:44:11 -0400 Subject: execution context: account for supplementary linker arguments. --- src/logic/slbt_exec_ctx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/logic') 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"); } } -- cgit v1.2.3