[arnm-elf-objdump] Can't use two -M flags for disassembler (-Mforce-thumb and -Mreg-names-raw)

Nick Clifton nickc@redhat.com
Thu Jul 17 17:02:00 GMT 2003


Hi Vincent,

> Investigating a little more, this seems to happen even with
> ARM-only/THUMB_only code: the disassembler turns off -Mforce-thumb
> option when used with -Mreg-names-raw for an ADS object file, either
> ARM or THUMB code.

Thanks for the files.  I have now reproduced the problem - and you are
right.  Objdump does ignore all but the last -M switch on the command
line.  This is a consequence of the way the program is designed (or
rather evolved).

Fortunately however there is a workaround: combine the switches into a
single space separated list.  ie:

  -M"force-thumb reg-names-raw"

The attached patch will make objdump generate suitable warning
messages if multiple -M switches are used and it updates the
documentation to describe this "feature".

Cheers
        Nick

2003-07-17  Nick Clifton  <nickc@redhat.com>

	* objdump.c (main): Issue a warning message if multiple -M
	switches are used.
	
	* doc/binutils.texi (objdump): Update documentation about -M
	option.
	
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.67
diff -c -3 -p -r1.67 objdump.c
*** binutils/objdump.c	25 Jun 2003 06:40:25 -0000	1.67
--- binutils/objdump.c	17 Jul 2003 16:58:47 -0000
*************** main (argc, argv)
*** 2660,2665 ****
--- 2660,2671 ----
  	  machine = optarg;
  	  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':

Index: binutils/doc/binutils.texi
===================================================================
RCS file: /cvs/src/src/binutils/doc/binutils.texi,v
retrieving revision 1.42
diff -c -3 -p -r1.42 binutils.texi
*** binutils/doc/binutils.texi	26 Jun 2003 08:14:10 -0000	1.42
--- binutils/doc/binutils.texi	17 Jul 2003 16:58:51 -0000
*************** architectures with the @option{-i} optio
*** 1625,1631 ****
  @item -M @var{options}
  @itemx --disassembler-options=@var{options}
  Pass target specific information to the disassembler.  Only supported on
! some targets.
  
  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,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
        



More information about the Binutils mailing list