summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-07-19 01:03:37 +0000
committermidipix <writeonce@midipix.org>2024-07-19 01:03:37 +0000
commit979507dfb71780d8ac2bd393d4e914e5578900f9 (patch)
tree4134f7ad4c3b4c0808ef6b715ce984bf36337c7a /src/driver
parent64383cc119375fe535f7c5acd5bf93c74fe4e988 (diff)
downloadslibtool-979507dfb71780d8ac2bd393d4e914e5578900f9.tar.bz2
slibtool-979507dfb71780d8ac2bd393d4e914e5578900f9.tar.xz
driver: added the -print-shared-ext and -print-static-ext output commands.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/slbt_amain.c22
-rw-r--r--src/driver/slbt_driver_ctx.c8
-rw-r--r--src/driver/slbt_split_argv.c13
3 files changed, 39 insertions, 4 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..c4f50b5 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -617,6 +617,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;
diff --git a/src/driver/slbt_split_argv.c b/src/driver/slbt_split_argv.c
index 71c1342..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;
@@ -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];