This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: x86 specific objdump options need documenting
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: amodra at bigpond dot net dot au, jbeulich at novell dot com, binutils at sources dot redhat dot com
- Date: Fri, 2 Feb 2007 07:15:16 -0800
- Subject: PATCH: x86 specific objdump options need documenting
- References: <m34pq4oh9b.fsf@redhat.com>
On Fri, Feb 02, 2007 at 12:50:40PM +0000, Nick Clifton wrote:
> Hi Guys,
>
> I just noticed today that the x86 port supports target specific
> command line options for objdump, but these are not documented in
> either binutils/doc/binutils.texi or via the disassembler_usage()
> function. Would any of you care to correct this oversight ?
>
The x86 specific objdump options are documented in
binutils/doc/binutils.texi. But disassembler_usage doesn't have them.
Here is a patch. I also added -Maddr64 for 64bit. It doesn't make any
senses to use addr32 for 64bit and addr16 for 16bit in 64bit mode.
I will check it in shortly.
H.J.
----
binutils/
2076-02-02 H.J. Lu <hongjiu.lu@intel.com>
* doc/binutils.texi (objdump): Document the new addr64 option
for i386 disassembler.
include/
2076-02-02 H.J. Lu <hongjiu.lu@intel.com>
* dis-asm.h (print_i386_disassembler_options): New.
opcodes/
2076-02-02 H.J. Lu <hongjiu.lu@intel.com>
* disassemble.c (disassembler_usage): Call
print_i386_disassembler_options for i386 disassembler.
* i386-dis.c (print_i386_disassembler_options): New.
(print_insn): Support the new addr64 option.
--- binutils/binutils/doc/binutils.texi.i386 2007-02-02 06:16:36.000000000 -0800
+++ binutils/binutils/doc/binutils.texi 2007-02-02 07:01:08.000000000 -0800
@@ -1760,7 +1760,7 @@ switch, but allow finer grained control.
following may be specified as a comma separated string.
@option{x86-64}, @option{i386} and @option{i8086} select disassembly for
the given architecture. @option{intel} and @option{att} select between
-intel syntax mode and AT&T syntax mode. @option{addr32},
+intel syntax mode and AT&T syntax mode. @option{addr64}, @option{addr32},
@option{addr16}, @option{data32} and @option{data16} specify the default
address size and operand size. These four options will be overridden if
@option{x86-64}, @option{i386} or @option{i8086} appear later in the
--- binutils/include/dis-asm.h.i386 2006-11-01 06:23:18.000000000 -0800
+++ binutils/include/dis-asm.h 2007-02-02 06:24:38.000000000 -0800
@@ -284,6 +284,7 @@ extern int print_insn_z8002 (bfd_vma, d
extern disassembler_ftype arc_get_disassembler (void *);
extern disassembler_ftype cris_get_disassembler (bfd *);
+extern void print_i386_disassembler_options (FILE *);
extern void print_mips_disassembler_options (FILE *);
extern void print_ppc_disassembler_options (FILE *);
extern void print_arm_disassembler_options (FILE *);
--- binutils/opcodes/disassemble.c.i386 2006-10-25 07:31:34.000000000 -0700
+++ binutils/opcodes/disassemble.c 2007-02-02 06:22:40.000000000 -0800
@@ -448,6 +448,9 @@ disassembler_usage (stream)
#ifdef ARCH_powerpc
print_ppc_disassembler_options (stream);
#endif
+#ifdef ARCH_i386
+ print_i386_disassembler_options (stream);
+#endif
return;
}
--- binutils/opcodes/i386-dis.c.i386 2006-12-15 05:13:12.000000000 -0800
+++ binutils/opcodes/i386-dis.c 2007-02-02 07:04:06.000000000 -0800
@@ -2856,6 +2856,26 @@ print_insn_i386 (bfd_vma pc, disassemble
return print_insn (pc, info);
}
+void
+print_i386_disassembler_options (FILE *stream)
+{
+ fprintf (stream, _("\n\
+The following i386/x86-64 specific disassembler options are supported for use\n\
+with the -M switch (multiple options should be separated by commas):\n"));
+
+ fprintf (stream, _(" x86-64 Disassemble in 64bit mode\n"));
+ fprintf (stream, _(" i386 Disassemble in 32bit mode\n"));
+ fprintf (stream, _(" i8086 Disassemble in 16bit mode\n"));
+ fprintf (stream, _(" att Display instruction in AT&T syntax\n"));
+ fprintf (stream, _(" intel Display instruction in Intel syntax\n"));
+ fprintf (stream, _(" addr64 Assume 64bit address size\n"));
+ fprintf (stream, _(" addr32 Assume 32bit address size\n"));
+ fprintf (stream, _(" addr16 Assume 16bit address size\n"));
+ fprintf (stream, _(" data32 Assume 32bit data size\n"));
+ fprintf (stream, _(" data16 Assume 16bit data size\n"));
+ fprintf (stream, _(" suffix Always display instruction suffix in AT&T syntax\n"));
+}
+
static int
print_insn (bfd_vma pc, disassemble_info *info)
{
@@ -2917,10 +2937,20 @@ print_insn (bfd_vma pc, disassemble_info
}
else if (CONST_STRNEQ (p, "addr"))
{
- if (p[4] == '1' && p[5] == '6')
- priv.orig_sizeflag &= ~AFLAG;
- else if (p[4] == '3' && p[5] == '2')
- priv.orig_sizeflag |= AFLAG;
+ if (address_mode == mode_64bit)
+ {
+ if (p[4] == '3' && p[5] == '2')
+ priv.orig_sizeflag &= ~AFLAG;
+ else if (p[4] == '6' && p[5] == '4')
+ priv.orig_sizeflag |= AFLAG;
+ }
+ else
+ {
+ if (p[4] == '1' && p[5] == '6')
+ priv.orig_sizeflag &= ~AFLAG;
+ else if (p[4] == '3' && p[5] == '2')
+ priv.orig_sizeflag |= AFLAG;
+ }
}
else if (CONST_STRNEQ (p, "data"))
{