public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mikpe at it dot uu.se" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/48835] Porting GNAT to GNU/Linux/m68k
Date: Sat, 11 Jun 2011 12:33:00 -0000	[thread overview]
Message-ID: <bug-48835-4-ms3XMwDdzw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-48835-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Mikael Pettersson <mikpe at it dot uu.se> 2011-06-11 12:33:09 UTC ---
Created attachment 24491
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24491
patch fixing m68k function call abi issues in gnat

WRT the the m68k function call ABI issues, I believe there are only a few cases
where gnat does something which breaks m68k:

- __gnat_malloc is defined in Ada to return Address (integer, so in d0), but
it's called from a couple of places via fake "extern" declarations that pretend
it returns void* (pointer, so in a0).  The attached patch fixes the two call
sites affected (in Interfaces.C.Strings and build_call_alloc_dealloc), as well
as the internal fake prototype (init_gigi_decls).
- Source code inspection showed that get_jmpbuf_address probably suffers from
the same issue (mismatching decl and use via wrong intermediate fake prototype)
so I fixed that too.

There are a number of pointer-returning C library routines that are imported
as-is with fake prototypes that declare them as returning Address.  While
wrong, this should work since the ABI returns pointers in both d0 and a0.

With these fixes in place I can bootstrap gnat et al and the resulting binaries
can be executed:

aranym5_21_~/gnatroot/bin/gnat
GNAT 4.4.7 20110419 (prerelease)
Copyright 1996-2008, Free Software Foundation, Inc.

List of available commands

gnat bind               gnatbind
gnat chop               gnatchop
gnat clean              gnatclean
gnat compile            gnatmake -f -u -c
gnat check              gnatcheck
gnat sync               gnatsync
gnat elim               gnatelim
gnat find               gnatfind
gnat krunch             gnatkr
gnat link               gnatlink
gnat list               gnatls
gnat make               gnatmake
gnat metric             gnatmetric
gnat name               gnatname
gnat preprocess         gnatprep
gnat pretty             gnatpp
gnat stack              gnatstack
gnat stub               gnatstub
gnat xref               gnatxref

Commands find, list, metric, pretty, stack, stub and xref accept project file
switches -vPx, -Pprj and -Xnam=val

However, compiling the most trivial Ada program now fails with an assertion:

aranym5_22_cat conftest.adb 
procedure conftest is begin null; end conftest;
aranym5_23_~/gnatroot/bin/gcc -S conftest.adb
+===========================GNAT BUG DETECTED==============================+
| 4.4.7 20110419 (prerelease) (m68k-unknown-linux-gnu) Assert_Failure
einfo.adb:1748|
| Error detected at system.ads:153:5                                       |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.

conftest.adb

compilation abandoned

In case I missed some return value ABI fixups I hacked the m68k backend to
return pointers in a0+d0 as before but always fetch them from d0, but it made
no difference.

The only potential issues I'm aware of now are endianess and alignment
differences between the bootstrap host (i686-linux in my case) and m68k. 
That's because the bootstrap has to run the host's gnatmake a couple of times
to generate the einfo/sinfo/etc thingys, which might not work correctly if the
host and target have different endianess or alignment rules.

Since I've bootstrapped gnat for big-endian ARM from little-endian i686 before,
I don't think endianess is the problem, so I'm leaning towards m68k's unique
alignment rules.


  parent reply	other threads:[~2011-06-11 12:33 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-30 15:47 [Bug ada/48835] New: " tg at mirbsd dot org
2011-04-30 16:25 ` [Bug ada/48835] " mikpe at it dot uu.se
2011-04-30 21:58 ` schwab@linux-m68k.org
2011-04-30 22:16 ` tg at mirbsd dot org
2011-04-30 22:20 ` tg at mirbsd dot org
2011-04-30 22:29 ` tg at mirbsd dot org
2011-05-01  7:58 ` schwab@linux-m68k.org
2011-06-10 20:55 ` tg at mirbsd dot org
2011-06-11 12:33 ` mikpe at it dot uu.se [this message]
2011-06-13 21:16 ` ebotcazou at gcc dot gnu.org
2011-06-14  8:13 ` mikpe at it dot uu.se
2011-06-14  8:44 ` ebotcazou at gcc dot gnu.org
2011-06-14 10:59 ` tg at mirbsd dot org
2011-06-14 11:28 ` ebotcazou at gcc dot gnu.org
2011-06-17 10:03 ` mikpe at it dot uu.se
2011-06-23  8:37 ` mikpe at it dot uu.se
2011-06-29  7:41 ` mikpe at it dot uu.se
2011-07-01  7:54 ` mikpe at it dot uu.se
2011-07-09 10:58 ` mikpe at it dot uu.se
2011-07-11 22:28 ` mikpe at it dot uu.se
2011-07-11 22:52 ` tg at mirbsd dot org
2011-07-12 15:44 ` mikpe at it dot uu.se
2011-07-12 17:06 ` ebotcazou at gcc dot gnu.org
2011-07-14  8:45 ` mikpe at it dot uu.se
2011-07-15 10:13 ` mikpe at it dot uu.se
2011-07-16 13:22 ` mikpe at it dot uu.se
2011-07-16 16:18 ` tg at mirbsd dot de
2011-07-17 10:19 ` mikpe at it dot uu.se
2011-07-19  9:12 ` mikpe at it dot uu.se
2011-09-10 10:15 ` mikpe at it dot uu.se
2011-09-10 13:36 ` tg at mirbsd dot org
2011-09-21  8:22 ` mikpe at it dot uu.se
2011-09-25 19:03 ` mikpe at it dot uu.se
2011-10-12 17:21 ` mikpe at it dot uu.se
2011-10-14  7:54 ` mikpe at it dot uu.se
2011-10-14  7:58 ` mikpe at it dot uu.se
2011-10-14  8:40 ` tg at mirbsd dot org
2011-10-16 13:20 ` rsandifo at gcc dot gnu.org
2011-10-17 16:26 ` mikpe at it dot uu.se
2011-10-17 20:30 ` tg at mirbsd dot org
2011-10-17 22:22 ` ebotcazou at gcc dot gnu.org
2011-11-21 10:11 ` mikpe at it dot uu.se
2011-12-07  9:59 ` mikpe at it dot uu.se
2011-12-07 11:07 ` schwab@linux-m68k.org
2011-12-07 12:04 ` mikpe at it dot uu.se
2011-12-07 12:48 ` schwab@linux-m68k.org
2011-12-07 13:10 ` schwab@linux-m68k.org
2011-12-07 21:13 ` mikpe at it dot uu.se
2011-12-08 10:05 ` mikpe at it dot uu.se
2011-12-08 16:04 ` ebotcazou at gcc dot gnu.org
2011-12-09  9:47 ` mikpe at it dot uu.se
2012-02-11 14:44 ` ebotcazou at gcc dot gnu.org
2012-03-10  0:53 ` [Bug ada/48835] porting GNAT to m68k-linux tg at mirbsd dot org
2012-03-12 22:16 ` mikpe at it dot uu.se
2013-03-20 11:06 ` mikpe at it dot uu.se
2013-03-22 14:30 ` mikpe at it dot uu.se
2014-01-06  7:40 ` ebotcazou at gcc dot gnu.org
2014-03-13 15:45 ` ebotcazou at gcc dot gnu.org
2014-05-02 16:42 ` schwab@linux-m68k.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-48835-4-ms3XMwDdzw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).