This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR 20766, darwin and constructors
- From: Steven Bosscher <stevenb at suse dot de>
- To: fortran at gcc dot gnu dot org
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>, gcc-patches Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 7 Apr 2005 21:58:28 +0200
- Subject: Re: [PATCH] Fix PR 20766, darwin and constructors
- Organization: SUSE Labs
- References: <d394c05ca9f74899af6a0f39400621ba@physics.uc.edu>
On Thursday 07 April 2005 21:28, Andrew Pinski wrote:
> On Darwin (before 8), constructors are done lazy on the load of
> the module containing the constructor so the initializer for
> libgfortran is not done unless you either call set_args or
> use the provided main which calls set_args.
The GCC manual says:
`constructor'
`destructor'
The `constructor' attribute causes the function to be called
automatically before execution enters `main ()'.
So you're saying this is not true on Darwin?
> The way to fix
> this is just to make libgfortran one module while linking
> and this patch fixes that by adding the extra flag of
> "-single_module".
What a hack. Doesn't this If there is no other way, so be it.
* configure.ac (extra_ldflags_libgfortran): Set for *-darwin* to
"-Wl,-single_module".
* configure: Regenerate.
* Makefile.am (libgfortran_la_LDFLAGS): Add extra_ldflags_libgfortran.
* Makefile.in: Regenerate.
OK.
Gr.
Steven