PATCH: Use .init_arrat/.fini_array if available

H. J. Lu hjl@lucon.org
Sun Mar 20 16:10:00 GMT 2005


On Sun, Mar 20, 2005 at 10:34:58AM -0500, Daniel Jacobowitz wrote:
> On Sat, Mar 19, 2005 at 10:05:48PM -0800, H. J. Lu wrote:
> > > As far as I can tell, this is a conforming implementation of
> > > __attribute__((constructor)); even a desirable one.  Any suggestions on how
> > > to adapt the tests for this implementation?
> > > 
> > 
> > This is the patch for gcc 3.4. It is very similar to Linux/ia64 port,
> > which is in assembly. It works for me. Glibc calls functions in
> > .init_array like main ().  That is what INIT_ARRAY_LIKE_MAIN is used
> > for. Linux developers can take advantage of it. I haven't come up with
> > a better way to check it.
> 
> I'm not following you.  How does this patch relate to the problem I
> described?

Your glibc problem should be resolved in gcc. Otherwise your target
will be different from other glibc targets. Currently only the
Linux/ia64 target uses .init_array. My gcc patch will make any targets
which support .init_array to use it and pass the glibc test. If your
glibc target supports .init_array, you can use crtstuff.c + my patch,
or something similar to crtstuff.c + my patch, to pass the glibc test.

> 
> > 
> > 
> > H.J.
> > ------
> > 2005-03-18  H.J. Lu  <hongjiu.lu@intel.com>
> > 
> > 	* config/linux.h (INIT_ARRAY_LIKE_MAIN): Defined.
> > 
> > 	* crtstuff.c: If HAVE_INITFINI_ARRAY is defined, use
> > 	.init_array/.fini_array sections instead of .init/.fini
> > 	sections.
> 
> How far back does glibc support this?

Sept, 2002.


H.J.



More information about the Gcc-patches mailing list