Skip to content

Instantly share code, notes, and snippets.

@shundhammer
Last active December 9, 2020 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shundhammer/808447ac2a4d58a7f4e072d92d1dd356 to your computer and use it in GitHub Desktop.
Save shundhammer/808447ac2a4d58a7f4e072d92d1dd356 to your computer and use it in GitHub Desktop.
Libyui Compiler Options

Building libyui with the new CMake Build Environment

Compiler options can now easily be changed in the toplevel CMakeLists.txt:

add_compile_options( "-Wall" )
add_compile_options( "-O3 -g" )

No Compiler Options (GCC Defaults):

% size libyui.so.14.0.0
   text	   data	    bss	    dec	    hex	filename
1792378	  55352	   3216	1850946	 1c3e42	libyui.so.14.0.0

% ls -lh libyui.so.14.0.0
-rwxr-xr-x 1 sh users 2.4M Dez  9 10:07 libyui.so.14.0.0

stripped: 1.8 MB

With -O3:

% size libyui.so.14.0.0 
   text	   data	    bss	    dec	    hex	filename
 970813	  29352	   3064	1003229	  f4edd	libyui.so.14.0.0

% ls -lh libyui.so.14.0.0 
-rwxr-xr-x 1 sh users 1.2M Dez  9 10:13 libyui.so.14.0.0

stripped: 985 KB

With -O3 -g:

 % ls -lh libyui.so.14.0.0
-rwxr-xr-x 1 sh users 20M Dez  9 10:16 libyui.so.14.0.0

% size libyui.so.14.0.0
   text	   data	    bss	    dec	    hex	filename
 970813	  29352	   3064	1003229	  f4edd	libyui.so.14.0.0

stripped: 985 KB

With -Os (Optimize for Size):

% ls -lh libyui.so.14.0.0
-rwxr-xr-x 1 sh users 934K Dez  9 10:21 libyui.so.14.0.0

% size libyui.so.14.0.0
   text	   data	    bss	    dec	    hex	filename
 699525	  30728	   3064	 733317	  b3085	libyui.so.14.0.0

stripped: 722 KB

Reference

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment