This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [arnm-elf-objdump] Can't use two -M flags for disassembler(-Mforce-thumb and -Mreg-names-raw)
Hi Guys,
I am applying this patch which should fix the parsing of the -M
switch properly.
It allows multiple -M switches on the command line, and it documents
that a single -M switch can contain comma separated target specific
options. It also updates the arm disassembler to accept these comma
separated options.
Cheers
Nick
binutils/ChangeLog
2003-07-18 Nick Clifton <nickc@redhat.com>
* objdump.c (main) :Accept multiple -M switch.
* doc/binutils.texi: Document that multiple -M switches are
accepted and that a single -M switch can contain comma
separated options.
opcodes/ChangeLog
2003-07-18 Nick Clifton <nickc@redhat.com>
* arm-dis.c (parse_arm_disassembler_option): Do not expect
option string to be NUL terminated.
(parse_disassembler_options): Allow options to be space or
comma separated.
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.68
diff -c -3 -p -r1.68 objdump.c
*** binutils/objdump.c 17 Jul 2003 17:02:46 -0000 1.68
--- binutils/objdump.c 18 Jul 2003 11:17:36 -0000
*************** main (argc, argv)
*** 2661,2672 ****
break;
case 'M':
if (disassembler_options)
! {
! non_fatal ("multiple separate -M options are not supported.");
! non_fatal ("please combine them into a single, space separated option.");
! non_fatal ("ignoring option '-M%s'", disassembler_options);
! }
! disassembler_options = optarg;
break;
case 'j':
if (only == NULL)
--- 2661,2670 ----
break;
case 'M':
if (disassembler_options)
! /* Ignore potential memory leak for now. */
! disassembler_options = concat (disassembler_options, ",", optarg, NULL);
! else
! disassembler_options = optarg;
break;
case 'j':
if (only == NULL)
Index: binutils/doc/binutils.texi
===================================================================
RCS file: /cvs/src/src/binutils/doc/binutils.texi,v
retrieving revision 1.43
diff -c -3 -p -r1.43 binutils.texi
*** binutils/doc/binutils.texi 17 Jul 2003 17:02:46 -0000 1.43
--- binutils/doc/binutils.texi 18 Jul 2003 11:17:40 -0000
*************** architectures with the @option{-i} optio
*** 1625,1639 ****
@item -M @var{options}
@itemx --disassembler-options=@var{options}
Pass target specific information to the disassembler. Only supported on
! some targets. Note only a single instance of the option on the
! command line is supported. If the option occurs more than once, the
! earlier versions will be ignored. If it is necessary to specify more
! than one disassembler option then they should be placed together into
! a space separated list. ie:
!
! @smallexample
! -M"first-disassembler-option second-disassembler-option"
! @end smallexample
If the target is an ARM architecture then this switch can be used to
select which register name set is used during disassembler. Specifying
--- 1625,1633 ----
@item -M @var{options}
@itemx --disassembler-options=@var{options}
Pass target specific information to the disassembler. Only supported on
! some targets. If it is necessary to specify more than one
! disassembler option then multiple @option{-M} options can be used or
! can be placed together into a comma separated list.
If the target is an ARM architecture then this switch can be used to
select which register name set is used during disassembler. Specifying
Index: opcodes/arm-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/arm-dis.c,v
retrieving revision 1.32
diff -c -3 -p -r1.32 arm-dis.c
*** opcodes/arm-dis.c 1 Apr 2003 13:08:06 -0000 1.32
--- opcodes/arm-dis.c 18 Jul 2003 11:17:41 -0000
***************
*** 27,32 ****
--- 27,33 ----
#include "coff/internal.h"
#include "libcoff.h"
#include "opintl.h"
+ #include "safe-ctype.h"
/* FIXME: This shouldn't be done here. */
#include "elf-bfd.h"
*************** parse_arm_disassembler_option (option)
*** 1152,1202 ****
option += 10;
for (i = NUM_ARM_REGNAMES; i--;)
! if (streq (option, regnames[i].name))
{
regname_selected = i;
break;
}
if (i < 0)
fprintf (stderr, _("Unrecognised register name set: %s\n"), option);
}
! else if (streq (option, "force-thumb"))
force_thumb = 1;
! else if (streq (option, "no-force-thumb"))
force_thumb = 0;
else
fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
return;
}
! /* Parse the string of disassembler options, spliting it at whitespaces. */
static void
parse_disassembler_options (options)
char * options;
{
- char * space;
-
if (options == NULL)
return;
! do
{
! space = strchr (options, ' ');
! if (space)
! {
! * space = '\0';
! parse_arm_disassembler_option (options);
! * space = ' ';
! options = space + 1;
! }
! else
! parse_arm_disassembler_option (options);
}
- while (space);
}
/* NOTE: There are no checks in these routines that
--- 1153,1200 ----
option += 10;
for (i = NUM_ARM_REGNAMES; i--;)
! if (strneq (option, regnames[i].name, strlen (regnames[i].name)))
{
regname_selected = i;
break;
}
if (i < 0)
+ /* XXX - should break 'option' at following delimiter. */
fprintf (stderr, _("Unrecognised register name set: %s\n"), option);
}
! else if (strneq (option, "force-thumb", 11))
force_thumb = 1;
! else if (strneq (option, "no-force-thumb", 14))
force_thumb = 0;
else
+ /* XXX - should break 'option' at following delimiter. */
fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
return;
}
! /* Parse the string of disassembler options, spliting it at whitespaces
! or commas. (Whitespace separators supported for backwards compatibility). */
static void
parse_disassembler_options (options)
char * options;
{
if (options == NULL)
return;
! while (*options)
{
! parse_arm_disassembler_option (options);
! /* Skip forward to next seperator. */
! while ((*options) && (! ISSPACE (*options)) && (*options != ','))
! ++ options;
! /* Skip forward past seperators. */
! while (ISSPACE (*options) || (*options == ','))
! ++ options;
}
}
/* NOTE: There are no checks in these routines that