From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15729 invoked by alias); 14 Jul 2011 08:45:41 -0000 Received: (qmail 15716 invoked by uid 22791); 14 Jul 2011 08:45:39 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Jul 2011 08:45:25 +0000 From: "mikpe at it dot uu.se" To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/48835] Porting GNAT to GNU/Linux/m68k X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ada X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: mikpe at it dot uu.se X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Attachment #24491 is obsolete Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 14 Jul 2011 08:45:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg01066.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48835 Mikael Pettersson changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #24491|0 |1 is obsolete| | --- Comment #23 from Mikael Pettersson 2011-07-14 08:44:51 UTC --- Created attachment 24753 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24753 working patch for gcc-4.5.3 (v4) Here's the current working patch I'm using with gcc-4.5.3 on m68k-linux. As the diffstat shows gcc/ada/gcc-interface/Makefile.in | 28 ++++++ gcc/ada/s-memory.adb | 17 ++++ gcc/ada/s-memory.ads | 1 gcc/ada/system-linux-m68k.ads | 153 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 198 insertions(+), 1 deletion(-) not much is needed beyond the obvious target fragment in Makefile.in and the new system-linux-m68k.ads. The s-memory.ad{b,s} patches work around the __gnat_malloc issue by adding a private Gnat_Malloc wrapper function that returns a proper pointer, and changing the __gnat_malloc export to refer to that function rather than the integer-returning Alloc function. This should be safe though unnecessary on other platforms (initially tested on i686). If the special attribute is implemented, then what it needs to do is to say that a particular integer-typed function (from Ada's perspective) should be treated as returning the equivalent of C's void*, with unchecked conversions inserted in the function's return points and in every caller. In principle at least three functions need this treatment: __gnat_malloc, __gnat_realloc, and system__soft_links__get_jmpbuf_address_soft. However, __gnat_realloc doesn't seem to be used by gnat itself, and ..get_jmpbuf.. doesn't appear to be needed for ZCX EH (I did have to patch get_jmpbuf_decl related code earlier when I still used SJLJ EH). Once my current final verification bootstrap finishes I'll upload the gcc-4.5.3 binaries and start working on gcc-4.6.1 and gcc-4.7.0.