On Fri, 8 Feb 2002, Matt Schalit wrote: > "Michael D. Schleif" wrote: > > > > Is there a difference between these, especially regarding libraries? > > > > ld -s > > > > strip -s > > > I'm sort of ignorant of the terminology, but I thought > that strip was for the executable ELF files, and that > ld -s would strip the ouput of the ld command, which > is a shared library. Dave? Anyone?
Some things I think I understand (in no particular order) are... ld is the gnu linker. binary executables are merged object files. To be executed, all of the unresolved symbols (e.g. printf) in a merged binary object must be resolved. (The right address for printf has to be stuffed into the object code where placeholders were put during compilation because "printf" is not typically in the .c file being compiled... it is in a library.) shared libraries are merged object files with symbols that can be referenced externally. "executables" may be linked as they are loaded with shared libraries that the system has been configured to use (ldconfig). They are usually statically linked to eliminate most of the unresolved symbols and insert housekeeping startup code, leaving only references to shared library symbols unresolved until the executable is loaded into memory. One use for a linker is to merge object files into shared libraries, and resolve the internal references between them. Another use for a linker is to merge object files into executables and resolve internal references between them. The main difference between these two uses is that the executable has a designated entry point at which execution may begin. There are two major types of "superflous" information that can be stripped out of an object file: extern symbols and source debug information. The former information must never be removed from a shared library, but both types can be removed from an excutable. AFAIK, "ld -s" and "strip -s" should have the same effect, but if you omit the "-s" when you link (or compile/link, as with gcc) then you can debug it before you strip it for shipping. An interesting read is http://www-106.ibm.com/developerworks/library/l-shobj/ but I think a better explanation of how this works under the hood ought to exist somewhere. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<[EMAIL PROTECTED]> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...2k --------------------------------------------------------------------------- _______________________________________________ Leaf-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/leaf-user
