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.
pull/949/head
Nirbheek Chauhan 9 years ago
parent ac58c13bbf
commit a06178f58f
  1. 13
      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)

Loading…
Cancel
Save