Hello,
I'm using powerpc-eabivle-gcc 4.9.2 (S32DS 1.1), but want to switch to 4.9.4 (S32DS 1.2). However, it seems there is a problem with the wait-instruction encoding in 4.9.4. To illustrate the problem the file test.c (see below) is compiled with gcc 4.9.2 and 4.9.4, and the object files are disassembled to show the difference in the instructions.
The C source file test.c:
int test()
{
asm volatile ("wait");
}
Output using GCC 4.9.2:
$ powerpc-eabivle-gcc -mvle -O2 -c -o test-4.9.2.o test.c
$ powerpc-eabivle-objdump -d test-4.9.2.o > test-4.9.2.o.dis$ cat test-4.9.2.o.dis
test-4.9.2.o: file format elf32-powerpc
Disassembly of section .text:00000000 <test>:
0: 7c 00 00 7c wait
4: 00 04 se_blr
Output using GCC 4.9.4:
$ powerpc-eabivle-gcc -mvle -O2 -c -o test-4.9.4.o test.c
$ powerpc-eabivle-objdump -d test-4.9.4.o > test-4.9.4.o.dis$ cat test-4.9.4.o.dis
test-4.9.4.o: file format elf32-powerpc
Disassembly of section .text:00000000 <test>:
0: 7c 00 00 3c .long 0x7c00003c
4: 00 04 se_blr
For some reason the wait-instruction becomes 0x7c00007c with 4.9.2 and 0x7c00003c with 4.9.4. Also note that the disassembler fails to decode the 4.9.4 instruction and outputs a general .long value.
Is this the expected behavior, a bug in gcc/binutils, or something else? Looks like a bug to me.
Thanks!
Solved! Go to Solution.
Hello Erik,
Thanks for this report.
The correct opcode for wait instruction is 0x7C00007C
I'd recommend you to use a direct instruction opcode as a workaround:
__asm (".long 0x7C00007C")
I'm going to log this issue as a defect into our defect tracking database
Stan
This issue is fixed in Update 2 S32 Design Studio for Power Architecture 2017.R1 - Update 2 available
Hello Erik,
Thanks for this report.
The correct opcode for wait instruction is 0x7C00007C
I'd recommend you to use a direct instruction opcode as a workaround:
__asm (".long 0x7C00007C")
I'm going to log this issue as a defect into our defect tracking database
Stan
Hi, has this been fixed in 2017.R1?
Hi,
This fix is NOT available in the latest version of S32DS 2017.R1.
Anyway the issue has been already fixed but haven't released it yet.
Currently the product team is scheduling when and how to release this update.
Stan