diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-10-25 05:07:58 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-10-25 09:44:15 +0530 |
commit | a06178f58fa91293d59a63313a733ac1bb043854 (patch) | |
tree | 7f0184bc87537b7ecafa4fd47547bd97c4ec6709 /mesonbuild/compilers.py | |
parent | ac58c13bbfa6c7b47cc54f30e32bd405c944076d (diff) | |
download | meson-a06178f58fa91293d59a63313a733ac1bb043854.zip meson-a06178f58fa91293d59a63313a733ac1bb043854.tar.gz meson-a06178f58fa91293d59a63313a733ac1bb043854.tar.bz2 |
Add -Wl,-no_weak_imports to has_function with XCode 8
This is needed to ensure that symbol availability checks actually fail
at link time (instead of at runtime) which is necessary for has_function
to work correctly.
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r-- | mesonbuild/compilers.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 03fb4f2..7e73636 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -17,7 +17,7 @@ import subprocess, os.path import tempfile from .import mesonlib from . import mlog -from .mesonlib import MesonException +from .mesonlib import MesonException, version_compare from . import coredata """This file contains the data files of all compilers Meson knows @@ -2103,6 +2103,17 @@ class ClangCompiler(): def has_argument(self, arg, env): return super().has_argument(['-Werror=unknown-warning-option', arg], env) + def has_function(self, funcname, prefix, env, extra_args=None, dependencies=None): + if extra_args is None: + extra_args = [] + # Starting with XCode 8, we need to pass this to force linker + # visibility to obey OS X and iOS minimum version targets with + # -mmacosx-version-min, -miphoneos-version-min, etc. + # https://github.com/Homebrew/homebrew-core/issues/3727 + if self.clang_type == CLANG_OSX and version_compare(self.version, '>=8.0'): + extra_args.append('-Wl,-no_weak_imports') + return super().has_function(funcname, prefix, env, extra_args, dependencies) + class ClangCCompiler(ClangCompiler, CCompiler): def __init__(self, exelist, version, clang_type, is_cross, exe_wrapper=None): CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) |