summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/slibtool/slibtool.h2
-rw-r--r--src/logic/slbt_exec_ctx.c7
-rw-r--r--src/logic/slbt_exec_link.c13
3 files changed, 21 insertions, 1 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index 60b3b73..1052303 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -93,6 +93,8 @@ struct slbt_exec_ctx {
char ** fpic;
char ** cass;
char ** noundef;
+ char ** soname;
+ char ** lsoname;
char ** lout[2];
char ** sentinel;
FILE * fwrapper;
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c
index 8b20f95..620cde7 100644
--- a/src/logic/slbt_exec_ctx.c
+++ b/src/logic/slbt_exec_ctx.c
@@ -227,8 +227,10 @@ int slbt_get_exec_ctx(
ictx->ctx.fpic = &ictx->ctx.argv[i++];
ictx->ctx.cass = &ictx->ctx.argv[i++];
-
ictx->ctx.noundef = &ictx->ctx.argv[i++];
+ ictx->ctx.soname = &ictx->ctx.argv[i++];
+ ictx->ctx.lsoname = &ictx->ctx.argv[i++];
+
ictx->ctx.lout[0] = &ictx->ctx.argv[i++];
ictx->ctx.lout[1] = &ictx->ctx.argv[i++];
ictx->ctx.sentinel= &ictx->ctx.argv[i++];
@@ -361,6 +363,9 @@ void slbt_reset_placeholders(struct slbt_exec_ctx * ectx)
*ectx->cass = "-USLIBTOOL_PLACEHOLDER_COMPILE_ASSEMBLE";
*ectx->noundef = "-USLIBTOOL_PLACEHOLDER_NO_UNDEFINED";
+ *ectx->soname = "-USLIBTOOL_PLACEHOLDER_SONAME";
+ *ectx->lsoname = "-USLIBTOOL_PLACEHOLDER_LSONAME";
+
*ectx->lout[0] = "-USLIBTOOL_PLACEHOLDER_OUTPUT_SWITCH";
*ectx->lout[1] = "-USLIBTOOL_PLACEHOLDER_OUTPUT_FILE";
*ectx->sentinel= 0;
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index 025ae56..e483ced 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -322,6 +322,7 @@ static int slbt_exec_link_create_library(
{
char ** parg;
char output [PATH_MAX];
+ char soname [PATH_MAX];
/* initial state */
slbt_reset_arguments(ectx);
@@ -344,6 +345,18 @@ static int slbt_exec_link_create_library(
if (dctx->cctx->drvflags & SLBT_DRIVER_NO_UNDEFINED)
*ectx->noundef = "-Wl,--no-undefined";
+ /* -soname */
+ if ((size_t)snprintf(soname,sizeof(soname),"-Wl,%s%s%s.%d",
+ dctx->cctx->settings.dsoprefix,
+ dctx->cctx->libname,
+ dctx->cctx->settings.dsosuffix,
+ dctx->cctx->verinfo.major)
+ >= sizeof(soname))
+ return -1;
+
+ *ectx->soname = "-Wl,-soname";
+ *ectx->lsoname = soname;
+
/* shared object */
*ectx->dpic = "-shared";
*ectx->fpic = "-fPIC";