summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-10-25 22:26:30 -0400
committermidipix <writeonce@midipix.org>2017-10-26 01:03:43 -0400
commitfbda3a30a94210a48e797fa9c9dc635f3afaceb9 (patch)
tree8ad8665cdf3154773df1f6dccf0b3f3a422043fe
parentb6abc337906e43f92f50e075f49df407946fc6fe (diff)
downloadslibtool-fbda3a30a94210a48e797fa9c9dc635f3afaceb9.tar.bz2
slibtool-fbda3a30a94210a48e797fa9c9dc635f3afaceb9.tar.xz
driver: added --mdso and --implib support.
-rw-r--r--include/slibtool/slibtool.h6
-rw-r--r--src/driver/slbt_driver_ctx.c44
-rw-r--r--src/internal/slibtool_driver_impl.h3
-rw-r--r--src/output/slbt_output_config.c6
-rw-r--r--src/skin/slbt_skin_default.c11
5 files changed, 70 insertions, 0 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index 25820be..c320ee9 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -26,6 +26,8 @@ extern "C" {
#define SLBT_ERROR 0x02
/* driver flags */
+#define SLBT_DRIVER_XFLAG(x) ((uint64_t)x << 32)
+
#define SLBT_DRIVER_VERBOSITY_NONE 0x0000
#define SLBT_DRIVER_VERBOSITY_ERRORS 0x0001
#define SLBT_DRIVER_VERBOSITY_STATUS 0x0002
@@ -63,6 +65,9 @@ extern "C" {
#define SLBT_DRIVER_ANNOTATE_NEVER 0x20000000
#define SLBT_DRIVER_ANNOTATE_FULL 0x40000000
+#define SLBT_DRIVER_IMPLIB_IDATA SLBT_DRIVER_XFLAG(0x0001)
+#define SLBT_DRIVER_IMPLIB_DSOMETA SLBT_DRIVER_XFLAG(0x0002)
+
/* error flags */
#define SLBT_ERROR_TOP_LEVEL 0x0001
#define SLBT_ERROR_NESTED 0x0002
@@ -189,6 +194,7 @@ struct slbt_host_params {
const char * ar;
const char * ranlib;
const char * dlltool;
+ const char * mdso;
const char * ldrpath;
};
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 8100e0a..8d2fa6e 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -532,6 +532,31 @@ static int slbt_init_host_params(
host->dlltool = drvhost->dlltool;
}
+ /* mdso */
+ if (host->mdso)
+ cfgmeta->mdso = cfgexplicit;
+
+ else if (strcmp(host->flavor,"cygwin")
+ && strcmp(host->flavor,"midipix")
+ && strcmp(host->flavor,"mingw")) {
+ host->mdso = "";
+ cfgmeta->mdso = "not applicable";
+
+ } else {
+ if (!(drvhost->mdso = calloc(1,toollen)))
+ return -1;
+
+ if (fnative) {
+ strcpy(drvhost->mdso,"mdso");
+ cfgmeta->mdso = cfgnative;
+ } else {
+ sprintf(drvhost->mdso,"%s-mdso",host->host);
+ cfgmeta->mdso = cfghost;
+ }
+
+ host->mdso = drvhost->mdso;
+ }
+
return 0;
}
@@ -555,6 +580,9 @@ static void slbt_free_host_params(struct slbt_host_strs * host)
if (host->dlltool)
free(host->dlltool);
+ if (host->mdso)
+ free(host->mdso);
+
memset(host,0,sizeof(*host));
}
@@ -902,6 +930,18 @@ int slbt_get_driver_ctx(
break;
+ case TAG_IMPLIB:
+ if (!strcmp("idata",entry->arg)) {
+ cctx.drvflags |= SLBT_DRIVER_IMPLIB_IDATA;
+ cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_IMPLIB_DSOMETA;
+
+ } else if (!strcmp("never",entry->arg)) {
+ cctx.drvflags |= SLBT_DRIVER_IMPLIB_DSOMETA;
+ cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_IMPLIB_IDATA;
+ }
+
+ break;
+
case TAG_WARNINGS:
if (!strcmp("all",entry->arg))
cctx.warnings = SLBT_WARNING_LEVEL_ALL;
@@ -963,6 +1003,10 @@ int slbt_get_driver_ctx(
cctx.host.dlltool = entry->arg;
break;
+ case TAG_MDSO:
+ cctx.host.mdso = entry->arg;
+ break;
+
case TAG_OUTPUT:
cctx.output = entry->arg;
break;
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index b630126..b255042 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -35,6 +35,8 @@ enum app_tags {
TAG_AR,
TAG_RANLIB,
TAG_DLLTOOL,
+ TAG_MDSO,
+ TAG_IMPLIB,
TAG_OUTPUT,
TAG_BINDIR,
TAG_LDRPATH,
@@ -71,6 +73,7 @@ struct slbt_host_strs {
char * ar;
char * ranlib;
char * dlltool;
+ char * mdso;
};
struct slbt_driver_ctx_impl {
diff --git a/src/output/slbt_output_config.c b/src/output/slbt_output_config.c
index d1d9712..800c6c3 100644
--- a/src/output/slbt_output_config.c
+++ b/src/output/slbt_output_config.c
@@ -63,6 +63,9 @@ int slbt_output_config(const struct slbt_driver_ctx * dctx)
if ((len = strlen(cctx->host.dlltool)) > midwidth)
midwidth = len;
+ if ((len = strlen(cctx->host.mdso)) > midwidth)
+ midwidth = len;
+
midwidth += SLBT_TAB_WIDTH;
midwidth &= (~(SLBT_TAB_WIDTH-1));
@@ -93,6 +96,9 @@ int slbt_output_config(const struct slbt_driver_ctx * dctx)
if (slbt_output_config_line("dlltool",cctx->host.dlltool,cctx->cfgmeta.dlltool,midwidth))
return SLBT_SYSTEM_ERROR(dctx);
+ if (slbt_output_config_line("mdso",cctx->host.mdso,cctx->cfgmeta.mdso,midwidth))
+ return SLBT_SYSTEM_ERROR(dctx);
+
return fflush(stdout)
? SLBT_SYSTEM_ERROR(dctx)
: 0;
diff --git a/src/skin/slbt_skin_default.c b/src/skin/slbt_skin_default.c
index 40eb189..ceb4d30 100644
--- a/src/skin/slbt_skin_default.c
+++ b/src/skin/slbt_skin_default.c
@@ -91,6 +91,17 @@ const struct argv_option slbt_default_options[] = {
"explicitly specify the PE import library generator "
"to be used"},
+ {"mdso", 0,TAG_MDSO,ARGV_OPTARG_REQUIRED,0,0,"<mdso>",
+ "explicitly specify the PE custom import library "
+ "generator to be used"},
+
+ {"implib", 0,TAG_IMPLIB,ARGV_OPTARG_REQUIRED,0,
+ "idata|dsometa",0,
+ "PE import libraries should either use the legacy "
+ "format (.idata section) and be generated by dlltool, "
+ "or the custom format (.dsometa section) and be "
+ "generated by mdso"},
+
{"warnings", 0,TAG_WARNINGS,ARGV_OPTARG_REQUIRED,0,
"all|none|error",0,
"set the warning reporting level; "