summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-10-25 23:31:46 -0400
committermidipix <writeonce@midipix.org>2017-10-25 23:40:47 -0400
commit7999c7b9c6f1806c4c99476651967dfba32673c4 (patch)
treea38d8ba197a7e388bbff7b274f427513e81ad407 /src/driver
parent94353c107745b6ea5ad130b0e48e4c9602c690de (diff)
downloadmdso-7999c7b9c6f1806c4c99476651967dfba32673c4.tar.bz2
mdso-7999c7b9c6f1806c4c99476651967dfba32673c4.tar.xz
driver: if --machine is unspecified, match the PE host or cross-target bits.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/mdso_driver_ctx.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/driver/mdso_driver_ctx.c b/src/driver/mdso_driver_ctx.c
index 75e44c8..9803391 100644
--- a/src/driver/mdso_driver_ctx.c
+++ b/src/driver/mdso_driver_ctx.c
@@ -159,6 +159,7 @@ int mdso_get_driver_ctx(
const struct argv_option * optv[MDSO_OPTV_ELEMENTS];
struct argv_meta * meta;
struct argv_entry * entry;
+ struct argv_entry * machine;
size_t nunits;
const char * program;
const char * pretty;
@@ -177,6 +178,7 @@ int mdso_get_driver_ctx(
/* cctx init, option defaults */
memset(&cctx,0,sizeof(cctx));
+ machine = 0;
nunits = 0;
pretty = 0;
implib = 0;
@@ -211,6 +213,8 @@ int mdso_get_driver_ctx(
break;
case TAG_QUAD_PTR:
+ machine = entry;
+
if (!(strcmp(entry->arg,"64")))
cctx.drvflags |= MDSO_DRIVER_QUAD_PTR;
else
@@ -250,6 +254,17 @@ int mdso_get_driver_ctx(
nunits++;
}
+
+ if (!machine && MDSO_DRIVER_PE_HOST && (sizeof(size_t) == 8))
+ cctx.drvflags |= MDSO_DRIVER_QUAD_PTR;
+
+ else if (!machine && MDSO_DRIVER_WINNT_HOST && (sizeof(size_t) == 8))
+ cctx.drvflags |= MDSO_DRIVER_QUAD_PTR;
+
+ else if (!machine && strstr(program,"64"))
+ cctx.drvflags |= MDSO_DRIVER_QUAD_PTR;
+
+
if (!nunits && !(cctx.drvflags & MDSO_DRIVER_VERSION))
return mdso_driver_usage(program,0,optv,meta);