summaryrefslogtreecommitdiffhomepage
path: root/src/logic/slbt_exec_link.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2020-09-10 02:06:41 +0000
committermidipix <writeonce@midipix.org>2020-09-13 00:27:16 +0000
commitff7fb8ff0eda9757e3395577ef2943ded893fadb (patch)
treea0dd81353921d450202ac66212240a8fbfc515e7 /src/logic/slbt_exec_link.c
parentec2276d408e199ce41d0fe4932569b07418d90be (diff)
downloadslibtool-ff7fb8ff0eda9757e3395577ef2943ded893fadb.tar.bz2
slibtool-ff7fb8ff0eda9757e3395577ef2943ded893fadb.tar.xz
link mode: slbt_exec_link(): properly handle .la targets built with -module.
Diffstat (limited to 'src/logic/slbt_exec_link.c')
-rw-r--r--src/logic/slbt_exec_link.c31
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 */