This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RE: sh-coff-objdump cannot disassemble DSP instructions
- From: "Arati Dikey" <AratiD at kpit dot com>
- To: "Nick Clifton" <nickc at cambridge dot redhat dot com>
- Cc: <binutils at sources dot redhat dot com>
- Date: Wed, 16 Jan 2002 11:50:07 +0530
- Subject: RE: sh-coff-objdump cannot disassemble DSP instructions
Thanks Nick.
I am using the latest binutils sources. (GNU objdump 020106 20020106).
My test program is as follows.
test.s
movs.w @-R4, A0
mov.b @r2,r3
sh-coff-as -dsp test.s -o test-coff.o
sh-coff-objdump -D test.coff.o -EB
the output is
start-coff-o: file format coff-shl
Disassembly of section .text:
00000000 <.text>:
0: f4 70 .word 0xf470
2: 63 20 mov.b @r2,r3
...
Disassembly of section .data:
Now my problem is as follows.
1. I am not sure whether it is the assembler or the objdump utility
which needs to be changed.
2. Thinking its the assembler, I made following changes.
1. tc-sh.h
extern int sh_dsp ;
#define TARGET_MACH_DSP (sh_dsp ? 1 : 0 )
2. In obj-coff.c,
in function write_object_file() I inserted the foll. code.
#ifdef TARGET_MACH_DSP
bfd_set_arch_mach (abfd, BFD_ARCH, bfd_mach_sh_dsp);
#else
bfd_set_arch_mach (abfd, BFD_ARCH, machine);
#endif
3. Removed the static qualifier to 'sh_dsp' in tc_sh.c
4. Then, thru' gdb I verified the value of abfd->arch_info just
before bfd_write()
and it displays everything correctly. (arch = bfd_arch_sh, mach =
45, arch_name = "sh",
printable_name = "sh_dsp')
5. Despite this, sh-coff-objdump produces the *same* wrong result.
6. Incidently, if you supply -msh_dsp to sh-coff-objdump, it works
fine. But -m is an optional argument. And it works properly in
sh-elf-objdump w/o the -m option.
I am not sure how to proceed. Please guide me.
Regards,
Arati
-----Original Message-----
From: Nick Clifton [mailto:nickc@cambridge.redhat.com]
Sent: Tuesday, January 15, 2002 8:36 PM
To: Arati Dikey
Cc: binutils@sources.redhat.com
Subject: Re: sh-coff-objdump cannot disassemble DSP instructions
Hi Arati,
> The sh-coff-objdump cannot disassemble DSP instructions
> while the sh-elf-objdump does so. It simply interprets them as data
> (.word)
Which version of binutils are you using ? The current sources do not
appear to exhibit this behaviour.
> The 'static int sh_dsp' in tc-sh.c is set when -dsp option is given
> to assembler. How do I store this value in the bfd info ?
By calling bfd_set_arch_mach(). For example you might do something
like this:
bfd_set_arch_mach (stdoutput, TARGET_ARCH,
sh_dsp ? bfd_mach_sh_dsp : bfd_mach_sh);
in gas/config/tc-sh.c:md_begin().
Cheers
Nick