diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-03-23 14:41:36 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-03-24 10:05:01 +0200 |
commit | 61f56188285a70ecfedb5ebd01ac5c204c7682dc (patch) | |
tree | ebf7fa3ce83f9f4ced5d49aeab0d888a912bc71c | |
parent | 326e9dcc514890cdc6ce7071291069171e312e87 (diff) | |
download | meson-61f56188285a70ecfedb5ebd01ac5c204c7682dc.zip meson-61f56188285a70ecfedb5ebd01ac5c204c7682dc.tar.gz meson-61f56188285a70ecfedb5ebd01ac5c204c7682dc.tar.bz2 |
compilers: Clang can take linkers that are paths
This will be a regression in 0.54.0 because we now enforce that gnu
compilers only get gold, bfd, or lld.
-rw-r--r-- | mesonbuild/compilers/mixins/clang.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py index 6bc7d6c..92f8c5f 100644 --- a/mesonbuild/compilers/mixins/clang.py +++ b/mesonbuild/compilers/mixins/clang.py @@ -15,6 +15,7 @@ """Abstractions for the LLVM/Clang compiler family.""" import os +import shutil import typing as T from ... import mesonlib @@ -98,3 +99,16 @@ class ClangCompiler(GnuLikeCompiler): else: # Shouldn't work, but it'll be checked explicitly in the OpenMP dependency. return [] + + @classmethod + def use_linker_args(cls, linker: str) -> T.List[str]: + # Clang additionally can use a linker specified as a path, which GCC + # (and other gcc-like compilers) cannot. This is becuse clang (being + # llvm based) is retargetable, while GCC is not. + # + if shutil.which(linker): + if not shutil.which(linker): + raise mesonlib.MesonException( + 'Cannot find linker {}.'.format(linker)) + return ['-fuse-ld={}'.format(linker)] + return super().use_linker_args(linker) |