From 5c8c001fb81b54dda6126bcc7f3b076070a75fbe Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 16 Feb 2024 04:07:22 +0000 Subject: slbt_get_exec_ctx(): add tool-specific arguments to the total argument count. --- src/logic/slbt_exec_ctx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c index 039ba14..8c718ae 100644 --- a/src/logic/slbt_exec_ctx.c +++ b/src/logic/slbt_exec_ctx.c @@ -48,9 +48,24 @@ static char * slbt_source_file(char ** argv) } +static int slbt_exec_ctx_tool_argc(char ** argv) +{ + char ** parg; + + if (!(parg = argv)) + return 0; + + for (; *parg; ) + parg++; + + return parg - argv + 1; +} + + static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc( const struct slbt_driver_ctx * dctx) { + struct slbt_driver_ctx_impl * ctx; struct slbt_exec_ctx_impl * ictx; size_t size; size_t vsize; @@ -63,6 +78,17 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc( argc = 0; csrc = 0; + /* internal driver context for host-specific tool arguments */ + ctx = slbt_get_driver_ictx(dctx); + + /* tool-specific argv: to simplify matters, be additive */ + argc += slbt_exec_ctx_tool_argc(ctx->host.ar_argv); + argc += slbt_exec_ctx_tool_argc(ctx->host.as_argv); + argc += slbt_exec_ctx_tool_argc(ctx->host.ranlib_argv); + argc += slbt_exec_ctx_tool_argc(ctx->host.windres_argv); + argc += slbt_exec_ctx_tool_argc(ctx->host.dlltool_argv); + argc += slbt_exec_ctx_tool_argc(ctx->host.mdso_argv); + /* clerical [worst-case] buffer size (guard, .libs, version) */ size = strlen(".lo") + 1; size += 12 * (strlen(".libs/") + 1); -- cgit v1.2.3