public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org
Subject: [committed] Add -p auto and -e auto
Date: Fri, 26 Mar 2021 12:05:12 +0100	[thread overview]
Message-ID: <20210326110510.GA8776@delia> (raw)

Hi,

Add new option argument auto for both -p and -e, to describe
the current behaviour more explicitly.

Committed to trunk.

Thanks,
- Tom

Add -p auto and -e auto

2021-03-26  Tom de Vries  <tdevries@suse.de>

	* args.c (usage, parse_args): Add auto option argument to -p and -e.
	* dwz.1 (-p, -e): Add auto option argument.

---
 args.c | 16 +++++++++++++---
 dwz.1  | 10 ++++++----
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/args.c b/args.c
index ee4e067..d44e632 100644
--- a/args.c
+++ b/args.c
@@ -233,9 +233,9 @@ static struct option_help dwz_multi_file_options_help[] =
   { "5", "dwarf-5", NULL, NULL,
     "Emit DWARF 5 standardized supplementary object files instead of"
     " GNU extension .debug_altlink." },
-  { "p", "multifile-pointer-size", "SIZE", NULL,
+  { "p", "multifile-pointer-size", "<SIZE|auto>", "auto",
     "Set pointer size of multifile, in number of bytes." },
-  { "e", "multifile-endian", "<l|L|b|B>", NULL,
+  { "e", "multifile-endian", "<l|b|auto>", "auto",
     "Set endianity of multifile." },
   { "j", "jobs", "<n>", "number of processors / 2",
     "Process <n> files in parallel" }
@@ -381,7 +381,7 @@ usage (int failing)
   FILE *stream = failing ? stderr : stdout;
   const char *header_lines[] = {
     "dwz [common options] [-h] [-m COMMONFILE] [-M NAME | -r] [-5]",
-    "    [-p SIZE] [-e <l|b>] [-j N] [FILES]",
+    "    [-p <SIZE|auto>] [-e <l|b|auto>] [-j N] [FILES]",
     "dwz [common options] -o OUTFILE FILE",
     "dwz [ -v | -? ]"
   };
@@ -641,6 +641,11 @@ parse_args (int argc, char *argv[], bool *hardlink, const char **outfile)
 	  break;
 
 	case 'p':
+	  if (strcmp (optarg, "auto") == 0)
+	    {
+	      multifile_force_ptr_size = 0;
+	      break;
+	    }
 	  l = strtoul (optarg, &end, 0);
 	  if (*end != '\0' || optarg == end || (unsigned int) l != l)
 	    error (1, 0, "invalid argument -l %s", optarg);
@@ -648,6 +653,11 @@ parse_args (int argc, char *argv[], bool *hardlink, const char **outfile)
 	  break;
 
 	case 'e':
+	  if (strcmp (optarg, "auto") == 0)
+	    {
+	      multifile_force_endian = 0;
+	      break;
+	    }
 	  if (strlen (optarg) != 1)
 	    error (1, 0, "invalid argument -l %s", optarg);
 	  switch (optarg[0])
diff --git a/dwz.1 b/dwz.1
index 2fa32f3..6fec6ed 100644
--- a/dwz.1
+++ b/dwz.1
@@ -77,11 +77,13 @@ the executable or shared library to the file named in the argument
 of the \fB-m\fR option.  Either \fB-M\fR or \fB-r\fR
 option can be specified, but not both.
 .TP
-.B \-p N \-\-multifile-pointer-size N
-Specify the pointer size of the multifile, in bytes.
+.B \-p N \-\-multifile-pointer-size <N|auto>
+Specify the pointer size of the multifile, in bytes.  If auto, use the
+pointer size of the files, provided they match.
 .TP
-.B \-p <l|L|B|b> \-\-multifile-endian <l|L|B|b>
-Specify the endianity of the multifile.
+.B \-p <l|b|auto> \-\-multifile-endian <l|b|auto>
+Specify the endianity of the multifile.  If auto, use the endianity of
+the files, provided they match.
 .TP
 .B \-q \-\-quiet
 Silence up some of the most common messages.

                 reply	other threads:[~2021-03-26 11:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210326110510.GA8776@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).