This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix the incorrect assembling for ppc wait mnemonic

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 <> 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 <>
> 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]