Subject: Re: src/gnu/usr.bin/egcs/common
To: Chris G. Demetriou <>
From: Jason Thorpe <>
List: tech-userlevel
Date: 12/22/1999 10:14:32
On 21 Dec 1999 17:35:45 -0800 (Chris G. Demetriou) wrote:

 > If this is true, it's only true because of (dynamic) linker issues.
 > (some would say "bugs.")
 > if the data definitions of the variables are in the shared library,
 > and nothing uses their fields directly (or their fields can be used
 > in a 'safe' way directly), you should be fine.  Unless there are
 > linker issues that force the size of the data items to be consistent
 > between the program and the shared library.  (i seem to recall that
 > there have been such ... "issues" with the a.out dynamic linker, but,
 > as noted, one might call them bugs.  8-)

I think the issue is e.g. say you have:

	extern struct foo foo_array[5];

...the linker sometimes uses a COPY relocation type, allocating enough
space in the .data section for the object, and copies it there at run-time,
before main() is called.  This is, presumably, because COPY is deemed more
efficient for some objects that are potentially COW.

However, if you have:

	extern struct foo *foo_array;

...then the linker does the "right" thing.

        -- Jason R. Thorpe <>