Hi

I am quite new with G++/GCC (I came from MSVC world) and currently
having some really annoying problems with GCC. This is the first one:

I am trying to get equivalent of MSVC's /Oy & /OPT:REF (function-level
linking) with GCC compiler. We have huge project where:
- OS is Linux
- G++ v4.0.3 (afaik)
- ld v2.15
- everything is C/C++ code and compiled/linked with the same options
- everything is linked statically
- one or two static libraries that makes 98% of executable image size
- executable image size is ~45Mb

After digging in google I found that these options fed into GCC chain
should do the trick:
-ffunction-sections
-fdata-sections
-Wl,--gc-sections

And indeed executable size was decreased to ~32Mb. But still it is
wrong -- I have created simple application that just calls empty
function from one of these libraries:
int main()
{
    foo(); // foo's body is empty
}

resulting image size was ~17Mb. If you comment out this call image
size = 5kb.


Any ideas how what is wrong?

Bye.
Sincerely yours, Michael.

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to