----Original Message---- >From: Ian Lance Taylor >Sent: 05 May 2005 16:38
> "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. Heh, it was in fact the bit that I snipped that made the bit that I quoted misleading: `CONSTRUCTORS' When linking using the a.out object file format, the linker uses an unusual set construct to support C++ global constructors and destructors. When linking object file formats which do not support arbitrary sections, such as ECOFF and XCOFF, the linker will [...] The seeming contrast between "When linking using the a.out format ... " and "When linking object file formats which do not support arbitrary sections, such as [two things that are not a.out] ..." mislead me, along with thinking that the "For these object file formats ..." only referred one sentence back, not two. The whole passage has too many ambigouous referents! Sorry for the misdirection Satendra; but in any case, the whole thing about checking whether collect2 is getting properly involved in the process remains the key to finding your problem. cheers, DaveK -- Can't think of a witty .sigline today....