diff options
author | midipix <writeonce@midipix.org> | 2020-09-10 02:06:41 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2020-09-13 00:27:16 +0000 |
commit | ff7fb8ff0eda9757e3395577ef2943ded893fadb (patch) | |
tree | a0dd81353921d450202ac66212240a8fbfc515e7 /src | |
parent | ec2276d408e199ce41d0fe4932569b07418d90be (diff) | |
download | slibtool-ff7fb8ff0eda9757e3395577ef2943ded893fadb.tar.bz2 slibtool-ff7fb8ff0eda9757e3395577ef2943ded893fadb.tar.xz |
link mode: slbt_exec_link(): properly handle .la targets built with -module.
Diffstat (limited to 'src')
-rw-r--r-- | src/logic/slbt_exec_link.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index 88efff2..ff406f9 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -1261,6 +1261,8 @@ static int slbt_exec_link_create_library( char ** parg; char ** xarg; char * ccwrap; + const char * laout; + const char * dot; char cwd [PATH_MAX]; char output [PATH_MAX]; char soname [PATH_MAX]; @@ -1303,10 +1305,15 @@ static int slbt_exec_link_create_library( *ectx->noundef = "-Wl,--no-undefined"; /* -soname */ + dot = strrchr(dctx->cctx->output,'.'); + laout = (dot && !strcmp(dot,".la")) + ? dctx->cctx->output + : 0; + if ((dctx->cctx->drvflags & SLBT_DRIVER_IMAGE_MACHO)) { (void)0; - } else if (dctx->cctx->drvflags & SLBT_DRIVER_MODULE) { + } else if (!laout && (dctx->cctx->drvflags & SLBT_DRIVER_MODULE)) { if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s", dctx->cctx->output) >= sizeof(soname)) @@ -1377,7 +1384,7 @@ static int slbt_exec_link_create_library( } /* output */ - if (dctx->cctx->drvflags & SLBT_DRIVER_MODULE) { + if (!laout && dctx->cctx->drvflags & SLBT_DRIVER_MODULE) { strcpy(output,dctx->cctx->output); } else if (relfilename) { strcpy(output,relfilename); @@ -1802,17 +1809,19 @@ int slbt_exec_link( /* dynaic library via -module */ if (dctx->cctx->drvflags & SLBT_DRIVER_MODULE) { - if (slbt_exec_link_create_library( - dctx,ectx, - ectx->dsobasename, - ectx->dsofilename, - ectx->relfilename)) { + if (!dot || strcmp(dot,".la")) { + if (slbt_exec_link_create_library( + dctx,ectx, + ectx->dsobasename, + ectx->dsofilename, + ectx->relfilename)) { + slbt_free_exec_ctx(actx); + return SLBT_NESTED_ERROR(dctx); + } + slbt_free_exec_ctx(actx); - return SLBT_NESTED_ERROR(dctx); + return 0; } - - slbt_free_exec_ctx(actx); - return 0; } /* dynamic library */ |