On Mon, Nov 24, 2003 at 08:44:44AM -0600, Van Eps, Nathan D. (James Tower) wrote: > That is weird. A compiler should generate the same code whether it is > optimized or unoptimized. It would be interesting to hear an > explanation from the gcc folk as to what causes this.
I think it had more to do with the *library* moreso than the compiler itself. For example, in the C language, all of your standard functions (fopen, strlen, malloc, etc) are part of the libc library. If an application makes a lot of calls to libc functions, different compilations of the libc library will probably result in different performance characteristics for the application. To put it another way, if you recompile (the same version of) a library, you don't have to recompile the applications that use it. In my case, my application makes heavy use of the C++ Standard Template Library (STL). The STL is built when I emerge (read: compile) gcc. (Note that libc is *not* built with gcc; it's part of it's own package, sys-libs/glibc.) Just a tip for anyone who may not be aware of this: it's easy to find out what libraries a program uses and what package those libraries belong to using ldd and qpkg: ldd <program> Will list all the libraries that <program> references. My application, for example, shows the following: ldd a.out libstdc++.so.5 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/libstdc++.so.5 (0x4001f000) libm.so.6 => /lib/libm.so.6 (0x400ce000) libgcc_s.so.1 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/libgcc_s.so.1 (0x400f0000) libc.so.6 => /lib/libc.so.6 (0x400f9000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) >From there you can use "qpkg -f <file>" to tell you what package created a library (or any file for that matter). My example, continued: qpkg -f /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/libstdc++.so.5 sys-devel/gcc * I hope that doesn't add any confusion :) Matt -- [EMAIL PROTECTED] mailing list
