[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug ada/48835] New: Porting GNAT to GNU/Linux/m68k
From:       "tg at mirbsd dot org" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2011-04-30 15:47:24
Message-ID: bug-48835-4 () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48835

           Summary: Porting GNAT to GNU/Linux/m68k
           Product: gcc
           Version: 4.4.6
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: ada
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tg@mirbsd.org


Created attachment 24151
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24151
first draft

Discussion about attempting to port GNAT to GNU/Linux/m68k.

I've come this far:

root@ara5:...mnt/home/tg/Xg/gcc-4.4-4.4.6/b68k/gcc # gdb ./gnat1
GNU gdb (GDB) 7.2-debian
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "m68k-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /mnt/home/tg/Xg/gcc-4.4-4.4.6/b68k/gcc/gnat1...done.
warning: not using untrusted file ".gdbinit"
(gdb) r
Starting program: /mnt/home/tg/Xg/gcc-4.4-4.4.6/b68k/gcc/gnat1
#NO_APP 
        .file   "<stdin>"

Program received signal SIGSEGV, Segmentation fault.
0xc014d428 in memcpy (dstpp=0x8018668a, srcpp=0x80a2688e, len=2149082762) at
memcpy.c:61
61      memcpy.c: No such file or directory.
        in memcpy.c
(gdb) bt
#0  0xc014d428 in memcpy (dstpp=0x8018668a, srcpp=0x80a2688e, len=2149082762)
at memcpy.c:61
#1  0x80137084 in <hostparm___elabs> () at ../../src/gcc/ada/hostparm.ads:54
#2  0x800049cc in adainit () at ada/b_gnat1.c:317
#3  0x80015a3a in gnat_parse_file (set_yydebug=0) at
../../src/gcc/ada/gcc-interface/misc.c:198
#4  0x80459e62 in compile_file (argc=1, argv=0xefe5dc24) at
../../src/gcc/toplev.c:970
#5  do_compile (argc=1, argv=0xefe5dc24) at ../../src/gcc/toplev.c:2197
#6  toplev_main (argc=1, argv=0xefe5dc24) at ../../src/gcc/toplev.c:2229
#7  0xc00fae68 in __libc_start_main (main=0x802a29e4 <main>, argc=1,
ubp_av=0xefe5dc24, 
    init=0x806dadd0 <__libc_csu_init>, fini=0x806dadc8 <__libc_csu_fini>,
rtld_fini=0xc000d320 <_dl_fini>,
    stack_end=0xefe5dc24) at libc-start.c:228
#8  0x80003a6e in _start ()
(gdb) frame 1
#1  0x80137084 in <hostparm___elabs> () at ../../src/gcc/ada/hostparm.ads:54
54         Normalized_CWD : constant String := "." & Direct_Separator;
(gdb) disas
Dump of assembler code for function hostparm___elabs:
   0x80136ef0 <+0>:     linkw %fp,#0
   0x80136ef4 <+4>:     moveml %d2-%d7,%sp@-
   0x80136ef8 <+8>:     movel 0x806db078 <__gnat_vmsp>,%d0
   0x80136efe <+14>:    sne %d0
   0x80136f00 <+16>:    negb %d0
   0x80136f02 <+18>:    moveb %d0,0x807eff68 <hostparm__openvms>
   0x80136f08 <+24>:    moveb 0x807ab130 <__gnat_dir_separator>,%d2
   0x80136f0e <+30>:    movel #-2140172272,%d0
   0x80136f14 <+36>:    movel #-2140172268,%d1
   0x80136f1a <+42>:    andil #255,%d2
   0x80136f20 <+48>:    movel %d2,%sp@-
   0x80136f22 <+50>:    movel %d1,%sp@-
   0x80136f24 <+52>:    movel %d0,%sp@-
   0x80136f26 <+54>:    jsr 0x80187a8a <system__string_ops__str_concat_sc>
[…]

See how %d0 and %d1 (arguments to System.String_Ops.Str_Concat) have immense
sizes. I don't know the Ada calling conventions though, and three things are
pushed, yet "." is a one-byte string, and Direct_Separator is only a char.
This matches the "len" argument to memcpy.

(gdb) info r
d0             0x1      1
d1             0xf      15
d2             0x8018668a       -2145884534
d3             0xf      15
d4             0x1c     28
d5             0x1      1
d6             0x1      1
d7             0x1      1
a0             0x8018668a       0x8018668a
a1             0x80a2688f       0x80a2688f
a2             0x0      0x0
a3             0x802f3094       0x802f3094
a4             0x8000319c       0x8000319c
a5             0xc0202000       0xc0202000
fp             0xefe5dadc       0xefe5dadc
sp             0xefe5dab4       0xefe5dab4
ps             0x300    [ I0 I1 ]
pc             0x80137084       0x80137084 <<hostparm___elabs>+404>
fpcontrol      0x0      0
fpstatus       0x0      0
fpiaddr        0x0      0

I'm attaching my current patch (I have copyright assignments standing),
although the result is currently the same with the patch not applied.

My baseline is Debian gcc-4.4 (4.4.6-2), since that contains all needed
backports for working C, C++ and GCJ on m68k.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic