summaryrefslogtreecommitdiffhomepage
path: root/src/logic/slbt_exec_link.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-06-22 12:07:50 -0400
committermidipix <writeonce@midipix.org>2018-06-22 12:07:50 -0400
commit600957a65ae754dfc87d1569556dd22c230597a5 (patch)
treed0361f692672060c8697de23fb48f30ad54ffe09 /src/logic/slbt_exec_link.c
parent127b9405d0d7ed2a4c8d246a5e960e8313f38988 (diff)
downloadslibtool-600957a65ae754dfc87d1569556dd22c230597a5.tar.bz2
slibtool-600957a65ae754dfc87d1569556dd22c230597a5.tar.xz
link mode: properly handle the combination of -release and -version-info.
Diffstat (limited to 'src/logic/slbt_exec_link.c')
-rw-r--r--src/logic/slbt_exec_link.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index f49574e..1b632bd 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -1115,10 +1115,12 @@ static int slbt_exec_link_create_library(
/* -soname */
if ((dctx->cctx->drvflags & SLBT_DRIVER_IMAGE_MACHO)) {
(void)0;
- } else if (!(dctx->cctx->drvflags & SLBT_DRIVER_AVOID_VERSION)) {
- if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s%s%s.%d",
+
+ } else if (relfilename && dctx->cctx->verinfo.verinfo) {
+ if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s%s-%s%s.%d",
ectx->sonameprefix,
dctx->cctx->libname,
+ dctx->cctx->release,
dctx->cctx->settings.dsosuffix,
dctx->cctx->verinfo.major)
>= sizeof(soname))
@@ -1126,6 +1128,7 @@ static int slbt_exec_link_create_library(
*ectx->soname = "-Wl,-soname";
*ectx->lsoname = soname;
+
} else if (relfilename) {
if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s%s-%s%s",
ectx->sonameprefix,
@@ -1137,6 +1140,18 @@ static int slbt_exec_link_create_library(
*ectx->soname = "-Wl,-soname";
*ectx->lsoname = soname;
+
+ } else if (!(dctx->cctx->drvflags & SLBT_DRIVER_AVOID_VERSION)) {
+ if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s%s%s.%d",
+ ectx->sonameprefix,
+ dctx->cctx->libname,
+ dctx->cctx->settings.dsosuffix,
+ dctx->cctx->verinfo.major)
+ >= sizeof(soname))
+ return SLBT_BUFFER_ERROR(dctx);
+
+ *ectx->soname = "-Wl,-soname";
+ *ectx->lsoname = soname;
}
/* PE: --output-def */
@@ -1412,20 +1427,29 @@ static int slbt_exec_link_create_library_symlink(
target,lnkname,
false))
return SLBT_NESTED_ERROR(dctx);
- } else
+ } else {
sprintf(target,"%s.%d.%d.%d",
ectx->dsofilename,
dctx->cctx->verinfo.major,
dctx->cctx->verinfo.minor,
dctx->cctx->verinfo.revision);
+ }
+
- if (fmajor)
+ if (fmajor && ectx->dsorellnkname) {
+ sprintf(lnkname,"%s.%d",
+ ectx->dsorellnkname,
+ dctx->cctx->verinfo.major);
+
+ } else if (fmajor) {
sprintf(lnkname,"%s.%d",
ectx->dsofilename,
dctx->cctx->verinfo.major);
- else
+ } else {
strcpy(lnkname,ectx->dsofilename);
+ }
+
if (fmajor && (dctx->cctx->drvflags & SLBT_DRIVER_IMAGE_PE))
return slbt_copy_file(