This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR 20766, darwin and constructors


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]