[Bug gas/17877] New: bad opcodes for coldfire m5307
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: 0x2758 <+0>: linkw %fp,#-12 0x275c <+4>: moveml %a2-%a4,%sp@ 0x2760 <+8>: movel #262144,%sp@- 0x2766 <+14>:lea 0x24fc ,%a3 0x276c <+20>:moveal #268435720,%a2 0x2772 <+26>:moveaw #4,%a4 0x2776 <+30>:jsr %a3@ 0x2778 <+32>:movew #-32218,%d0 0x277c <+36>:movew %d0,0x1100 0x2782 <+42>:movel #16711681,%d0 0x2788 <+48>:movel #13060,%a2@ 0x278e <+54>:movel %d0,0x110c => 0x2794 <+60>:movel #13068,%a2@ 0x279a <+66>:movel #-1095901459,%a4@ 0x27a0 <+72>:movel #45828,%a2@ 0x27a6 <+78>:pea 0x68a 0x27aa <+82>:jsr %a3@ 0x27ac <+84>:movel #-1095901459,%a4@ 0x27b2 <+90>:movel #45828,%a2@ 0x27b8 <+96>:movel #262144,%sp@- 0x27be <+102>: jsr %a3@ 0x27c0 <+104>: movel #-1095901459,%d0 0x27c6 <+110>: lea %sp@(12),%sp 0x27ca <+114>: movel #45892,%a2@ 0x27d0 <+120>: movel %d0,0xc00 0x27d4 <+124>: moveq #4,%d0 0x27d6 <+126>: swap %d0 0x27d8 <+128>: .short 0x4cfe <<<<<<<<<<<<<<< 0x27da <+130>: moveb %d0,%d6 <<<<<<<<<<<<<<< 0x27dc <+132>: .short 0xfff4 <<<<<<<<<<<<<<< 0x27de <+134>: unlk %fp 0x27e0 <+136>: movel %d0,0x1114 0x27e6 <+142>: clrl 0x1110 0x27ec <+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 => 0x2758 <+0>: linkw %fp,#-12 0x275c <+4>: moveml %a2-%a4,%sp@ 0x2760 <+8>: movel #262144,%sp@- 0x2766 <+14>:lea 0x24f8 ,%a3 0x276c <+20>:moveal #268435720,%a2 0x2772 <+26>:moveaw #4,%a4 0x2776 <+30>:jsr %a3@ 0x2778 <+32>:movew #-32218,%d0 0x277c <+36>:movew %d0,0x1100 0x2782 <+42>:movel #16711681,%d0 0x2788 <+48>:movel #13060,%a2@ 0x278e <+54>:movel %d0,0x110c 0x2794 <+60>:movel #13068,%a2@ 0x279a <+66>:movel #-1095901459,%a4@ 0x27a0 <+72>:movel #45828,%a2@ 0x27a6 <+78>:pea 0x68a 0x
[Bug gas/17877] bad opcodes for coldfire m5307
https://sourceware.org/bugzilla/show_bug.cgi?id=17877 angelo changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED |--- --- Comment #2 from angelo --- or probably broken from that fix. with /opt/toolchains/m68k/gcc-4.6.3-nolibc/m68k-linux/bin/m68k-linux-as -v GNU assembler version 2.21.53 (m68k-elf) using BFD version (Sourcery CodeBench Lite 2011.09-21) 2.21.53.20110905 I have working code for mcf5307 cpu. With 2.22 and 2.24 binary hangs. I can test any code here con coldfire mcf5307 if you send me some binary. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/17877] bad opcodes for coldfire m5307
https://sourceware.org/bugzilla/show_bug.cgi?id=17877 angelo changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --- Comment #4 from angelo --- Thanks, this bug is fixed at least at 2.24 i am testing now. I am experinecing a different issue on coldfire actualy. Will open eventually another BT. Thanks. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/18108] New: possible coldfire gas bug on frame pointer
https://sourceware.org/bugzilla/show_bug.cgi?id=18108 Bug ID: 18108 Summary: possible coldfire gas bug on frame pointer Product: binutils Version: 2.24 Status: NEW Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: angelo70 at gmail dot com I am compiling the same C code from a 32bit host m68k toolchain based on binutils 2.21 and another, with a 64bit host toolchain based on binutils 2.24. Taget is mcf5307. The code produced from 2,24 hangs on the target. The code hanges exactly on a 64bit shift operatiion (see "test = size >> d;"). On this C fuction: void print_size(uint64_t size, const char *s) { unsigned long m = 0, n; uint64_t f; static const char names[] = {'E', 'P', 'T', 'G', 'M', 'K'}; unsigned long d = 10 * ARRAY_SIZE(names); char c = 0; unsigned int i; volatile uint64_t test; printf("print_size(): entering\r\n"); for (i = 0; i < ARRAY_SIZE(names); i++, d -= 10) { asm volatile("nop"); test = size >> d; asm volatile("nop"); if (test) { c = names[i]; break; } } . toolchain based on binutils 2.21 produce this mcf5307 working binary (see code between 2 nop): ffc0f19c : ffc0f19c:4e56 ffc0 linkw %fp,#-64 ffc0f1a0:206d 0008 moveal %a5@(8),%a0 ffc0f1a4:48d7 3c7c moveml %d2-%d6/%a2-%a5,%sp@ ffc0f1a8:242e 0008 movel %fp@(8),%d2 ffc0f1ac:262e 000c movel %fp@(12),%d3 ffc0f1b0:2f2d 03cc movel %a5@(972),%sp@- ffc0f1b4:347c 003c moveaw #60,%a2 ffc0f1b8:2d42 fff0 movel %d2,%fp@(-16) ffc0f1bc:2d43 fff4 movel %d3,%fp@(-12) ffc0f1c0:262e 0010 movel %fp@(16),%d3 ffc0f1c4:4282 clrl %d2 ffc0f1c6:2d43 ffec movel %d3,%fp@(-20) ffc0f1ca:4e90 jsr %a0@ ffc0f1cc:588f addql #4,%sp ffc0f1ce:266d 0514 moveal %a5@(1300),%a3 ffc0f1d2:4e71 nop ffc0f1d4:2f0a movel %a2,%sp@- ffc0f1d6:2f2e fff4 movel %fp@(-12),%sp@- ffc0f1da:2f2e fff0 movel %fp@(-16),%sp@- ffc0f1de:4e93 jsr %a3@ ffc0f1e0:2040 moveal %d0,%a0 ffc0f1e2:2241 moveal %d1,%a1 ffc0f1e4:4fef 000c lea %sp@(12),%sp ffc0f1e8:2d48 fff8 movel %a0,%fp@(-8) ffc0f1ec:2d49 fffc movel %a1,%fp@(-4) ffc0f1f0:4e71 nop ffc0f1f2:202e fff8 movel %fp@(-8),%d0 ffc0f1f6:222e fffc movel %fp@(-4),%d1 ffc0f1fa:2800 movel %d0,%d4 ffc0f1fc:8881 orl %d1,%d4 .. Binutils 2.24 (on 64bit machine) produce binary that hangs on mcf5307 between the 2 nop: ffc0ee2e : ffc0ee2e:4e56 ffd0 linkw %fp,#-48 ffc0ee32:48d7 3c7c moveml %d2-%d6/%a2-%a5,%sp@ ffc0ee36:2f2d 03d8 movel %a5@(984),%sp@- ffc0ee3a:4282 clrl %d2 ffc0ee3c:347c 003c moveaw #60,%a2 ffc0ee40:266d 0008 moveal %a5@(8),%a3 ffc0ee44:4e93 jsr %a3@ ffc0ee46:588f addql #4,%sp ffc0ee48:262d 051c movel %a5@(1308),%d3 ffc0ee4c:4e71 nop ffc0ee4e:2043 moveal %d3,%a0 ffc0ee50:2f0a movel %a2,%sp@- ffc0ee52:2f2e 000c movel %fp@(12),%sp@- ffc0ee56:2f2e 0008 movel %fp@(8),%sp@- ffc0ee5a:4e90 jsr %a0@ ffc0ee5c:4fef 000c lea %sp@(12),%sp ffc0ee60:2d40 fff8 movel %d0,%fp@(-8) ffc0ee64:2d41 fffc movel %d1,%fp@(-4) ffc0ee68:4e71 nop ffc0ee6a:2843 moveal %d3,%a4 ffc0ee6c:202e fff8 movel %fp@(-8),%d0 ffc0ee70:222e fffc movel %fp@(-4),%d1 ffc0ee74:2800 movel %d0,%d4 ffc0ee76:8881 orl %d1,%d4 ffc0ee78:670a beqs ffc0ee84 ffc0ee7a:206d 03d0 moveal %a5@(976),%a0 ffc0ee7e:1430 2800 moveb %a0@(,%d2:l),%d2 Seems strange to me the code @ ffc0ee52 and ffc0ee56, becouse of the positive %fp offset. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/18108] possible coldfire gas bug on frame pointer
https://sourceware.org/bugzilla/show_bug.cgi?id=18108 --- Comment #2 from angelo --- Ok, i attach the file. See "print_size" function and look inside the 2 "nop" i added as asm volatile ("nop") into C code. The code in the target mcf5307 hangs there, in the 64 bit shift. Seems that code is taken from libgcc. Regards, Angelo -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/18108] possible coldfire gas bug on frame pointer
https://sourceware.org/bugzilla/show_bug.cgi?id=18108 --- Comment #3 from angelo --- Created attachment 8187 --> https://sourceware.org/bugzilla/attachment.cgi?id=8187&action=edit file with issue -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/18108] possible coldfire gas bug on frame pointer
https://sourceware.org/bugzilla/show_bug.cgi?id=18108 --- Comment #5 from angelo --- Hi Andreas, issue i have is that the target cpu mcf5307 hangs between lines 94 and 112 of the asm code attached, i put 2 "nop" before and after this part with the issue, just to help localizing it. I generated as requested: m68k-linux-gcc -m5307 -g -O2 -fno-builtin -I include -S -o display_options.s display_options.c The code in that range is anyway included from libgcc.a, since it is a 64bit shift. If you don't see anything strange, just close the bug, i will investigate further to understand. Regards Angelo -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils