Hi,

31bit Ada executables segfault when built on a 64bit system with gcc 4.x.

The 31bit libgnat library is installed in /usr/lib. When I build an 31bit 
executable with -m31 using a 64bit gcc executing the result failes with
a segfault in the gnatbind generated adainit function. Further debugging showed
that the problem is caused by the System.Address type beeing 64bits wide in 
adainit. 
adainit calls the SetGlobals function in the 31bit libgnat. One of the 
parameters is
&Restrictions which is passed as System.Address.

The problems appears since the system.ads file got split into a 31bit and a
64bit version.

On gcc 3.4.2 a single system.ads defines:

   Memory_Size  : constant := 2 ** Standard'Address_Size;

   type Address is mod Memory_Size;

and the 31bit executables are working with that.

With gcc 4.x come two versions of system.ads (s390 and s390x) and only the 
64bit version exists in the installation:

   Memory_Size  : constant := 2 ** 64;

I think the problem is not limited to s390. Without beeing able to test it
I would say that x86 should have the same trouble (with -m32 of course).

Returning to a single system.ads as before is not an option here because the
split was done for a good reason:
http://gcc.gnu.org/ml/gcc-patches/2004-04/msg01835.html

I'm afraid this is a fundamental problem with the ada build machinery. On 
multilib targets we need both versions of system.ads and should make gnatbind
to choose.

Could one of the Ada people have a look at this?

Bye,

-Andreas-

Reply via email to