From 6f41153880f561e092fb7701a2db0facf6b6ffd9 Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 10 Jun 2021 08:31:23 +0000 Subject: driver: added --dumpmachine support. --- src/driver/slbt_amain.c | 6 ++++++ src/driver/slbt_driver_ctx.c | 17 ++++++++++++----- src/internal/slibtool_driver_impl.h | 1 + src/skin/slbt_skin_default.c | 5 +++++ 4 files changed, 24 insertions(+), 5 deletions(-) (limited to 'src') 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: 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; itargv[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. " -- cgit v1.2.3