summaryrefslogtreecommitdiff
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-11-10 15:23:57 -0500
committermidipix <writeonce@midipix.org>2018-11-10 17:35:29 -0500
commit08f5f92f68aa6f198d401229061b39a4f9602769 (patch)
tree8ec8bd17bf8019dd8ebb9e0da14cdaae088e8370 /src/logic
parentc0ac19b78e85f4b4e7e8fbf90daacf0c2267c657 (diff)
downloadslibtool-08f5f92f68aa6f198d401229061b39a4f9602769.tar.bz2
slibtool-08f5f92f68aa6f198d401229061b39a4f9602769.tar.xz
link mode: host flavors: properly support suffixed suffixes.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_ctx.c24
-rw-r--r--src/logic/slbt_exec_link.c54
2 files changed, 51 insertions, 27 deletions
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c
index 256e941..d10d880 100644
--- a/src/logic/slbt_exec_ctx.c
+++ b/src/logic/slbt_exec_ctx.c
@@ -78,9 +78,12 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc(
/* buffer size (ldirname, lbasename, lobjname, aobjname, etc.) */
if (dctx->cctx->output)
- size += 8*strlen(dctx->cctx->output);
+ size += 9*strlen(dctx->cctx->output);
else if ((csrc = slbt_source_file(dctx->cctx->cargv)))
- size += 8*strlen(csrc);
+ size += 9*strlen(csrc);
+
+ /* pessimistic: long dso suffix, long x.y.z version */
+ size += 9 * (16 + 16 + 16 + 16);
/* pessimistic argc: .libs/libfoo.so --> -L.libs -lfoo */
argc *= 2;
@@ -306,7 +309,7 @@ int slbt_get_exec_ctx(
+ 1;
}
- /* linking: arfilename, lafilename, laifilename, dsofilename */
+ /* linking: arfilename, lafilename, laifilename, dsobasename, dsofilename */
if (dctx->cctx->mode == SLBT_MODE_LINK && dctx->cctx->libname) {
/* arprefix, dsoprefix */
if (dctx->cctx->drvflags & SLBT_DRIVER_MODULE) {
@@ -350,6 +353,14 @@ int slbt_get_exec_ctx(
ch++;
+ /* dsobasename */
+ ictx->ctx.dsobasename = ch;
+ ch += sprintf(ch,"%s%s%s",
+ ictx->ctx.ldirname,
+ dsoprefix,
+ dctx->cctx->libname);
+ ch++;
+
/* dsofilename */
ictx->ctx.dsofilename = ch;
ch += sprintf(ch,"%s%s%s%s",
@@ -413,15 +424,16 @@ int slbt_get_exec_ctx(
if (dctx->cctx->release) {
ictx->ctx.relfilename = ch;
ch += dctx->cctx->verinfo.verinfo
- ? sprintf(ch,"%s%s%s-%s%s.%d.%d.%d",
+ ? sprintf(ch,"%s%s%s-%s%s.%d.%d.%d%s",
ictx->ctx.ldirname,
dsoprefix,
dctx->cctx->libname,
dctx->cctx->release,
- dctx->cctx->settings.dsosuffix,
+ dctx->cctx->settings.osdsuffix,
dctx->cctx->verinfo.major,
dctx->cctx->verinfo.minor,
- dctx->cctx->verinfo.revision)
+ dctx->cctx->verinfo.revision,
+ dctx->cctx->settings.osdfussix)
: sprintf(ch,"%s%s%s-%s%s",
ictx->ctx.ldirname,
dsoprefix,
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index d5ebf71..0bfe7e0 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -1247,6 +1247,7 @@ static int slbt_exec_link_create_archive(
static int slbt_exec_link_create_library(
const struct slbt_driver_ctx * dctx,
struct slbt_exec_ctx * ectx,
+ const char * dsobasename,
const char * dsofilename,
const char * relfilename)
{
@@ -1299,12 +1300,13 @@ static int slbt_exec_link_create_library(
(void)0;
} else if (relfilename && dctx->cctx->verinfo.verinfo) {
- if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s%s-%s%s.%d",
+ if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s%s-%s%s.%d%s",
ectx->sonameprefix,
dctx->cctx->libname,
dctx->cctx->release,
- dctx->cctx->settings.dsosuffix,
- dctx->cctx->verinfo.major)
+ dctx->cctx->settings.osdsuffix,
+ dctx->cctx->verinfo.major,
+ dctx->cctx->settings.osdfussix)
>= sizeof(soname))
return SLBT_BUFFER_ERROR(dctx);
@@ -1324,11 +1326,12 @@ static int slbt_exec_link_create_library(
*ectx->lsoname = soname;
} else if (!(dctx->cctx->drvflags & SLBT_DRIVER_AVOID_VERSION)) {
- if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s%s%s.%d",
+ if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s%s%s.%d%s",
ectx->sonameprefix,
dctx->cctx->libname,
- dctx->cctx->settings.dsosuffix,
- dctx->cctx->verinfo.major)
+ dctx->cctx->settings.osdsuffix,
+ dctx->cctx->verinfo.major,
+ dctx->cctx->settings.osdfussix)
>= sizeof(soname))
return SLBT_BUFFER_ERROR(dctx);
@@ -1363,11 +1366,13 @@ static int slbt_exec_link_create_library(
} else if (dctx->cctx->drvflags & SLBT_DRIVER_AVOID_VERSION) {
strcpy(output,dsofilename);
} else {
- if ((size_t)snprintf(output,sizeof(output),"%s.%d.%d.%d",
- dsofilename,
+ if ((size_t)snprintf(output,sizeof(output),"%s%s.%d.%d.%d%s",
+ dsobasename,
+ dctx->cctx->settings.osdsuffix,
dctx->cctx->verinfo.major,
dctx->cctx->verinfo.minor,
- dctx->cctx->verinfo.revision)
+ dctx->cctx->verinfo.revision,
+ dctx->cctx->settings.osdfussix)
>= sizeof(output))
return SLBT_BUFFER_ERROR(dctx);
}
@@ -1621,11 +1626,13 @@ static int slbt_exec_link_create_library_symlink(
false))
return SLBT_NESTED_ERROR(dctx);
} else {
- sprintf(target,"%s.%d.%d.%d",
- ectx->dsofilename,
+ sprintf(target,"%s%s.%d.%d.%d%s",
+ ectx->dsobasename,
+ dctx->cctx->settings.osdsuffix,
dctx->cctx->verinfo.major,
dctx->cctx->verinfo.minor,
- dctx->cctx->verinfo.revision);
+ dctx->cctx->verinfo.revision,
+ dctx->cctx->settings.osdfussix);
}
@@ -1635,9 +1642,11 @@ static int slbt_exec_link_create_library_symlink(
dctx->cctx->verinfo.major);
} else if (fmajor) {
- sprintf(lnkname,"%s.%d",
- ectx->dsofilename,
- dctx->cctx->verinfo.major);
+ sprintf(lnkname,"%s%s.%d%s",
+ ectx->dsobasename,
+ dctx->cctx->settings.osdsuffix,
+ dctx->cctx->verinfo.major,
+ dctx->cctx->settings.osdfussix);
} else {
strcpy(lnkname,ectx->dsofilename);
@@ -1683,24 +1692,26 @@ int slbt_exec_link(
actx = ectx;
/* libfoo.so.x.y.z */
- if ((size_t)snprintf(soxyz,sizeof(soxyz),"%s%s%s.%d.%d.%d",
+ if ((size_t)snprintf(soxyz,sizeof(soxyz),"%s%s%s.%d.%d.%d%s",
ectx->sonameprefix,
dctx->cctx->libname,
- dctx->cctx->settings.dsosuffix,
+ dctx->cctx->settings.osdsuffix,
dctx->cctx->verinfo.major,
dctx->cctx->verinfo.minor,
- dctx->cctx->verinfo.revision)
+ dctx->cctx->verinfo.revision,
+ dctx->cctx->settings.osdfussix)
>= sizeof(soxyz)) {
slbt_free_exec_ctx(actx);
return SLBT_BUFFER_ERROR(dctx);
}
/* libfoo.so.x */
- sprintf(soname,"%s%s%s.%d",
+ sprintf(soname,"%s%s%s.%d%s",
ectx->sonameprefix,
dctx->cctx->libname,
- dctx->cctx->settings.dsosuffix,
- dctx->cctx->verinfo.major);
+ dctx->cctx->settings.osdsuffix,
+ dctx->cctx->verinfo.major,
+ dctx->cctx->settings.osdfussix);
/* libfoo.so */
sprintf(solnk,"%s%s%s",
@@ -1773,6 +1784,7 @@ int slbt_exec_link(
/* linking: libfoo.so.x.y.z */
if (slbt_exec_link_create_library(
dctx,ectx,
+ ectx->dsobasename,
ectx->dsofilename,
ectx->relfilename)) {
slbt_free_exec_ctx(actx);