Date: Tue, 5 Nov 1996 17:30:09 +0200 (IST) From: Eli Zaretskii To: "Ilya P. Ryzhenkov" Cc: djgpp AT delorie DOT com Subject: Re: What are this symbols ? In-Reply-To: <327FBF6C.6D28@spy.isp.nsc.ru> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 5 Nov 1996, Ilya P. Ryzhenkov wrote: > Who can tell me what are this symbols and where does they > exist : > djgpp_first_dtor > djgpp_last_dtor > end > They are the only symbols left unreferenced after using > ld -r -o program.o *.o l:\djgpp\lib\crt0.o -lc That's because you failed to give the -Tdjgpp.djl option to ld. You should really avoid calling ld directly, since the LIBRARY_PATH and other environment variables are only known to gcc. If you need to pass special options to ld, use the `-Wl,option' or `-Xlinker option' switches to gcc; these are described in the gcc info docs. If you *must* call ld directly, first call gcc to link a trivial program and add a -v switch. This way you will see how does gcc call ld; then use the same switches in your direct call. As for the xxx_ctor and xxx_dtor, these are explained in the DJGPP FAQ list, section 8.13. They exist so that functions declared with the `constructor' and `destructor' attributes (the global constructors and destructors) will be automatically called at program startup and just before termination. > Also can someone say what modules (*.o in libc.a) are used > in program startup sequence ? I know there are crt1* but may be > some other ? Explore the various cross-reference options that the linker accepts (e.g., you can generate a map and look into it) and the -t and -y ld options. You can pass them via gcc with -Wl, like -Wl,y passes -y to the linker. (Btw, if you need to use advanced features of ld, you really should read the ld docs. Type "info ld" from the DOS prompt.) Another possibility is to use nm on the output of the linker and look for symbols which have a capital `T' near them (meaning Text, i.e. code). nm is part of Binutils and is documented in the binutils.inf file (type "info binutils nm" from the DOS prompt).