[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/17877] New: bad opcodes for coldfire m5307
From: |
angelo70 at gmail dot com |
Subject: |
[Bug gas/17877] New: bad opcodes for coldfire m5307 |
Date: |
Mon, 26 Jan 2015 18:23:24 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=17877
Bug ID: 17877
Summary: bad opcodes for coldfire m5307
Product: binutils
Version: 2.22
Status: NEW
Severity: normal
Priority: P2
Component: gas
Assignee: unassigned at sourceware dot org
Reporter: angelo70 at gmail dot com
Dear all,
i am compiling a simple bare-metal binary with
https://www.kernel.org/pub/tools/crosstool/files/bin/i686/4.6.3/i686-gcc-4.6.3-nolibc_m68k-linux.tar.gz
$ make -f makefile.release
/opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc -m5307 -g
-O2 -fno-builtin -I include -c -o obj/boot.o src/boot.S
/opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc -m5307 -g
-O2 -fno-builtin -I include -c -o obj/vt100.o src/vt100.c
/opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc -m5307 -g
-O2 -fno-builtin -I include -c -o obj/timing.o src/timing.c
/opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc -m5307 -g
-O2 -fno-builtin -I include -c -o obj/flash.o src/flash.c
/opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc -m5307 -g
-O2 -fno-builtin -I include -c -o obj/memory.o src/memory.c
/opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc -m5307 -g
-O2 -fno-builtin -I include -c -o obj/main.o src/main.c
/opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-gcc -m5307 -g
-O2 -fno-builtin -I include -c -o obj/serial.o src/serial.c
/opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-ld -T ram.ld -M
-o bin/cf4k.elf obj/boot.o obj/vt100.o obj/timing.o obj/flash.o obj/memory.o
obj/main.o obj/serial.o > bin/cf4k.map
/opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-objcopy -O
binary bin/cf4k.elf bin/cf4k
The resulting opcodes seems not correct for mcf5307 (coldfire).
Wrong code is of course not running on the target board.
See this "meminit" func disass:
Dump of assembler code for function meminit:
0x20000758 <+0>: linkw %fp,#-12
0x2000075c <+4>: moveml %a2-%a4,%sp@
0x20000760 <+8>: movel #262144,address@hidden
0x20000766 <+14>: lea 0x200004fc <delay>,%a3
0x2000076c <+20>: moveal #268435720,%a2
0x20000772 <+26>: moveaw #4,%a4
0x20000776 <+30>: jsr %a3@
0x20000778 <+32>: movew #-32218,%d0
0x2000077c <+36>: movew %d0,0x10000100
0x20000782 <+42>: movel #16711681,%d0
0x20000788 <+48>: movel #13060,%a2@
0x2000078e <+54>: movel %d0,0x1000010c
=> 0x20000794 <+60>: movel #13068,%a2@
0x2000079a <+66>: movel #-1095901459,%a4@
0x200007a0 <+72>: movel #45828,%a2@
0x200007a6 <+78>: pea 0x68a
0x200007aa <+82>: jsr %a3@
0x200007ac <+84>: movel #-1095901459,%a4@
0x200007b2 <+90>: movel #45828,%a2@
0x200007b8 <+96>: movel #262144,address@hidden
0x200007be <+102>: jsr %a3@
0x200007c0 <+104>: movel #-1095901459,%d0
0x200007c6 <+110>: lea %sp@(12),%sp
0x200007ca <+114>: movel #45892,%a2@
0x200007d0 <+120>: movel %d0,0xc00
0x200007d4 <+124>: moveq #4,%d0
0x200007d6 <+126>: swap %d0
0x200007d8 <+128>: .short 0x4cfe <<<<<<<<<<<<<<<
0x200007da <+130>: moveb %d0,%d6 <<<<<<<<<<<<<<<
0x200007dc <+132>: .short 0xfff4 <<<<<<<<<<<<<<<
0x200007de <+134>: unlk %fp
0x200007e0 <+136>: movel %d0,0x10000114
0x200007e6 <+142>: clrl 0x10000110
0x200007ec <+148>: rts
While, with a toolchain from CodeSourcery,
/opt/toolchains/m68k/Sourcery_CodeBench_Lite_for_ColdFire_ELF/bin/m68k-elf-gcc
--version
m68k-elf-gcc (Sourcery CodeBench Lite 2011.09-21) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
i get
=> 0x20000758 <+0>: linkw %fp,#-12
0x2000075c <+4>: moveml %a2-%a4,%sp@
0x20000760 <+8>: movel #262144,address@hidden
0x20000766 <+14>: lea 0x200004f8 <delay>,%a3
0x2000076c <+20>: moveal #268435720,%a2
0x20000772 <+26>: moveaw #4,%a4
0x20000776 <+30>: jsr %a3@
0x20000778 <+32>: movew #-32218,%d0
0x2000077c <+36>: movew %d0,0x10000100
0x20000782 <+42>: movel #16711681,%d0
0x20000788 <+48>: movel #13060,%a2@
0x2000078e <+54>: movel %d0,0x1000010c
0x20000794 <+60>: movel #13068,%a2@
0x2000079a <+66>: movel #-1095901459,%a4@
0x200007a0 <+72>: movel #45828,%a2@
0x200007a6 <+78>: pea 0x68a
0x200007aa <+82>: jsr %a3@
0x200007ac <+84>: movel #-1095901459,%a4@
0x200007b2 <+90>: movel #45828,%a2@
0x200007b8 <+96>: movel #262144,address@hidden
0x200007be <+102>: jsr %a3@
0x200007c0 <+104>: movel #-1095901459,%d0
0x200007c6 <+110>: lea %sp@(12),%sp
0x200007ca <+114>: movel #45892,%a2@
0x200007d0 <+120>: movel %d0,0xc00
0x200007d4 <+124>: moveq #4,%d0
0x200007d6 <+126>: swap %d0
0x200007d8 <+128>: moveml %fp@(-12),%a2-%a4
0x200007de <+134>: unlk %fp
0x200007e0 <+136>: movel %d0,0x10000114
0x200007e6 <+142>: clrl 0x10000110
0x200007ec <+148>: rts
A correct code, that runs on target cpu.
PS: I opened this BT before,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64800
gcc team says the issue seems on the assembler.
Best regards,
Angelo Dureghello
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gas/17877] New: bad opcodes for coldfire m5307,
angelo70 at gmail dot com <=