summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-17 15:26:04 -0400
committermidipix <writeonce@midipix.org>2016-04-17 17:33:21 -0400
commitbcd5af9ca57f03e0a63966ca3be6429e2e659605 (patch)
tree2c2780f5a6ecea9d5862c3f8f614e62777456e0a
parent3be47d3719ae8cc39c5a966cefdf5ef87f6393e0 (diff)
downloadslibtool-bcd5af9ca57f03e0a63966ca3be6429e2e659605.tar.bz2
slibtool-bcd5af9ca57f03e0a63966ca3be6429e2e659605.tar.xz
driver: added image format support.
-rw-r--r--include/slibtool/slibtool.h4
-rw-r--r--src/driver/slbt_driver_ctx.c21
2 files changed, 18 insertions, 7 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index 24dd8be..cb9a75d 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -53,6 +53,9 @@ extern "C" {
#define SLBT_DRIVER_NO_UNDEFINED 0x040000
#define SLBT_DRIVER_MODULE 0x080000
#define SLBT_DRIVER_AVOID_VERSION 0x100000
+#define SLBT_DRIVER_IMAGE_ELF 0x200000
+#define SLBT_DRIVER_IMAGE_PE 0x400000
+#define SLBT_DRIVER_IMAGE_MACHO 0x800000
/* execution modes */
enum slbt_mode {
@@ -132,6 +135,7 @@ struct slbt_host_params {
};
struct slbt_flavor_settings {
+ const char * imagefmt;
const char * arprefix;
const char * arsuffix;
const char * dsoprefix;
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 919e823..36f1466 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -16,15 +16,15 @@
/* flavor settings */
-#define SLBT_FLAVOR_SETTINGS(flavor,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv) \
+#define SLBT_FLAVOR_SETTINGS(flavor,bfmt,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv) \
static const struct slbt_flavor_settings flavor = { \
- arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv}
+ bfmt,arp,ars,dsop,dsos,exep,exes,impp,imps,ldenv}
-SLBT_FLAVOR_SETTINGS(host_flavor_default, "lib",".a", "lib",".so", "","", "", "", "LD_LIBRARY_PATH");
-SLBT_FLAVOR_SETTINGS(host_flavor_midipix, "lib",".a", "lib",".so", "","", "lib",".lib.a", "PATH");
-SLBT_FLAVOR_SETTINGS(host_flavor_mingw, "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH");
-SLBT_FLAVOR_SETTINGS(host_flavor_cygwin, "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH");
-SLBT_FLAVOR_SETTINGS(host_flavor_darwin, "lib",".a", "lib",".dylib", "","", "", "", "DYLD_LIBRARY_PATH");
+SLBT_FLAVOR_SETTINGS(host_flavor_default, "elf", "lib",".a", "lib",".so", "","", "", "", "LD_LIBRARY_PATH");
+SLBT_FLAVOR_SETTINGS(host_flavor_midipix, "pe", "lib",".a", "lib",".so", "","", "lib",".lib.a", "PATH");
+SLBT_FLAVOR_SETTINGS(host_flavor_mingw, "pe", "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH");
+SLBT_FLAVOR_SETTINGS(host_flavor_cygwin, "pe", "lib",".a", "lib",".dll", "",".exe", "lib",".dll.a", "PATH");
+SLBT_FLAVOR_SETTINGS(host_flavor_darwin, "macho","lib",".a", "lib",".dylib", "","", "", "", "DYLD_LIBRARY_PATH");
/* annotation strings */
@@ -440,6 +440,13 @@ static void slbt_init_flavor_settings(struct slbt_common_ctx * cctx)
else
settings = &host_flavor_default;
+ if (!strcmp(settings->imagefmt,"elf"))
+ cctx->drvflags |= SLBT_DRIVER_IMAGE_ELF;
+ else if (!strcmp(settings->imagefmt,"pe"))
+ cctx->drvflags |= SLBT_DRIVER_IMAGE_PE;
+ else if (!strcmp(settings->imagefmt,"macho"))
+ cctx->drvflags |= SLBT_DRIVER_IMAGE_PE;
+
memcpy(&cctx->settings,settings,sizeof(*settings));
}