Ada Language Support in sparc-rtems-gdb

Joel Sherrill <> joel.sherrill at
Fri Sep 24 16:33:48 UTC 2004

Per Dalgas Jakobsen wrote:
>>>Hmm, I have test-builded the 3.4.x series with C and Ada support on a
>>>i386-Linux system, and of 3.4.1 Ada passed the ACATS tests with flying
>>>colors (that goes for 3.4.2 as well - I don't know about the latest 3.4.3
>>>prereleases though).
>>I.e. you probably built a native GNAT using a previously installed very
>>recent GCC.
> I used the gnat-3.14p for Debian to compile these versions.
>>> However I must admit that I have not checked which
>>>tests are actually included/excluded from the tests, but Ada is
> definitely
>>>buildable and runnable.
>>Try cross-building GNAT.
> Yep, that'll be the next *shiver*...
> I think the first I will try is a Cygwin/Linux crosschain (both for i386 - I
> know this is a pretty "prudent" cross, but still...).
>>With GCC versions between 3.0 and ~3.2 this was only possible applying a
>>couple of nasty building tricks.
>>Since some time around gcc-3.2.0 through gcc-3.4.0 (I haven't tried
>>3.4.[1|2|3pre] cross-build gnatlib has been impossible, because GNAT
>>mixes up target and build-host configuration, i.e. in general,
>>cross-building GNAT has been (is?) impossible.
>>However, on some build-hosts cross-building to some targets (in
>>particular cross-building to linux-targets) succeeds by random accident,
>>because, build-host and target resemble sufficiently.
>>For RTEMS this does not apply.
>>Since gcc-3.3.x, cross-building GNAT failed because GNAT's configuration
>>was trying to use the native tools for cross-building. In some
>>situations (e.g. when building for different but similar OSes for same
>>architecture, e.g. i686-cygwin -> i386-rtems), this succeeds, bogusly
>>giving you the impression building succeeds, despite almost everything
>>inside and underneath is broken.
> You are just full of "good" news ;-)
> I guess I will just have to see what turns up...

I have a partially debugged patch for gcc 3.4.x to address the
sparc specific issue.  But programs don't link with my change.

The core problem on the sparc is that gcc/config/sparc/rtems*.h
uses the UNIX sparc files which CPP predefine UNIX.  This in turn
confuses some of the Ada support code.  I have rewritten
the sparc/rtems*.h to define things directly as much as possible
but must have the link stuff not quite right.

In general cross building Ada is a pain because you have to
have a working native Ada compiler of the same vintage.  Sometimes
you can have a slightly older native gnat but as a matter of
habit, I always install the same version I am trying to build
cross.  That makes two dependencies that are not present on
other languages.

On top of that, there is the somewhat less critical problem
that the Ada run-time files are not multilib'ed so really
need to be recompiled for each target.  The C libraries and
other run-time libraries are multilib'ed.

GNAT isn't totally abandoned for RTEMS, it just has its own set of
painful issues.  So it is a lot like going to the dentist for
reparis.  :)

I am happy to dig out the SPARC patch for 3.4 if someone wants to
try to get it working.  The help would be greatly appreciated.

> Any reliable emulators that are able to run under Windows or i386/Linux,
> emulating a "good" cross-target, that you can recommend? It should "simply"
> be able to execute the ACATS, when the time comes.

sis (sparc-rtems-gdb) used to run under cygwin.  I tried it recently
and it didn't look like it was doing right.  I was on an EXTREMELY
lightly configured laptop at the time and suspect it might have been

>>Finally there is the infamous (GNAT-1) dependency of building GNAT
>>(Build GNAT requires to have native GNAT installed which is no older tha
>>the version to be build - 1).
>>I for one have not been able to build Joel's rtems-gnat-toolchains for
>>ages (I am currently using FC2) and therefore have not been able to test
>>any RTEMS/Ada related code in RTEMS sources.
> At least that dependency seems to have been solved - I remember one bug I
> found and solved regarding this issue a couple of months back, but I believe
> many others have been resolved as well.
>>The cause for all this is the GNAT configuration and Makefiles being
>>used in GCC to be fundamentally bugged and broken. Having tried to help
>>the FSF/GNAT maintainers to fix this, had not been the most pleasant
>>experience of my life.
> Hmmm, that does not sound too reassuring :-/
> Any hints or "mine-fields" I should know about?
> Best regards
> Per

Joel Sherrill, Ph.D.             Director of Research & Development
joel at                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985

More information about the users mailing list