public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Add -p auto and -e auto
@ 2021-03-26 11:05 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2021-03-26 11:05 UTC (permalink / raw)
  To: dwz, jakub, mark

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-26 11:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 11:05 [committed] Add -p auto and -e auto Tom de Vries

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).