summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
AgeCommit message (Collapse)Author
2025-11-19compilers: Remove Environment parameter from Compiler.openmp_flagsDylan Baker
I've done the compile and link flags in one commit since they're so closely related
2025-11-19compilers: Remove Environment parameter from ↵Dylan Baker
Compiler.get_language_stdlib_only_link_flags
2025-11-19compilers: Remove Environment parameter from Compiler.has_function_attributeDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.get_soname_argsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.get_assert_argsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.get_library_dirsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.get_return_valueDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.find_frameworkDylan Baker
Which, ironically, is passed down three levels and never used.
2025-11-19compilers: Remove environment parameter from Compiler.find_framework_pathsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.sanity_checkDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.run_sanity_checkDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.build_wrapper_argsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler._build_wrapperDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.compiles()Dylan Baker
2025-11-19Compilers: remove Environment parameter from Compiler.links()Dylan Baker
2025-11-19compilers: Remove Environment parameter from get_compileropt_valueDylan Baker
2025-11-19linkers: Store a reference to the Environment in the DynamicLinkerDylan Baker
For the same reason that the StaticLinker needs this, we need it in the DynamicLinker as well.
2025-11-19linkers: Store a reference to the Environment in the StaticLinkerDylan Baker
There are a number of places where we treat StaticLinker and Compiler as polymorphic, as such the StaticLinker cannot need extra parameters.
2025-11-19compilers: Stop passing `is_cross`Dylan Baker
This is calculated by `Environment().is_cross_build(for_machine)`. Since we have that in the Compiler class, just calculate it in the Compiler initializer
2025-11-19compilers: Pass Environment instead of MachineInfoDylan Baker
We end up needing it everywhere, so just store it. This patch is huge already, so it's just the conversion to passing Environment, more cleanups to come.
2025-11-19Prevent /link being passed twice in compiler flagsFrankie Robertson
This does not work correctly with clang-cl/lld-link
2025-11-19rust: add functions for coverage argumentsPaolo Bonzini
Adding support for linker option broke -Db_coverage because the `--coverage` option is added to the command line without the `-Clink-arg=` part. Fix it by overriding get_coverage_link_args; since we have to add the get_coverage_* functions to RustCompiler, teach it to generate `-Cinstrument-coverage` as well. Note that `-Clink-arg==--coverage` is actually useful only for mixed C/Rust programs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-18Add support for the `counted_by` attributeTristan Partin
This is a new attribute released in GCC 15 and clang 18. It isn't supported in C++ compilers at the moment.
2025-11-14Add `os2_emxomf' option to generate OMF files on OS/2KO Myung-Hun
1. Generate OMF objs with `-Zomf' compiler flags 2. Generate OMF libs with `.lib' suffix using `emxomfar' as a librarian
2025-11-14Get library name patterns with proper prefixes and suffixes on OS/2KO Myung-Hun
2025-11-14PIC is always enabled on OS/2KO Myung-Hun
2025-11-14Add a proper flag for pthread on OS/2KO Myung-Hun
2025-11-13vala: utilize depfilesValeri Ochinski
2025-11-12rust: allow linking with sanitizer-enabled C librariesPaolo Bonzini
Fixes: #15222 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-12compilers: pass target and env to sanitizer_*_argsPaolo Bonzini
The Rust compiler will need these to check the rust_nightly option. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-12rust: call compilers.get_base_link_argsPaolo Bonzini
The rustc invocation performs both compilation and linking, so it should include link-phase arguments for LTO or sanitizers. RustCompiler has been taught how to include these arguments, so now add them. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-12rust: always pass -C default-linker-librariesPaolo Bonzini
This is often needed for mixed Rust/C programs, and in particular always needed with sanitizers. Add it always. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-12rust: use proper linker arguments to get the MSVC runtime libraryPaolo Bonzini
Follow the suggestion in https://github.com/rust-lang/rust/issues/39016#issuecomment-2391095973 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-12rust: add full set of linker argument functions to RustCompilerPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-12compilers: generalize -fembed-bitcodePaolo Bonzini
Produce -Cembed-bitcode for Rust, and also disable bitcode generation when LTO is not enabled.
2025-11-12rust: add get_lto_compile_argsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-12linkers: add -no_warn_duplicate_libraries when testing for arguments to Apple ldPaolo Bonzini
No other linker warns for duplicate libraries, and (especially with rustc) specifying --fatal-warnings may cause the warnings to trigger and a wrong result from has_multi_link_arguments. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-11compilers: support prelinking with ClangAlois Wohlschlager
Clang supports prelinking using the same `-r` flag as GCC. There has been prior art in [1], which stalled at the time due to Clang inappropriately trying (and failing) to link libgcc_s. This issue does not occur any more with versions 14 and higher. [1] https://github.com/mesonbuild/meson/pull/8883
2025-11-11compilers: clang: allow ThinLTO with bfdSam James
bfd supports the 'gold' plugin API too, just the LLVM plugin is called 'LLVMgold'. Closes: https://github.com/mesonbuild/meson/issues/10798
2025-11-10Fix detection of ifunc attribute on clang++Bruce Merry
clang++ seems to require the resolver function to have external linkage, so the test code that was used was failing even though clang does support the attribute. Closes #12413.
2025-11-09Fix inverted RTTI logic in Intel C++ compilerTudor Gradinaru
The IntelCPPCompiler was incorrectly adding -fno-rtti when RTTI was enabled (rtti=True) instead of when it was disabled. This change corrects the logic to match the behavior of GCC and Clang compilers, which properly add -fno-rtti when rtti=False. Fixes #15220
2025-11-09compilers: support GCC incremental LTOSam James
GCC 15 supports incremental LTO (caching). It's the same feature as Clang's ThinLTO caching. Unfortunately, for the Clang ThinLTO cache support, we chose a pretty vendor-specific option name, and I don't want to worry about deprecating that (-Db_thinlto_cache and -Db_thinlto_cache_dir) at this time, so... Wire -Db_thinlto_cache and -Db_thinlto_cache_dir for GCC in the obvious and natural way. Other notes: * GCC, unlike Clang, requires the cache dir to exist. If the user passes an invalid directory, that's on them, but for our default in meson-private, we should os.mkdir() it, so we do that now too. * I did wonder about adding -flto-partition=cache, but when I asked about this last year [0], the response was that it has too many caveats. Though Honza did recently [1] suggest it has some utility, so I don't know. I'll ask about it. [0] https://inbox.sourceware.org/gcc-patches/vjeanwm7b2jnedzmbwww4cy6jf4prty6ypxvz7x5d463xw2mys@bxzxuvgfaplf/ [1] https://inbox.sourceware.org/gcc-patches/aLnAGpln6SXbjV7e@kam.mff.cuni.cz/ Closes: https://github.com/mesonbuild/meson/issues/14428
2025-11-09compilers: gnu: prepare for more work in get_lto_compile_argsSam James
Stop early-returning as we're going to do more work in this function shortly for incremental LTO. Bug: https://github.com/mesonbuild/meson/issues/14428
2025-11-09compilers: gnu: clean up get_lto_link_argsSam James
... by calling self.get_lto_compile_args, as we expect the same arguments to be passed at both compile-time and link-time, and we're doing the exact same procedure to determine -flto=XXX. Bug: https://github.com/mesonbuild/meson/issues/9536
2025-11-09compilers: gnu: implement get_lto_link_argsSam James
Without this, we pass (say) `-flto=auto` at compile-time, but just `-flto` at link-time. See also https://gcc.gnu.org/PR114655 and the linked r12-824-g3cbcb5d0cfcd17, i.e. before GCC 12, we'd end up linking with 1 job. The clang mixin looks correct already. Closes: https://github.com/mesonbuild/meson/issues/9536
2025-11-01Compilers: Add get_depfile_format() methodLuca Bacci
2025-10-31compilers: cpp: unset LIBCPP_HARDENING_MODE first for debugstlSam James
libc++ uses the same macro name, just with different values, for debugstl. If the distro or similar predefines a hardening mode lower than the mode debugstl wants (or in any other way not equal), we get an annoying redefinition warning. Closes: https://github.com/mesonbuild/meson/issues/13812
2025-10-31compilers: cpp: explain more wrt GCC versions vs assertionsSam James
Bug: https://github.com/mesonbuild/meson/issues/13978
2025-10-31compilers: cpp: stop trying to handle old libc++ for assertionsSam James
This has two problems: 1) it keeps breaking with Apple Clang (bug #14440, bug #14856) 2) it gets confused when using GCC with libc++ (a rare configuration) because compiler version != libc++ version There's no reason to keep catering for old libc++ here. The feature was somewhat immature in older libc++ anyway. Just rip it out and then we can go back and restore it for the niche case later. Bug: https://github.com/mesonbuild/meson/issues/14440 Bug: https://github.com/mesonbuild/meson/issues/14856 Closes: https://github.com/mesonbuild/meson/issues/13978
2025-10-31compilers: cpp: add comment wrt GCC -stdlib=libc++ caseSam James
It's not obvious so add a comment, lest someone think handling the case is a bug.