diff options
Diffstat (limited to 'src/driver')
-rw-r--r-- | src/driver/slbt_amain.c | 22 | ||||
-rw-r--r-- | src/driver/slbt_driver_ctx.c | 12 | ||||
-rw-r--r-- | src/driver/slbt_split_argv.c | 15 |
3 files changed, 43 insertions, 6 deletions
diff --git a/src/driver/slbt_amain.c b/src/driver/slbt_amain.c index e0f4241..a9cc118 100644 --- a/src/driver/slbt_amain.c +++ b/src/driver/slbt_amain.c @@ -67,6 +67,16 @@ static ssize_t slbt_print_m4_dir(int fdout) return slbt_dprintf(fdout,"%s\n",SLBT_PACKAGE_DATADIR); } +static ssize_t slbt_print_shared_ext(int fdout, struct slbt_driver_ctx * dctx) +{ + return slbt_dprintf(fdout,"%s\n",dctx->cctx->settings.dsosuffix); +} + +static ssize_t slbt_print_static_ext(int fdout, struct slbt_driver_ctx * dctx) +{ + return slbt_dprintf(fdout,"%s\n",dctx->cctx->settings.arsuffix); +} + static void slbt_perform_driver_actions(struct slbt_driver_ctx * dctx) { if (dctx->cctx->drvflags & SLBT_DRIVER_INFO) @@ -219,6 +229,18 @@ int slbt_main(char ** argv, char ** envp, const struct slbt_fd_ctx * fdctx) ? slbt_exit(dctx,SLBT_ERROR) : slbt_exit(dctx,SLBT_OK); + /* -print-shared-ext must be the first (and only) action */ + if (dctx->cctx->drvflags & SLBT_DRIVER_OUTPUT_SHARED_EXT) + return (slbt_print_shared_ext(fdout,dctx) < 0) + ? slbt_exit(dctx,SLBT_ERROR) + : slbt_exit(dctx,SLBT_OK); + + /* -print-static-ext must be the first (and only) action */ + if (dctx->cctx->drvflags & SLBT_DRIVER_OUTPUT_STATIC_EXT) + return (slbt_print_static_ext(fdout,dctx) < 0) + ? slbt_exit(dctx,SLBT_ERROR) + : slbt_exit(dctx,SLBT_OK); + /* perform all other actions */ slbt_perform_driver_actions(dctx); diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index 76c7c4a..09adb68 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -440,6 +440,7 @@ int slbt_lib_get_driver_ctx( sargv.cargv = 0; objlistv = 0; ndlopen = 0; + lflags = 0; switch (slbt_split_argv(argv,flags,&sargv,&objlistv,fdctx->fderr,fdctx->fdcwd)) { case SLBT_OK: @@ -617,6 +618,14 @@ int slbt_lib_get_driver_ctx( cctx.drvflags |= SLBT_DRIVER_OUTPUT_M4_DIR; break; + case TAG_PRINT_SHARED_EXT: + cctx.drvflags |= SLBT_DRIVER_OUTPUT_SHARED_EXT; + break; + + case TAG_PRINT_STATIC_EXT: + cctx.drvflags |= SLBT_DRIVER_OUTPUT_STATIC_EXT; + break; + case TAG_DEBUG: cctx.drvflags |= SLBT_DRIVER_DEBUG; break; @@ -1004,7 +1013,8 @@ int slbt_lib_get_driver_ctx( if (cctx.drvflags & SLBT_DRIVER_HEURISTICS) { if (slbt_get_lconf_flags(&ctx->ctx,lconf,&lflags,false) < 0) - return slbt_lib_get_driver_ctx_fail(&ctx->ctx,0); + if (!(cctx.drvflags & SLBT_DRIVER_OUTPUT_MASK)) + return slbt_lib_get_driver_ctx_fail(&ctx->ctx,0); } else { switch (cctx.mode) { case SLBT_MODE_UNKNOWN: diff --git a/src/driver/slbt_split_argv.c b/src/driver/slbt_split_argv.c index 8fd131a..f9828f1 100644 --- a/src/driver/slbt_split_argv.c +++ b/src/driver/slbt_split_argv.c @@ -60,6 +60,7 @@ slbt_hidden int slbt_split_argv( struct argv_entry * ccwrap; struct argv_entry * dumpmachine; struct argv_entry * printdir; + struct argv_entry * printext; struct argv_entry * aropt; struct argv_entry * stoolieopt; const struct argv_option ** popt; @@ -67,7 +68,7 @@ slbt_hidden int slbt_split_argv( const struct argv_option * optv[SLBT_OPTV_ELEMENTS]; struct argv_ctx ctx = {ARGV_VERBOSITY_NONE, ARGV_MODE_SCAN, - 0,0,0,0,0,0,0}; + 0,0,0,0,0,0,0,0}; program = slbt_program_name(argv[0]); @@ -126,7 +127,7 @@ slbt_hidden int slbt_split_argv( /* missing all of --mode, --help, --version, --info, --config, --dumpmachine, --features, and --finish? */ /* as well as -print-aux-dir and -print-m4-dir? */ - mode = help = version = info = config = finish = features = ccwrap = dumpmachine = printdir = aropt = stoolieopt = 0; + mode = help = version = info = config = finish = features = ccwrap = dumpmachine = printdir = printext = aropt = stoolieopt = 0; for (entry=meta->entries; entry->fopt; entry++) if (entry->tag == TAG_MODE) @@ -151,6 +152,10 @@ slbt_hidden int slbt_split_argv( printdir = entry; else if (entry->tag == TAG_PRINT_M4_DIR) printdir = entry; + else if (entry->tag == TAG_PRINT_SHARED_EXT) + printext = entry; + else if (entry->tag == TAG_PRINT_STATIC_EXT) + printext = entry; /* alternate execusion mode? */ if (!altmode && mode && !strcmp(mode->arg,"ar")) @@ -175,7 +180,7 @@ slbt_hidden int slbt_split_argv( return -1; } - if (!mode && !help && !version && !info && !config && !finish && !features && !dumpmachine && !printdir && !altmode) { + if (!mode && !help && !version && !info && !config && !finish && !features && !dumpmachine && !printdir && !printext && !altmode) { slbt_dprintf(fderr, "%s: error: --mode must be specified.\n", program); @@ -183,7 +188,7 @@ slbt_hidden int slbt_split_argv( } /* missing compiler? */ - if (!ctx.unitidx && !help && !info && !config && !version && !finish && !features && !dumpmachine && !printdir) { + if (!ctx.unitidx && !help && !info && !config && !version && !finish && !features && !dumpmachine && !printdir && !printext) { if (!altmode && !aropt && !stoolieopt) { if (flags & SLBT_DRIVER_VERBOSITY_ERRORS) slbt_dprintf(fderr, @@ -345,7 +350,7 @@ slbt_hidden int slbt_split_argv( if (ctx.unitidx) { (void)0; - } else if (help || version || features || info || config || dumpmachine || printdir || altmode) { + } else if (help || version || features || info || config || dumpmachine || printdir || printext || altmode) { for (i=0; i<argc; i++) sargv->targv[i] = argv[i]; |