summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-06-10 08:31:23 +0000
committermidipix <writeonce@midipix.org>2021-06-10 08:31:23 +0000
commit6f41153880f561e092fb7701a2db0facf6b6ffd9 (patch)
tree01f4371826c5cd595b84b81b46b2cbeb25b55e5b
parente0e31fbb6cf0f9b1feec89893747dd4df30cebf6 (diff)
downloadslibtool-6f41153880f561e092fb7701a2db0facf6b6ffd9.tar.bz2
slibtool-6f41153880f561e092fb7701a2db0facf6b6ffd9.tar.xz
driver: added --dumpmachine support.
-rw-r--r--include/slibtool/slibtool.h1
-rw-r--r--src/driver/slbt_amain.c6
-rw-r--r--src/driver/slbt_driver_ctx.c17
-rw-r--r--src/internal/slibtool_driver_impl.h1
-rw-r--r--src/skin/slbt_skin_default.c5
5 files changed, 25 insertions, 5 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index 9f98726..ee34b9a 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -69,6 +69,7 @@ extern "C" {
#define SLBT_DRIVER_IMPLIB_DSOMETA SLBT_DRIVER_XFLAG(0x0002)
#define SLBT_DRIVER_EXPORT_DYNAMIC SLBT_DRIVER_XFLAG(0x0010)
#define SLBT_DRIVER_STATIC_LIBTOOL_LIBS SLBT_DRIVER_XFLAG(0x0100)
+#define SLBT_DRIVER_OUTPUT_MACHINE SLBT_DRIVER_XFLAG(0x1000)
/* error flags */
#define SLBT_ERROR_TOP_LEVEL 0x0001
diff --git a/src/driver/slbt_amain.c b/src/driver/slbt_amain.c
index d364ef4..3f78e76 100644
--- a/src/driver/slbt_amain.c
+++ b/src/driver/slbt_amain.c
@@ -164,6 +164,12 @@ int slbt_main(char ** argv, char ** envp, const struct slbt_fd_ctx * fdctx)
? !argv || !argv[0] || !argv[1] || !argv[2]
: SLBT_ERROR;
+ /* --dumpmachine disables all other actions */
+ if (dctx->cctx->drvflags & SLBT_DRIVER_OUTPUT_MACHINE)
+ return slbt_output_machine(dctx)
+ ? SLBT_ERROR : SLBT_OK;
+
+ /* --version is always the first action */
if (dctx->cctx->drvflags & SLBT_DRIVER_VERSION)
if ((slbt_version(dctx,fdout)) < 0)
return slbt_exit(dctx,SLBT_ERROR);
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index eed51bd..f8393ef 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -295,6 +295,7 @@ static int slbt_split_argv(
struct argv_entry * finish;
struct argv_entry * features;
struct argv_entry * ccwrap;
+ struct argv_entry * dumpmachine;
const struct argv_option ** popt;
const struct argv_option ** optout;
const struct argv_option * optv[SLBT_OPTV_ELEMENTS];
@@ -337,8 +338,8 @@ static int slbt_split_argv(
meta = argv_get(argv,optv,ARGV_VERBOSITY_NONE,fderr);
}
- /* missing all of --mode, --help, --version, --config, --features, and --finish? */
- mode = help = version = config = finish = features = ccwrap = 0;
+ /* missing all of --mode, --help, --version, --config, --dumpmachine, --features, and --finish? */
+ mode = help = version = config = finish = features = ccwrap = dumpmachine = 0;
for (entry=meta->entries; entry->fopt; entry++)
if (entry->tag == TAG_MODE)
@@ -355,10 +356,12 @@ static int slbt_split_argv(
features = entry;
else if (entry->tag == TAG_CCWRAP)
ccwrap = entry;
+ else if (entry->tag == TAG_DUMPMACHINE)
+ dumpmachine = entry;
argv_free(meta);
- if (!mode && !help && !version && !config && !finish && !features) {
+ if (!mode && !help && !version && !config && !finish && !features && !dumpmachine) {
slbt_dprintf(fderr,
"%s: error: --mode must be specified.\n",
program);
@@ -366,7 +369,7 @@ static int slbt_split_argv(
}
/* missing compiler? */
- if (!ctx.unitidx && !help && !version && !finish && !features) {
+ if (!ctx.unitidx && !help && !version && !finish && !features && !dumpmachine) {
if (flags & SLBT_DRIVER_VERBOSITY_ERRORS)
slbt_dprintf(fderr,
"%s: error: <compiler> is missing.\n",
@@ -491,7 +494,7 @@ static int slbt_split_argv(
if (ctx.unitidx) {
(void)0;
- } else if (help || version || features) {
+ } else if (help || version || features || dumpmachine) {
for (i=0; i<argc; i++)
sargv->targv[i] = argv[i];
@@ -1482,6 +1485,10 @@ int slbt_get_driver_ctx(
cctx.drvflags |= SLBT_DRIVER_CONFIG;
break;
+ case TAG_DUMPMACHINE:
+ cctx.drvflags |= SLBT_DRIVER_OUTPUT_MACHINE;
+ break;
+
case TAG_DEBUG:
cctx.drvflags |= SLBT_DRIVER_DEBUG;
break;
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index c70c334..b538ebc 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -24,6 +24,7 @@ enum app_tags {
TAG_HELP_ALL,
TAG_VERSION,
TAG_CONFIG,
+ TAG_DUMPMACHINE,
TAG_DEBUG,
TAG_DRY_RUN,
TAG_FEATURES,
diff --git a/src/skin/slbt_skin_default.c b/src/skin/slbt_skin_default.c
index b499101..a41b6d0 100644
--- a/src/skin/slbt_skin_default.c
+++ b/src/skin/slbt_skin_default.c
@@ -48,6 +48,11 @@ const struct argv_option slbt_default_options[] = {
{"features", 0,TAG_FEATURES,ARGV_OPTARG_NONE,0,0,0,
"show feature information"},
+ {"dumpmachine", 0,TAG_DUMPMACHINE,ARGV_OPTARG_NONE,0,0,0,
+ "print the cached result of the native compiler's "
+ "-dumpmachine output (bootstrapping: print the cached, "
+ "manual setting of CCHOST)."},
+
{"legabits", 0,TAG_LEGABITS,ARGV_OPTARG_OPTIONAL,0,
"enabled|disabled",0,
"enable/disable legacy bits, i.e. "