diff options
author | midipix <writeonce@midipix.org> | 2024-03-10 22:03:40 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-03-10 22:20:12 +0000 |
commit | c43e0b82a581d2c8bb35ebab96df8a1d2911f60a (patch) | |
tree | af596578f5fa328540a0ceba550a0cb699a3c269 /src | |
parent | b975cb04c10daf6d2b50044390536c4bd40d01db (diff) | |
download | slibtool-c43e0b82a581d2c8bb35ebab96df8a1d2911f60a.tar.bz2 slibtool-c43e0b82a581d2c8bb35ebab96df8a1d2911f60a.tar.xz |
slbt_exec_link(): fix arguments passed to slbt_create_library_wrapper().
Diffstat (limited to 'src')
-rw-r--r-- | src/logic/slbt_exec_link.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index b2f1311..ff89490 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -134,7 +134,10 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx) int ret; const char * output; char * dot; + char * slash; struct slbt_exec_ctx * ectx; + char * arref; + char * dsoref; bool fpic; bool fnodsolib; bool fnoarchive; @@ -142,7 +145,6 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx) char soname[PATH_MAX]; char soxyz [PATH_MAX]; char solnk [PATH_MAX]; - char arname[PATH_MAX]; char target[PATH_MAX]; char lnkname[PATH_MAX]; @@ -154,6 +156,10 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx) if (slbt_ectx_get_exec_ctx(dctx,&ectx) < 0) return SLBT_NESTED_ERROR(dctx); + /* .la wrapper */ + arref = 0; + dsoref = 0; + /* libfoo.so.x.y.z */ if (slbt_snprintf(soxyz,sizeof(soxyz), "%s%s%s%s%s.%d.%d.%d%s", @@ -186,12 +192,6 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx) dctx->cctx->libname, dctx->cctx->settings.dsosuffix); - /* libfoo.a */ - sprintf(arname,"%s%s%s", - dctx->cctx->settings.arprefix, - dctx->cctx->libname, - dctx->cctx->settings.arsuffix); - /* output suffix */ output = dctx->cctx->output; dot = strrchr(output,'.'); @@ -210,6 +210,7 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx) return SLBT_NESTED_ERROR(dctx); } + /* fpic, fstaticobjs, fnodsolib, fnoarchive */ if (dctx->cctx->drvflags & SLBT_DRIVER_ALL_STATIC) { fstaticobjs = true; @@ -253,7 +254,7 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx) } /* pic libfoo.a */ - if (dot && !strcmp(dot,".la") && !fnoarchive) + if (dot && !strcmp(dot,".la") && !fnoarchive) { if (slbt_exec_link_create_archive( dctx,ectx, ectx->arfilename, @@ -262,6 +263,12 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx) return SLBT_NESTED_ERROR(dctx); } + arref = ectx->arfilename; + + if ((slash = strrchr(arref,'/'))) + arref = ++slash; + } + /* static-only libfoo.la */ if (fstaticobjs && dot && !strcmp(dot,".la")) { const struct slbt_flavor_settings * dflavor; @@ -459,6 +466,8 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx) SLBT_SYMLINK_LITERAL)) return SLBT_NESTED_ERROR(dctx); } + + dsoref = soname; } /* executable */ @@ -481,7 +490,7 @@ int slbt_exec_link(const struct slbt_driver_ctx * dctx) /* library wrapper */ if (slbt_create_library_wrapper( dctx,ectx, - arname,soname,soxyz,solnk)) { + arref,dsoref,soxyz,solnk)) { slbt_ectx_free_exec_ctx(ectx); return SLBT_NESTED_ERROR(dctx); } |