> > 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

Reply via email to