Re-enable dead code elimination
Dead code elimation gives us a way to reduce our binary size for "free"
with basically no downsides. While the wins are relatively small given
how little dead code we actually have, they're worth it for the low cost
of a single extra CXXFLAG.
Tested:
Enabled this option, and compared pre-compression binary size. Build of
current master 3399816 bytes, build with this change 3428488 bytes means
28672 bytes saved. Not a lot, but everything helps, and this option is
more or less "free".
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I78b76ed631b8ddc45c9338ac8d04a76cb7441035
diff --git a/meson.build b/meson.build
index 5ceb6b0..7a16e91 100644
--- a/meson.build
+++ b/meson.build
@@ -34,8 +34,10 @@
summary('Build Type',build, section : 'Build Info')
summary('Optimization',optimization, section : 'Build Info')
+
# remove debug information for minsize buildtype
if(get_option('buildtype') == 'minsize')
+ add_project_arguments(['-fdata-sections', '-ffunction-sections'], language : 'cpp')
add_project_arguments('-DNDEBUG', language : 'cpp')
endif
@@ -376,6 +378,7 @@
executable('bmcweb',srcfiles_bmcweb,
include_directories : incdir,
dependencies: bmcweb_dependencies,
+ link_args: '-Wl,--gc-sections',
install: true,
install_dir:bindir)