Subject: Re: TenDRA compiler __RENAME and more
To: =?us-ascii?Q?=3D=3Fiso-8859-1=3FQ=3FSebasti=3DE1n=5FJ?= =?us-ascii?Q?=2E?= _D=B4Alessandro?= <email@example.com>
From: Bill Studenmund <firstname.lastname@example.org>
Date: 08/04/2004 11:02:59
Content-Type: text/plain; charset=us-ascii
On Sun, Aug 01, 2004 at 09:39:13PM -0300, =3D?iso-8859-1?Q?Sebasti=3DE1n_J.=
> The question is: why is required the __RENAME
> definition on the system?, returning to the example, why would I define i=
> program a function with 2 names (2 names before compiling)? Is this becau=
> the function was named diferent among other systems and this way someone =
> compile the program on all them?. I?m sorry if it obvious, I just don?t k=
> why __RENAME was created.
It's a way to change a function's prototype when you have shared=20
dynamic libraries without having to bump the library's major number.
The problem is that once a symbol (routine) is added to such a library,=20
you can compile a program to use it. Once you do that, you can't change=20
the symbol without breaking your program.
Note that the above definition of what a symbol is includes the layout of=
structure(s) used. So the layout of a struct foo either passed to a=20
subroutine or exposed as a symbol is within the set of stuff you can't=20
So what do we do when we want to change the layout of a structure or=20
otherwise change a prototype? Like we want to add stuff to the mount=20
arguements or change the data returned by stat(2)?
For extensive reasons, bumping the major number of libc is not an option.=
So what do we do? We use RENAME(). We change struct stat and add a=20
__RENAME() to the stat(2) prototype to point to a prototype that will=20
always use this structure. If we ever change the structure (struct stat in=
this example), we change the contents of the __RENAME() macro.
There also is a hook in the compilation of libc where we turn the=20
__RENAME() macro off, so that we can compile the old, pointed-to routines.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
-----END PGP SIGNATURE-----