diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-08-02 22:24:54 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-08-02 22:24:54 +0300 |
commit | 58ca96994f5a1e3a85d8c4cca343a7755192e2e1 (patch) | |
tree | e68813e1e07253db540428a54077329fe4760f48 | |
parent | 909a62ca1ab7432f93d92df0505cbe88379a8ac7 (diff) | |
download | meson-58ca96994f5a1e3a85d8c4cca343a7755192e2e1.zip meson-58ca96994f5a1e3a85d8c4cca343a7755192e2e1.tar.gz meson-58ca96994f5a1e3a85d8c4cca343a7755192e2e1.tar.bz2 |
Add option for as-needed link option.
-rw-r--r-- | mesonbuild/compilers.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 55a4384..30eecec 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -142,6 +142,7 @@ base_options = { ['none', 'address', 'thread', 'undefined', 'memory'], 'none'), 'b_lundef': coredata.UserBooleanOption('b_lundef', 'Use -Wl,--no-undefined when linking', True), + 'b_asneeded': coredata.UserBooleanOption('b_asneeded', 'Use -Wl,--as-needed when linking', True), 'b_pgo': coredata.UserComboOption('b_pgo', 'Use profile guide optimization', ['off', 'generate', 'use'], 'off'), @@ -224,6 +225,11 @@ def get_base_link_args(options, linker): except KeyError: pass try: + if options['b_asneeded'].value: + args.append('-Wl,--as-needed') + except KeyError: + pass + try: if options['b_coverage'].value: args += linker.get_coverage_link_args() except KeyError: @@ -1661,6 +1667,7 @@ class GnuCCompiler(CCompiler): 'b_colorout'] if self.gcc_type != GCC_OSX: self.base_options.append('b_lundef') + self.base_options.append('b_asneeded') def get_colorout_args(self, colortype): if mesonlib.version_compare(self.version, '>=4.9.0'): @@ -1731,6 +1738,7 @@ class GnuObjCCompiler(ObjCCompiler): self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage'] if self.gcc_type != GCC_OSX: self.base_options.append('b_lundef') + self.base_options.append('b_asneeded') def get_buildtype_args(self, buildtype): return gnulike_buildtype_args[buildtype] @@ -1759,6 +1767,7 @@ class GnuObjCPPCompiler(ObjCPPCompiler): self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage'] if self.gcc_type != GCC_OSX: self.base_options.append('b_lundef') + self.base_options.append('b_asneeded') def get_buildtype_args(self, buildtype): return gnulike_buildtype_args[buildtype] @@ -1780,6 +1789,7 @@ class ClangObjCCompiler(GnuObjCCompiler): self.clang_type = cltype if self.clang_type != CLANG_OSX: self.base_options.append('b_lundef') + self.base_options.append('b_asneeded') class ClangObjCPPCompiler(GnuObjCPPCompiler): def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None): @@ -1789,6 +1799,7 @@ class ClangObjCPPCompiler(GnuObjCPPCompiler): self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage'] if self.clang_type != CLANG_OSX: self.base_options.append('b_lundef') + self.base_options.append('b_asneeded') class ClangCCompiler(CCompiler): def __init__(self, exelist, version, clang_type, is_cross, exe_wrapper=None): @@ -1801,6 +1812,7 @@ class ClangCCompiler(CCompiler): self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage'] if self.clang_type != CLANG_OSX: self.base_options.append('b_lundef') + self.base_options.append('b_asneeded') def get_buildtype_args(self, buildtype): return gnulike_buildtype_args[buildtype] @@ -1850,6 +1862,7 @@ class GnuCPPCompiler(CPPCompiler): 'b_colorout'] if self.gcc_type != GCC_OSX: self.base_options.append('b_lundef') + self.base_options.append('b_asneeded') def get_colorout_args(self, colortype): if mesonlib.version_compare(self.version, '>=4.9.0'): @@ -1911,6 +1924,7 @@ class ClangCPPCompiler(CPPCompiler): self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage'] if self.clang_type != CLANG_OSX: self.base_options.append('b_lundef') + self.base_options.append('b_asneeded') def get_buildtype_args(self, buildtype): return gnulike_buildtype_args[buildtype] |