aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/mixins
AgeCommit message (Collapse)AuthorFilesLines
2020-08-18clike: optimize to_nativePaolo Bonzini1-4/+8
Look for group-able flags with a single regex match, since we are already using regexes for .so files. Also weed out flags other than -isystem very quickly with a single startswith call. On a QEMU build, the time spent in to_native goes from 2.279s to 1.322s.
2020-08-17find_library: include get_linker_always_args in link argsPeter Harris1-1/+1
The linker always args, as the name implies, should always be included. For example, the AIX get_allow_undefined_link_args are a syntax error unless the AIX get_linker_always_args are also used.
2020-08-02Make meson recognize the Qualcomm LLVM toolchainAntony Chan1-0/+5
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 ... ```
2020-07-23compilers: Cache gnu-mixins has_arguments() checksNirbheek Chauhan1-1/+1
want_output gives us the output file. We don't need the file. We just need the compiler stderr, which is always stored.
2020-07-22visualstudio: warning_level 0 should not map to /W1Xavier Claessens1-1/+1
In every other compilers level 0 maps to no argument at all.
2020-07-13Fix native builds on Windows ARM64 machinesNirbheek Chauhan2-5/+10
I made the mistake of always selecting the debug CRT for compiler checks on Windows 4 years ago: https://github.com/mesonbuild/meson/pull/543 https://github.com/mesonbuild/meson/pull/614 The idea was to always build the tests with debugging enabled so that the compiler doesn't optimize the tests away. But we stopped doing that a while ago, and also the debug CRT has no relation to that. We should select the CRT in the same way that we do for building targets: based on the options. On Windows ARM64, the debug CRT for ARM64 isn't always available, and the release CRT is available only after installing the runtime package. Without this, we will always try to pick the debug CRT even when --buildtype=debugoptimized or release.
2020-06-22arglist: Split the C/C++ specifics parts into a subclass for CLikeDylan Baker1-3/+53
This means that we don't need work arounds for D-like compilers, as the special c-like hanlding wont be used for D compilers.
2020-06-22compilers: Return CompilerArgs from compiler instanceDylan Baker1-1/+17
Since the CompileArgs class already needs to know about the compiler, and we really need at least per-lanaguage if not per-compiler CompilerArgs classes, let's get the CompilerArgs instance from the compiler using a method.
2020-06-22compilers: Split CompilerArgs into a separate moduleDylan Baker1-3/+4
I've also moved this out of the compilers pacakge because we're soon going to need it in linkers, and that creates some serious spagetti
2020-06-07Merge pull request #7256 from peterh/openmpJussi Pakkanen1-0/+3
Fix OpenMP on Visual Studio
2020-06-07Remove warnings from sample code. Closes #7248.Jussi Pakkanen1-1/+1
2020-06-07End test code with a newline. Closes #7247.Jussi Pakkanen1-2/+2
2020-06-06msvc: Avoid spurious openmp link warningsPeter Harris1-0/+3
The linker that comes with MSVC does not understand the /openmp flag. This results in a string of LINK : warning LNK4044: unrecognized option '/openmp'; ignored warnings, one for each static_library linked with an executable. Avoid this by only setting the linker openmp flag when the compiler is not MSVC.
2020-06-02Ignore file access errors when scanning .so files in system libdirsMike Gilbert1-9/+18
Bug: https://bugs.gentoo.org/726524
2020-05-27add type anno: compilers/clikeMichael Hirsch, Ph.D1-15/+15
2020-05-22Modifed buildtypes and armclang compiler flags to match documented resultsDrew Reed1-6/+6
2020-05-22Allow building with b_coverage set to true when clang is being used ↔georgev931-0/+3
regardless of linker selection.
2020-05-22compilers: add fetching of define list for clangYevhenii Kolesnikov1-1/+8
Simmilar to gcc, the list of pre-processor defines can be fetched with `-dM -E` option. The way cpu_family is determined on linux relies on this list. Fixes incorrect value of cpu_family on linux, when crosscompiling: ``` CC="clang -m32" meson ./build ``` Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com> Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-05-20compilers: Move b_ndebug into the compiler classesDylan Baker1-0/+3
Right now we hardcode -DNDEBUG as the value to be added for b_ndebug. Which is a not the correct behavior for non C/C++ languages. By pushing this back into the compiler classes we can change this for other languages.
2020-05-18Merge pull request #7103 from dankegel/bug4027-rpath-rememberJussi Pakkanen1-2/+2
Let .pc files and LDFLAGS provide rpaths.
2020-05-16Let .pc files specify rpath.Dan Kegel1-2/+2
Fixes #4027
2020-05-16Add flags to support generation of dependency files with armclangDrew Reed1-1/+1
2020-05-16Modifed buildtypes and armcc compiler flags to match documented resultsDrew Reed1-7/+7
2020-05-13Fix outdated cross-compilation checksOle André Vadla RavnÄs1-2/+3
2020-05-13Fix has_function() for clang on 64bit WindowsChristoph Reiter1-1/+1
has_function() tries to link an example program using the function to see if it is available, but with clang on 64bit Windows this example always already failed at the compile step: error: cast from pointer to smaller type 'long' loses information long b = (long) a; This is due to long!=pointer with LLP64 Change from "long" to "long long" which is min 64bit and should always fit a pointer. While "long long" is strictly a C99 feature every non super ancient compiler should still support it.
2020-05-11Fix builtin check in has_function() with GCC 10 on WindowsChristoph Reiter1-11/+16
The builtin check had a special case that if a header was provided and the function wasn't defined, it would ignore the builtin to avoid non-functional builtins (for example __builtin_posix_memalign in MSYS2). GCC 10 gained support for __has_builtin() which now skipps this check and because __has_builtin(__builtin_posix_memalign) returns true the non functional builtin is now reported as available. To get the old behaviour back move the special case in front of the actual availability check. Fixes #7113
2020-04-23compilers: fix type issueAndrew Udvare1-1/+1
mesonlib.darwin_get_object_archs() only accepts a string argument so convert it.
2020-04-20compilers: Silence warning about gnu_inline with clangNirbheek Chauhan3-3/+18
The warning is due to a change in behaviour in Clang 10 and newer: https://releases.llvm.org/10.0.0/tools/clang/docs/ReleaseNotes.html#c-language-changes-in-clang This was already fixed for clang++, but not for clang for some reason. It was also fixed incorrectly; by adding `extern` instead of moving from `-Werror` to `-Werror=attributes`.
2020-04-17compilers: Honor <lang>_ld when linking C-like outputsOle André Vadla RavnÄs1-0/+4
2020-04-10compilers: Move things out of clikeDylan Baker2-6/+3
One method belongs in the base Compiler class, the other belongs in the GnuLikeCompiler class.
2020-04-10compilers: disable b_sanitize on hurdPino Toscano1-1/+3
ASAN is not supported on the Hurd yet.
2020-04-05quality / test: Fortran type hintingMichael Hirsch, Ph.D1-4/+6
enhance fortran args tests
2020-04-04Make cc.has_function work on GCC/Clang __builtinsAndrei Alexeyev1-5/+6
2020-03-24compilers: Clang can take linkers that are pathsDylan Baker1-0/+14
This will be a regression in 0.54.0 because we now enforce that gnu compilers only get gold, bfd, or lld.
2020-03-23Fix legacy env var support with crossJohn Ericson1-12/+0
Fix #3969
2020-03-23Fix ARMCC dependency generation.Szabi Tolnai1-1/+1
Change-Id: I661684ee8adf5a998641369cf5f13641699742d5
2020-03-21-Add xc16 and c2000 C,Cpp toolchain supportalanNz2-0/+243
2020-03-19Merge pull request #6789 from dcbaker/deprecated-c-ldJussi Pakkanen2-4/+4
Make linker selection environment variables match docs
2020-03-19Fix exe_wrapper usage in EmptyExternalProgram caseRichard Weinberger1-1/+1
If no exe_wrapper is set in the meson cross file the exe_wrapper object will be an instance of EmptyExternalProgram. So, found is True and prorgram is an empty list. This will cause meson to tun the compiler sanity check because it checks only for self.is_cross and self.exe_wrapper being not None. I ran into that situation while cross compiling for ia32 on a x64_64 host. The host had no ia32 userspace installed, so the self test failed. As workaround I currently set exe_wrapper to 'true'. Signed-off-by: Richard Weinberger <richard@nod.at>
2020-03-17compilers: Error if invalid linker selectedDylan Baker2-4/+4
2020-03-15Resolve Clang failure to use -Og with --optimization=gPhillip Johnston1-2/+9
Clang supports the GCC -Og flag, but --optimization=g is not setting that. This is because Clang is referencing the clike_optimization_args, which does not define a flag for 'g'. To address this, we'll mimic the GNU options instead of the C-like ones. Fixes #6619
2020-03-12Merge pull request #6356 from dcbaker/fix-d-compiler-abstractionsJussi Pakkanen1-4/+0
Fix d compiler abstractions
2020-03-09linkers: Move import_library_args to from VS compiler to linkerDylan Baker1-4/+0
This is the argument to name the implib when using the Visual Studio Linker. This is needed by LDC and DMD when using link.exe or lld-link.exe on windows, and is really a linker argument not a compiler argument.
2020-02-27compilers/linkers: Add a representation for wasm-ldDylan Baker1-20/+0
Emscripten does have a stand alone linker, wasm-ld. This patch adds the linker, adds detection for the linker, and removes the IsLinkerMixin for emscripten. This is a little more correct, and makes the code a lot cleaner and more robust.
2020-02-27compilers/mixins/emscripten: Implement thread supportDylan Baker1-0/+26
Emscripten has pthread support (as well as C++ threads), but we don't currently implement them. This fixes that by adding the necessary code. The one thing I'm not sure about is setting the pool size. The docs suggest that you really want to do this to ensure that your code works correctly, but the number should really be configurable, not sure how to set that. Fixes #6684
2020-02-27compilers/mixins/islinker: Add stubs for thread_*_flagsDylan Baker1-0/+6
2020-02-27compilers/emcc: Fix inheritance orderDylan Baker1-0/+1
Sot hat the BasicLinkerIsCompilerMixin comes before ClangCCompiler, which hides its "call the linker" methods, as emcc doesn't have a separate linker.
2020-02-27compilers/mixins/islinker: Add missing methodDylan Baker1-0/+3
In particular emcc needs this
2020-01-30-Fixed Renesas RX Family compiler to work with latest meson, updated ↔alanNz2-2/+8
cross-file, fixed assembly file use
2020-01-28compilers: Use /Zi instead of /ZI with clang-clDylan Baker1-4/+13
Clang-cl doesn't support /ZI, so we need to use either /Zi or /Z7, which both do the same thing for clang-cl (though not for msvc) Fixes #6414