bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/18108] New: possible coldfire gas bug on frame pointer


From: angelo70 at gmail dot com
Subject: [Bug gas/18108] New: possible coldfire gas bug on frame pointer
Date: Tue, 10 Mar 2015 22:10:24 +0000

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 <print_size>:
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),address@hidden
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,address@hidden
ffc0f1d6:    2f2e fff4          movel %fp@(-12),address@hidden
ffc0f1da:    2f2e fff0          movel %fp@(-16),address@hidden
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 <print_size>:
ffc0ee2e:    4e56 ffd0          linkw %fp,#-48
ffc0ee32:    48d7 3c7c          moveml %d2-%d6/%a2-%a5,%sp@
ffc0ee36:    2f2d 03d8          movel %a5@(984),address@hidden
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,address@hidden
ffc0ee52:    2f2e 000c          movel %fp@(12),address@hidden
ffc0ee56:    2f2e 0008          movel %fp@(8),address@hidden
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 <print_size+0x56>
ffc0ee7a:    206d 03d0          moveal %a5@(976),%a0
ffc0ee7e:    1430 2800          moveb %a0@(0000000000000000,%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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]