summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-11 13:25:04 -0400
committermidipix <writeonce@midipix.org>2016-04-11 14:04:50 -0400
commita943fc79ea08792a9f1679183372bd4fccedcf2d (patch)
tree21a79deae240fd97991a432c15c1cc351c7aca73 /src/driver
parente0a0450b8764d54303d927e18aee1f038bcf66f7 (diff)
downloadslibtool-a943fc79ea08792a9f1679183372bd4fccedcf2d.tar.bz2
slibtool-a943fc79ea08792a9f1679183372bd4fccedcf2d.tar.xz
driver & execution context: added -module support.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/slbt_driver_ctx.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 3f7d2c5..5640453 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -480,10 +480,12 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
const char * prefix;
const char * base;
char * dot;
+ bool fmodule;
program = argv_program_name(ctx->cctx.targv[0]);
libname = 0;
prefix = 0;
+ fmodule = false;
/* output */
if (!(ctx->cctx.output)) {
@@ -545,7 +547,10 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
if (!strncmp(prefix,base,strlen(prefix)))
libname = base;
- else {
+ else if (ctx->cctx.drvflags & SLBT_DRIVER_MODULE) {
+ libname = base;
+ fmodule = true;
+ } else {
if (ctx->cctx.drvflags & SLBT_DRIVER_VERBOSITY_ERRORS)
fprintf(stderr,
"%s: error: output file prefix does "
@@ -558,7 +563,10 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
return 0;
/* libname alloc */
- if (!(ctx->libname = strdup(libname + strlen(prefix))))
+ if (!fmodule)
+ libname += strlen(prefix);
+
+ if (!(ctx->libname = strdup(libname)))
return -1;
dot = strrchr(ctx->libname,'.');
@@ -746,6 +754,10 @@ int slbt_get_driver_ctx(
cctx.drvflags |= SLBT_DRIVER_NO_UNDEFINED;
break;
+ case TAG_MODULE:
+ cctx.drvflags |= SLBT_DRIVER_MODULE;
+ break;
+
case TAG_SHARED:
cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_STATIC;
break;