summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-09 23:09:24 +0000
committermidipix <writeonce@midipix.org>2024-03-10 02:40:15 +0000
commitd054ee34663b98b4387690f83ac4d836891f9743 (patch)
tree20737807aa5c8885eb07bad4aa532083a73db303
parent9c46bdbfb161a06b5a3c0559abb456961ca519f9 (diff)
downloadslibtool-d054ee34663b98b4387690f83ac4d836891f9743.tar.bz2
slibtool-d054ee34663b98b4387690f83ac4d836891f9743.tar.xz
link mode: dlopen/dlpreopen the static archive as needed.
-rw-r--r--src/internal/slibtool_linkcmd_impl.h3
-rw-r--r--src/logic/linkcmd/slbt_linkcmd_archive.c4
-rw-r--r--src/logic/linkcmd/slbt_linkcmd_argv.c5
-rw-r--r--src/logic/slbt_exec_ctx.c29
4 files changed, 32 insertions, 9 deletions
diff --git a/src/internal/slibtool_linkcmd_impl.h b/src/internal/slibtool_linkcmd_impl.h
index 8451810..bc57f3d 100644
--- a/src/internal/slibtool_linkcmd_impl.h
+++ b/src/internal/slibtool_linkcmd_impl.h
@@ -29,7 +29,8 @@ bool slbt_adjust_object_argument(
bool slbt_adjust_wrapper_argument(
char * arg,
- bool fpic);
+ bool fpic,
+ const char * suffix);
int slbt_adjust_linker_argument(
const struct slbt_driver_ctx * dctx,
diff --git a/src/logic/linkcmd/slbt_linkcmd_archive.c b/src/logic/linkcmd/slbt_linkcmd_archive.c
index 93237dd..5f1ba52 100644
--- a/src/logic/linkcmd/slbt_linkcmd_archive.c
+++ b/src/logic/linkcmd/slbt_linkcmd_archive.c
@@ -156,7 +156,9 @@ slbt_hidden int slbt_exec_link_create_archive(
/* input objects associated with .la archives */
for (parg=ectx->cargv; *parg; parg++)
- if (slbt_adjust_wrapper_argument(*parg,true))
+ if (slbt_adjust_wrapper_argument(
+ *parg,true,
+ dctx->cctx->settings.arsuffix))
if (slbt_util_import_archive(ectx,output,*parg))
return SLBT_NESTED_ERROR(dctx);
diff --git a/src/logic/linkcmd/slbt_linkcmd_argv.c b/src/logic/linkcmd/slbt_linkcmd_argv.c
index a0c342c..e50f6d9 100644
--- a/src/logic/linkcmd/slbt_linkcmd_argv.c
+++ b/src/logic/linkcmd/slbt_linkcmd_argv.c
@@ -170,7 +170,8 @@ slbt_hidden bool slbt_adjust_object_argument(
slbt_hidden bool slbt_adjust_wrapper_argument(
char * arg,
- bool fpic)
+ bool fpic,
+ const char * suffix)
{
char * slash;
char * dot;
@@ -199,7 +200,7 @@ slbt_hidden bool slbt_adjust_wrapper_argument(
dot = strrchr(arg,'.');
}
- strcpy(dot,".a");
+ strcpy(dot,suffix);
return true;
}
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c
index 0564218..b1177db 100644
--- a/src/logic/slbt_exec_ctx.c
+++ b/src/logic/slbt_exec_ctx.c
@@ -205,6 +205,7 @@ int slbt_ectx_get_exec_ctx(
{
struct slbt_exec_ctx_impl * ictx;
struct slbt_driver_ctx_impl * idctx;
+ struct slbt_error_info** errinfp;
uint64_t fmask;
char ** parg;
char ** src;
@@ -635,12 +636,30 @@ int slbt_ectx_get_exec_ctx(
for (; *dlopenv; ) {
arname = ictx->sbuf;
strcpy(arname,*dlopenv);
- slbt_adjust_wrapper_argument(arname,true);
- if (slbt_ar_get_archive_ctx(dctx,arname,dlactxv) < 0)
- return slbt_ectx_free_exec_ctx_impl(
- ictx,
- SLBT_NESTED_ERROR(dctx));
+ slbt_adjust_wrapper_argument(
+ arname,true,
+ ".expsyms.a");
+
+ errinfp = idctx->errinfp;
+
+ if (slbt_ar_get_archive_ctx(dctx,arname,dlactxv) < 0) {
+ strcpy(arname,*dlopenv);
+
+ slbt_adjust_wrapper_argument(
+ arname,true,
+ dctx->cctx->settings.arsuffix);
+
+ if (slbt_ar_get_archive_ctx(dctx,arname,dlactxv) < 0)
+ return slbt_ectx_free_exec_ctx_impl(
+ ictx,
+ SLBT_NESTED_ERROR(dctx));
+
+ idctx->errinfp = errinfp;
+
+ for (; *errinfp; )
+ *errinfp++ = 0;
+ }
if (slbt_ar_update_syminfo(*dlactxv,&ictx->ctx) < 0)
return slbt_ectx_free_exec_ctx_impl(