[committed] Add -p auto and -e auto
Tom de Vries
tdevries@suse.de
Fri Mar 26 11:05:12 GMT 2021
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.
More information about the Dwz
mailing list