This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fix the incorrect assembling for ppc wait mnemonic
- From: Zavier Luo <zavier dot luo at gmail dot com>
- To: Peter Bergner <bergner at vnet dot ibm dot com>
- Cc: binutils at sourceware dot org, Scott Wood <scott dot wood at nxp dot com>
- Date: Sun, 3 Jul 2016 09:37:23 +0800
- Subject: Re: [PATCH] Fix the incorrect assembling for ppc wait mnemonic
- Authentication-results: sourceware.org; auth=none
- References: <1466409386-12860-1-git-send-email-zavier dot luo at gmail dot com> <d9e9c79e-c759-ed77-0cea-8c85f40e6411 at vnet dot ibm dot com> <CAJ2zpq6DK3zHy0BR1FKgqXpf4Rrf616tdOVnxVbLetrhEWN6Nw at mail dot gmail dot com> <be945e76-391b-7b49-3a97-7dfc64e11390 at vnet dot ibm dot com> <CAJ2zpq56QesOhyzNBZrRtv_KAqm7HKo8+=Gkhpwjh2P2O5e-Fg at mail dot gmail dot com>
Hi Peter,
I still have some different thought of the default setting of -mcpu.
-mcpu=powerpc64 should *not* mean "latest server cpu" (and that's a
lousy default as well when -mcpu is not specified), and even if we had
specified -mcpu=power9 (or whatever) why is it producing the waitasec
opcode in response to a plain "wait" mnemonic?
May I know about your comments?
On Tue, Jun 28, 2016 at 3:32 PM, Zavier Luo <zavier.luo@gmail.com> wrote:
> Hi Peter,
>
> Thanks a lot for your comments,
>
> You are correct, after passing the -mcpu=e500mc pamater, the code can be
> assembled correctly. Please ignore the patch.
>
>
> --
> Cheers,
>
> Zavier
>
> On Tue, Jun 21, 2016 at 12:05 PM, Peter Bergner <bergner@vnet.ibm.com>
> wrote:
>>
>> On 6/20/16 10:30 PM, Zavier Luo wrote:
>> > Hello Peter,
>> >
>> > When the "wait" instruction is used for NXP ppce500mc targets, the
>> > toolchain is incorrectly assembling the wait mnemonic into 0x7c00003c
>> > which gdb disassembles as "waitasec", the right value is 0x7c007c. I
>> > found the reason is that wait and waitasec use the same opcode.
>> >
>> > I attached the source file, object files and hexdump files. Hope is is
>> > helpful for your understanding.
>>
>> You did not include the options you passed to gas to assemble the
>> asm file or the objdump options you used to disassemble them.
>> My guess is you didn't assemble the file with the correct gas
>> options, since wait is correctly assembled for me:
>>
>> [bergner@igoo idle_e500]$ cat wait.s
>> .text
>> _start:
>> wait
>> [bergner@igoo idle_e500]$ ../build/binutils-e500/gas/as-new -a32 -me500mc
>> -o wait.o wait.s
>> [bergner@igoo idle_e500]$ ../build/binutils-e500/binutils/objdump -d
>> -Me500mc wait.o
>>
>> wait.o: file format elf32-powerpc
>>
>>
>> Disassembly of section .text:
>>
>> 00000000 <_start>:
>> 0: 7c 00 00 7c wait
>>
>> Maybe you aren't passing any -m<CPU> option to gas? If you don't,
>> you're going to get an implicit -m<CPU> option that defaults to the
>> latest server cpu, which isn't what you want.
>>
>> Peter
--
Cheers,
Zavier