compilers: return as-needed args as a list

This commit is contained in:
Dylan Baker 2018-10-29 16:12:16 -07:00 committed by Nirbheek Chauhan
parent 24c4c079e7
commit 5d7395673d
2 changed files with 4 additions and 4 deletions

View File

@ -360,7 +360,7 @@ def get_base_link_args(options, linker, is_shared_module):
args.append('-Wl,-bitcode_bundle')
elif as_needed:
# -Wl,-dead_strip_dylibs is incompatible with bitcode
args.append(linker.get_asneeded_args())
args.extend(linker.get_asneeded_args())
try:
crt_val = options['b_vscrt'].value
buildtype = options['buildtype'].value

View File

@ -188,15 +188,15 @@ class GnuLikeCompiler(metaclass=abc.ABCMeta):
# All GCC-like backends can do assembly
self.can_compile_suffixes.add('s')
def get_asneeded_args(self) -> str:
def get_asneeded_args(self) -> typing.List[str]:
# GNU ld cannot be installed on macOS
# https://github.com/Homebrew/homebrew-core/issues/17794#issuecomment-328174395
# Hence, we don't need to differentiate between OS and ld
# for the sake of adding as-needed support
if self.compiler_type.is_osx_compiler:
return '-Wl,-dead_strip_dylibs'
return ['-Wl,-dead_strip_dylibs']
else:
return '-Wl,--as-needed'
return ['-Wl,--as-needed']
def get_pic_args(self) -> typing.List[str]:
if self.compiler_type.is_osx_compiler or self.compiler_type.is_windows_compiler: