From 41afb5eb7214727301132aedc381831fbfc78e37 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 24 Apr 2017 19:28:04 -0400 Subject: [PATCH] meson: use -f{function,data}-sections for optimized builds --- meson.build | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/meson.build b/meson.build index a4c93de..949f636 100644 --- a/meson.build +++ b/meson.build @@ -303,6 +303,21 @@ foreach arg : ['-Wl,-z,relro', endif endforeach +if get_option('buildtype') != 'debug' + foreach arg : ['-ffunction-sections', + '-fdata-sections'] + if cc.has_argument(arg) + add_project_arguments(arg, language : 'c') + endif + endforeach + + foreach arg : ['-Wl,--gc-sections'] + if cc.has_argument(arg) + add_project_link_arguments(arg, language : 'c') + endif + endforeach +endif + cpp = ' '.join(cc.cmd_array()) + ' -E' ##################################################################### -- 2.7.4