[PATCH] Fix the incorrect assembling for ppc wait mnemonic

Peter Bergner bergner@vnet.ibm.com
Tue Jun 21 04:05:00 GMT 2016


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





More information about the Binutils mailing list