From 70edf82c6c77902cd64f44848302bbac92d611d8 Mon Sep 17 00:00:00 2001 From: Antony Chan Date: Thu, 2 Jul 2020 13:16:21 -0700 Subject: Make meson recognize the Qualcomm LLVM toolchain Meson calls `path/to/clang++ --version` to guess which build toolchain the user has picked to build the source code. For the Qualcomm LLVM toolchain, the output have an unusual output as shown below: ``` clang version 8.0.12 Snapdragon LLVM ARM Compiler 8.0.12 (based on llvm.org 7.0+) Target: arm-unknown-linux-gnueabi Thread model: posix Repository: (ssh://git-hexagon-aus.qualcomm.com:...) InstalledDir: /pkg/qct/software/llvm/release/arm/8.0.12/bin ``` Another unusual pattern is the output of `path/to/ld.qcld --version`: ``` ARM Linker from Snapdragon LLVM ARM Compiler Version 8.0.12 ARM Linker based on LLVM version: 8.0 ``` The Meson logic is modified accordingly so that Meson can correctly determine toolchain as "LLVM aarch64 cross-compiler on GNU/Linux64 OS". This is the expected output of `meson --native-file native_file.ini --cross-file cross_file.ini build/aarch64-debug/`: ``` ... C++ compiler for the host machine: ... (clang 8.0.12 "clang version 8.0.12") C++ linker for the host machine: ... ld.lld 8.0.12 ... ``` --- mesonbuild/compilers/mixins/clang.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mesonbuild/compilers') diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py index ecfbc64..7525c12 100644 --- a/mesonbuild/compilers/mixins/clang.py +++ b/mesonbuild/compilers/mixins/clang.py @@ -113,6 +113,11 @@ class ClangCompiler(GnuLikeCompiler): # (and other gcc-like compilers) cannot. This is becuse clang (being # llvm based) is retargetable, while GCC is not. # + + # qcld: Qualcomm Snapdragon linker, based on LLVM + if linker == 'qcld': + return ['-fuse-ld=qcld'] + if shutil.which(linker): if not shutil.which(linker): raise mesonlib.MesonException( -- cgit v1.1