This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Defining a libgnat.so, libgnarl.so ABI
- From: Arnaud Charlet <charlet at adacore dot com>
- To: Florian Weimer <fw at deneb dot enyo dot de>
- Cc: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>, gcc at gcc dot gnu dot org
- Date: Thu, 25 Feb 2010 08:51:26 +0100
- Subject: Re: Defining a libgnat.so, libgnarl.so ABI
- References: <yddzl2yhdpm.fsf@CeBiTec.Uni-Bielefeld.DE> <87eik9ke6s.fsf@mid.deneb.enyo.de>
> > Since I barely know any Ada, or Ada mangling,
>
> Ada subprogram name mangling depends on the order of declarations in
> the source file. This order is also somewhat constrained by language
> rules. I think this means that defining a stable ABI is rather
> difficult.
Not sure what this particular discussion is about, since there's no notion
of "mangling" in Ada, at least not in the usual C++ sense.
In particular, there's no need to encode the parameter list in symbols
as is apparently needed in C++, and as far as I know, no Ada compiler does
that.
The main "mangling" (in Ada parlance, we talk rather about "encoding")
that is performed by GNAT is to handle packages ("namespace" in C++) and
to differentiate overloaded functions (and there, a simple counter is all
that is needed). There are a few other cases to handle nested procedures,
tasks, protected objects, operators, etc...
For example, consider the following Ada package:
package Pack1 is
procedure Foo;
procedure Foo (I : Integer);
end Pack1;
The corresponding symbols generated by GNAT will be:
pack1__foo
pack1__foo__2
This (relatively small) part of the GNAT ABI BTW is fully documented, see
exp_dbug.ads.
Arno