Make the Ada programming language available on GNU/Hurd in its GCC GNAT implementation, and enable Hurd-specific features.

There is a FOSS Factory bounty (p259) on this task.


Part I

First, make the language functional, have its test suite pass without errors.

Original GSoC Task Description

An initial port of the GNU Ada Translator (GNAT) is available for the Hurd.

The goal of this project is to continue improving and polishing that port and getting it integrated in the upstream GCC repository. It requires implementing some explicitly system-specific stuff in GNAT (mostly in its runtime libraries), and for that also address a number of issues in Hurd and other libraries. Knowledge of Ada is a must; some Hurd knowledge will have to be acquired while working on the project.

Designing and implementing language bindings is a follow-up project.

Possible mentors: Samuel Thibault (youpi), Thomas Schwinge (tschwinge).

Exercise: Fix one of the known issues of GNAT on the Hurd.


Open Issue page. Entry in the GCC wiki.

Posted 2009-03-21 23:19:19 CET

Debian GCC

There has a patch been added for GNU/kFreeBSD: bfe081336914729fc0180c07ab4afa41965100f2, `git-svn-id: svn://svn.debian.org/gcccvs/branches/sid@5638 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca'

IRC, freenode, #hurd, 2012-07-17

<gnu_srs> I've found the remaining problem with gnat backtrace for Hurd!
  Related to the stack frame.
<gnu_srs> This version does not work: one relying on static assumptions
  about the frame layout
<gnu_srs> Causing segfaults.
<gnu_srs> Any interest to create a test case out of that piece of code,
  taken from gcc/ada/tracebak.c?
<braunr> gnu_srs: sure

IRC, freenode, #hurd, 2012-07-18

<braunr> "Digging further revealed that the GNU/Hurd stack frame does not
  seem to
<braunr> be static enough to define USE_GENERIC_UNWINDER in
  gcc/ada/tracebak.c.
<braunr> "
<braunr> what do you mean by a "stack frame does not seem to be static
  enough" ?
<gnu_srs> I can qoute from the source file if you want. Otherwise look at
  the code yourself: gcc/ada/tracebak,c
<gnu_srs> I mean that something is wrong with the stack frame for
  Hurd. This is the code I wanted to use as a test case for the stack.
<gnu_srs> Remember?
<braunr> more or less
<braunr> ah, "static assumptions"
<braunr> all right, i don't think anything is "wrong" with stack frames
<braunr> but if you use a recent version of gcc, as indicated in the code,
  -fomit-frame-pointer is enabled by default
<braunr> so your stack frame won't look like it used to be without the
  option
<braunr> hence the need for USE_GCC_UNWINDER
<braunr> http://en.wikipedia.org/wiki/Call_stack explains this very well
<gnu_srs> However, kfreebsd does not seem to need USE_GCC_UNWINDER, how
  come?
<braunr> i guess they don't omit the frame pointer
<braunr> your fix is good btw
<gnu_srs> thanks

IRC, freenode, #hurd, 2012-07-19

<gnu_srs> tschwinge: The bug in #681998 should go upstream. Applied in
  Debian already. Hopefully this is the last patch needed for the port of
  GNAT to Hurd.

Svante's patch

A basic port has been done by Svante, Debian bug #668425, Debian bug #681998, id:"1333104917.2962.439.camel@s1499.it.kth.se", but there's still lots of work remaining. The port is not yet upstream: the maintainer raised some concerns that I have not yet found the time to follow up on, id:"1339857758-5032-1-git-send-email-thomas@codesourcery.com". While the test results of the GCC/GNAT testsuite don't look bad (but there are a few unresolved issues, and the testsuite appears to be a rather small one), I don't know if the port has yet seen any real-world usage, such as using it for any bigger Ada code bases, or any Ada testsuites.

getcontext/makecontext/setcontext/swapcontext usage analysis

In context of tls-threadvar. Looking at GCC trunk commit f6568ea476aa52a6e23c6db43b3e240cde55783a (2013-04-26).

gcc/ada/init.c:  sigaltstack (&stack, NULL);
gcc/ada/init.c:      sigaltstack (&stack, NULL);
gcc/ada/init.c:  sigaltstack (&stack, NULL);
gcc/ada/s-osinte-aix.ads:   function sigaltstack
gcc/ada/s-osinte-aix.ads:   pragma Import (C, sigaltstack, "sigaltstack");
gcc/ada/s-osinte-android.ads:   function sigaltstack
gcc/ada/s-osinte-android.ads:   pragma Import (C, sigaltstack, "sigaltstack");
gcc/ada/s-osinte-darwin.ads:   function sigaltstack
gcc/ada/s-osinte-darwin.ads:   pragma Import (C, sigaltstack, "sigaltstack");
gcc/ada/s-osinte-freebsd.ads:   function sigaltstack
gcc/ada/s-osinte-freebsd.ads:   pragma Import (C, sigaltstack, "sigaltstack");
gcc/ada/s-osinte-hpux.ads:   function sigaltstack
gcc/ada/s-osinte-hpux.ads:   pragma Import (C, sigaltstack, "sigaltstack");
gcc/ada/s-osinte-kfreebsd-gnu.ads:   function sigaltstack
gcc/ada/s-osinte-kfreebsd-gnu.ads:   pragma Import (C, sigaltstack, "sigaltstack");
gcc/ada/s-osinte-linux.ads:   function sigaltstack
gcc/ada/s-osinte-linux.ads:   pragma Import (C, sigaltstack, "sigaltstack");
gcc/ada/s-osinte-rtems.adb:   -- sigaltstack --
gcc/ada/s-osinte-rtems.adb:   function sigaltstack
gcc/ada/s-osinte-rtems.adb:   end sigaltstack;
gcc/ada/s-osinte-rtems.ads:   function sigaltstack
gcc/ada/s-osinte-solaris-posix.ads:   function sigaltstack
gcc/ada/s-osinte-solaris-posix.ads:   pragma Import (C, sigaltstack, "sigaltstack");
gcc/ada/s-taprop-linux.adb:            Result := sigaltstack (Stack'Access, null);
gcc/ada/s-taprop-posix.adb:            Result := sigaltstack (Stack'Access, null);
gcc/ada/init.c:  stack.ss_sp = __gnat_alternate_stack;
gcc/ada/init.c:      stack.ss_sp = __gnat_alternate_stack;
gcc/ada/init.c:  stack.ss_sp = __gnat_alternate_stack;
gcc/ada/s-osinte-aix.ads:      ss_sp    : System.Address;
gcc/ada/s-osinte-android.ads:      ss_sp    : System.Address;
gcc/ada/s-osinte-darwin.ads:      ss_sp    : System.Address;
gcc/ada/s-osinte-darwin.ads:      uc_stack    : stack_t;          --  Stack Used By This Context
gcc/ada/s-osinte-freebsd.ads:      ss_sp    : System.Address;
gcc/ada/s-osinte-hpux.ads:      ss_sp    : System.Address;
gcc/ada/s-osinte-kfreebsd-gnu.ads:      ss_sp    : System.Address;
gcc/ada/s-osinte-linux.ads:      ss_sp    : System.Address;
gcc/ada/s-osinte-rtems.ads:      ss_sp    : System.Address;
gcc/ada/s-osinte-solaris-posix.ads:      ss_sp    : System.Address;
gcc/ada/s-osinte-solaris.ads:      ss_sp        : System.Address;
gcc/ada/s-osinte-solaris.ads:      uc_stack     : record_type_2;
gcc/ada/s-taprop-linux.adb:            Stack.ss_sp    := Self_ID.Common.Task_Alternate_Stack;
gcc/ada/s-taprop-posix.adb:            Stack.ss_sp    := Self_ID.Common.Task_Alternate_Stack;

Part II

Next, Hurd-specific features can be added. Add an interface to the language/environment for being able to do RPC calls, in order to program translators natively in Ada.

Original GSoC Task Description

The main idea of the Hurd design is giving users the ability to easily modify/extend the system's functionality (extensible system). This is done by creating filesystem translators and other kinds of Hurd servers.

However, in practice this is not as easy as it should, because creating translators and other servers is quite involved -- the interfaces for doing that are not exactly simple, and available only for C programs. Being able to easily create simple translators in RAD languages is highly desirable, to really be able to reap the advantages of the Hurd architecture.

Originally Lisp was meant to be the second system language besides C in the GNU system; but that doesn't mean we are bound to Lisp. Bindings for any popular high-level language, that helps quickly creating simple programs, are highly welcome.

Several approaches are possible when creating such bindings. One way is simply to provide wrappers to all the available C libraries (libtrivfs, libnetfs etc.). While this is easy (it requires relatively little consideration), it may not be the optimal solution. It is preferable to hook in at a lower level, thus being able to create interfaces that are specially adapted to make good use of the features available in the respective language.

These more specialized bindings could hook in at some of the lower level library interfaces (libports, glibc, etc.); use the MIG-provided RPC stubs directly; or even create native stubs directly from the interface definitions. The lisp bindings created by Flavio Cruz as his 2008 GSoC project mostly use the latter approach, and can serve as a good example. In his 2011 GSoC project, Jérémie Koenig designed and began implementing an object-oriented interface; see his Java status page for details.

The task is to create easy to use Hurd bindings for a language of the student's choice, and some example servers to prove that it works well in practice. This project will require gaining a very good understanding of the various Hurd interfaces. Skills in designing nice programming interfaces are a must.

Anatoly A. Kazantsev has started working on Python bindings last year -- if Python is your language of choice, you probably should take his work and complete it.

There was also some previous work on Perl bindings, which might serve as a reference if you want to work on Perl.

Possible mentors: Anatoly A. Kazantsev (anatoly) for Python

Discussion

Java

IRC, freenode, #hurd, 2013-12-19

<antrik_> teythoon_: I don't think wrapping libtrivfs etc. for guile
  bindings is really desirable... for the lisp bindings, we agreed that
  it's better to hook in at a lower level, and build more lispish
  abstractions
<antrik> trivfs is a C framework; it probably doesn't map very well to
  other languages -- especially non-imperative ones...
<antrik> (it is arguable whether trivfs is really a good abstraction even
  for C... but that's another discussion :-) )
<antrik> ArneBab: same for Python bindings. when I suggested ignoring
  libtrivfs etc., working around the pthread problem was just a side effect
  -- the real goal has always been nicer abstraction
<anatoly> antrik: agree with you
<anatoly> antrik: about nicer abstractions
<teythoon_> antrik: I agree too, but wrapping libtrivfs is much easier
<teythoon_> otherwise, one needs to reimplement lots of stuff to get some
  basic functionality
<teythoon_> like a mig that emits your language
<braunr> i agree with antrik too
<braunr> yes, the best would be mig handling multiple languages

open issue mig.

<antrik> teythoon_: not exactly. for dynamic languages, code generation is
  silly. just handle the marshalling on the fly. that's what the Lisp
  bindings are doing (AFAIK)
<teythoon> antrik: ok, but you'd still need to parse the rpc definitions,
  no?
<antrik> teythoon: yeah, you still need to parse the .defs -- unless we add
  reflection to RPC interfaces...
<antrik> err, I mean introspection
Posted 2009-03-05 19:20:56 CET Tags: