|
|
Home » Developing U++ » U++ Developers corner » GCC compilation options
GCC compilation options [message #24148] |
Tue, 29 December 2009 11:46 |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
Hi,
I've noticed that u++ doesn't force gcc to remove unused functions nor data, so binaries are usually bigger (comparing to MS compiler). So, my proposition is to add:
1. -ffunction-sections and -fdata-sections to compilation options for gcc
2. -Wl,--gc-sections to linker options
I know that "-ffunction-sections" is already used, but without --gc-sections it is useless.
|
|
|
|
|
Re: GCC compilation options [message #24167 is a reply to message #24156] |
Wed, 30 December 2009 18:53 |
|
mirek
Messages: 13984 Registered: November 2005
|
Ultimate Member |
|
|
Zbych wrote on Tue, 29 December 2009 15:50 |
luzr wrote on Tue, 29 December 2009 17:36 | At least in Linux and BSD, it did not seem to result in any difference in binary size.
|
You will not see huge size reduction of big applications, because such applications use a lot of functions from u++, so there is almost nothing to remove.
The biggest difference is in small applications.
I've made simple MT tcp/ip server. Without --gc-sections size of application was ~1,5MB. After I added --gc-sections size decreased to 0,4MB. For me it is a huge difference.
Compilation results for some applications from u++ package:
Application | size [B] without dead code removal | size [B] with dead code removal | Size reduction
------------------------------------------------------------------------------------------------|----------------------
ide | 5809896 | 5148244 | 11,4%
Gui01 | 1760072 | 1090132 | 38%
HomeBudget | 3641508 | 2037696 | 44%
gcc version 4.4.1, all applications optimized for size.
|
Well, things definitely improved! This is good news.
Now I only have to decide whether to hardcode it or rather put another "Link options" field into Build methods and set it as default...
|
|
|
|
|
|
|
|
|
Re: GCC compilation options [message #24242 is a reply to message #24148] |
Thu, 07 January 2010 03:01 |
Novo
Messages: 1361 Registered: December 2006
|
Ultimate Contributor |
|
|
I checked numbers on Linux x86_64 GCC 4.4.1
TheIDE: 6358272B 5495408B reduction: 14%
My own simple CGI app: 2198160B 798944B reduction: 64%
I definitely like these new options!
Thanks a lot for pointing out!
Some time ago I read about symbol visibility options, which also helped significantly reduce size of resulting executable (which was using boost libraries). Has somebody tried visibility options with UPP?
Regards,
Novo
|
|
|
Goto Forum:
Current Time: Tue Jun 04 00:00:29 CEST 2024
Total time taken to generate the page: 0.02413 seconds
|
|
|