Hi all,
[Cc general gcc list for people with ABI-compatibility experience,
and Jakub because he's the one who introduced the scheme currently
used by the library]
The plans for the libgfortran library is to stabilize things from now
on, and keep ABI compatibility. But I have to admit that I, for one,
am very new this field, and even if I understand the concept, the
modi operandi are still not cristal-clear.
The Fortran front-end emits calls to I/O subroutines by creating a
struct containing all information to be passed to the library, as
well as some reserved space (for internal use by the library).
Example of the generated code include:
{
struct __st_parameter_dt dt_parm.0;
dt_parm.0.common.filename = "u.f90";
dt_parm.0.common.line = 1;
dt_parm.0.common.unit = 10;
dt_parm.0.rec = 2;
dt_parm.0.common.flags = 512;
_gfortran_st_write (&dt_parm.0);
{
int4 C.876 = 42;
_gfortran_transfer_integer (&dt_parm.0, &C.876, 4);
}
_gfortran_st_write_done (&dt_parm.0);
where __st_parameter_dt is declared as:
typedef struct st_parameter_dt
{
st_parameter_common common;
GFC_IO_INT rec;
[...lots of other struct members...]
/* Private part of the structure. The compiler just needs
to reserve enough space. */
union
{
struct
{
[... the private stuff ...]
} p;
/* This pad size must be equal to the pad_size declared in
trans-io.c (gfc_build_io_library_fndecls). The above
structure
must be smaller or equal to this array. */
char pad[16 * sizeof (char *) + 32 * sizeof (int)];
} u;
}
st_parameter_dt;
The idea is that common.flags has a bit for every possible member
such as rec, to indicated whether it's present or not. The question
is that we sometimes need to add another struct member (like rec) in
this structure, to implement new features. I think we can add it at
the end, since when code generated by older compilers calls the
library, the flag for that new member is not set, and the struct
member is never accessed.
Now, we also sometimes want to increase the size of the private
stuff, and I don't see how we can do that in a way that keeps ABI
compatibility, because the bits in the private stuff are always used
by the library. So, I am missing something here or is there actually
no way to keep that scheme and have ABI compatibility?
FX