"Dave Korn" <[EMAIL PROTECTED]> writes:

>   CONSTRUCTORS is only valid for formats such as ECOFF and XCOFF.  Read the
> bit in the ld manual more closely:
> 
> -----------------------------------------------
> `CONSTRUCTORS'
>      [ ... ] When linking object file formats which do not support
>      arbitrary sections, such as ECOFF and XCOFF, the linker will
>      automatically recognize C++ global constructors and destructors by
>      name.  For these object file formats, the `CONSTRUCTORS' command
>      tells the linker to place constructor information in the output
>      section where the `CONSTRUCTORS' command appears.  The
>      `CONSTRUCTORS' command is ignored for other object file formats.
> -----------------------------------------------
> 
>   For a.out format, which doesn't have named sections for .ctors and .dtors,
> I believe you will need to use the 'collect2' wrapper around ld to generate
> and compile a .C file containing source code to generate the arrays
> __CTOR_LIST__ and __DTOR_LIST__.

You are misreading the CONSTRUCTORS documentation.  The a.out object
file format is covered under "object file formats which do not support
arbitrary sections", and the CONSTRUCTORS command is valid for a.out.
We don't bother to mention a.out in the documentation because nobody
uses it these days.  Technically, in a.out, CONSTRUCTORS tells the
linker where to put constructed sets.  See ld/ldctor.c.

Ian

Reply via email to