From a07095d89f48e4612aea2b6edd0c3a62ab209892 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 10 Mar 2024 15:27:44 +0000 Subject: link mode: treat dlopen of static-only dependency libs as (also fixed) dlpreopen --- src/driver/slbt_driver_ctx.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/driver/slbt_driver_ctx.c') diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index 8f4f2dc..fc242c0 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -247,7 +247,7 @@ static struct slbt_driver_ctx_impl * slbt_driver_ctx_alloc( } if (ndlopen) { - if (!(ictx->ctx.dlopenv = calloc(ndlopen+1,sizeof(char *)))) { + if (!(ictx->ctx.dlopenv = calloc(ndlopen+1,sizeof(*ictx->ctx.dlopenv)))) { free(ictx); slbt_free_argv_buffer(sargv,objlistv); return 0; @@ -406,7 +406,7 @@ int slbt_lib_get_driver_ctx( const char * lconf; uint64_t lflags; size_t ndlopen; - const char ** dlopenv; + struct argv_entry ** dlopenv; const char * cfgmeta_host; const char * cfgmeta_ar; const char * cfgmeta_as; @@ -1010,7 +1010,16 @@ int slbt_lib_get_driver_ctx( if (entry->fopt) { switch (entry->tag) { case TAG_DLOPEN: - ctx->cctx.drvflags |= SLBT_DRIVER_DLOPEN_FORCE; + if (!strcmp(entry->arg,"self")) { + ctx->cctx.drvflags |= SLBT_DRIVER_DLOPEN_FORCE; + + } else if (!strcmp(entry->arg,"force")) { + ctx->cctx.drvflags |= SLBT_DRIVER_DLOPEN_FORCE; + + } else { + *dlopenv++ = entry; + } + break; case TAG_DLPREOPEN: @@ -1021,9 +1030,11 @@ int slbt_lib_get_driver_ctx( ctx->cctx.drvflags |= SLBT_DRIVER_DLPREOPEN_FORCE; } else { - *dlopenv++ = entry->arg; + *dlopenv++ = entry; } + break; + default: break; } -- cgit v1.2.3