diff options
author | midipix <writeonce@midipix.org> | 2024-03-03 07:54:45 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-03-03 09:27:48 +0000 |
commit | 1769a44c3e2be2f6b309bef929a4d685072619b6 (patch) | |
tree | 125e4e01934e6cde1ce47f6db705bc7a737a5dab /src/logic/linkcmd | |
parent | 4af256bee433fadfacf2cb1e22dbe35c9e0a8fbf (diff) | |
download | slibtool-1769a44c3e2be2f6b309bef929a4d685072619b6.tar.bz2 slibtool-1769a44c3e2be2f6b309bef929a4d685072619b6.tar.xz |
slbt_exec_link_create_archive(): added -dlpreopen support.
Diffstat (limited to 'src/logic/linkcmd')
-rw-r--r-- | src/logic/linkcmd/slbt_linkcmd_archive.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/src/logic/linkcmd/slbt_linkcmd_archive.c b/src/logic/linkcmd/slbt_linkcmd_archive.c index 051a563..a8002fb 100644 --- a/src/logic/linkcmd/slbt_linkcmd_archive.c +++ b/src/logic/linkcmd/slbt_linkcmd_archive.c @@ -89,15 +89,26 @@ slbt_hidden int slbt_exec_link_create_archive( return slbt_exec_link_create_noop_symlink( dctx,ectx,arfilename); - /* initial state */ + /* dlopen, dlpreopen: object compilation (derived from dynamic linking) */ + if (ectx->dlopenobj) { + slbt_ectx_reset_arguments(ectx); + slbt_reset_placeholders(ectx); + + if (slbt_exec_link_create_library( + dctx,ectx, + "@ARDLOPEN", + "@ARDLOPEN", + "@ARDLOPEN", + true) < 0) + return SLBT_NESTED_ERROR(dctx); + } + + /* restore initial state */ slbt_ectx_reset_arguments(ectx); /* placeholders */ slbt_reset_placeholders(ectx); - /* alternate program (ar, ranlib) */ - ectx->program = program; - /* output */ if (slbt_snprintf(output,sizeof(output), "%s",arfilename) < 0) @@ -106,12 +117,6 @@ slbt_hidden int slbt_exec_link_create_archive( /* tool-specific argument vector */ argv = (slbt_get_driver_ictx(dctx))->host.ar_argv; - /* ar alternate argument vector */ - if (!argv) - if (slbt_snprintf(program,sizeof(program), - "%s",dctx->cctx->host.ar) < 0) - return SLBT_BUFFER_ERROR(dctx); - /* fdcwd */ fdcwd = slbt_driver_fdcwd(dctx); @@ -119,8 +124,6 @@ slbt_hidden int slbt_exec_link_create_archive( aarg = ectx->altv; if ((parg = argv)) { - ectx->program = argv[0]; - for (; *parg; ) *aarg++ = *parg++; } else { @@ -134,9 +137,23 @@ slbt_hidden int slbt_exec_link_create_archive( if (slbt_adjust_object_argument(*parg,fpic,!fpic,fdcwd)) *aarg++ = *parg; + if (ectx->dlopenobj) + *aarg++ = ectx->dlopenobj; + *aarg = 0; ectx->argv = ectx->altv; + /* ar program */ + if (argv) { + ectx->program = argv[0]; + } else { + if (slbt_snprintf(program,sizeof(program), + "%s",dctx->cctx->host.ar) < 0) + return SLBT_BUFFER_ERROR(dctx); + + ectx->program = program; + } + /* step output */ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) if (slbt_output_link(ectx)) |