| Age | Commit message (Collapse) | Author |
|
Move the logic for system dependencies outside Cargo.interpreter and
into the rust module, so that it can be reused by the workspace object.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Attempting to use LTO on e.g. a procedural macro crate fails with
error: lto cannot be used for proc-macro crate type without -Zdylib-lto
Do not return -Clto for such crate types.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This adds support for DEF files to rust and removes
some hasattr duck typing.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This adds a second stage initialization, which allows us to use options
for setting attributes on the compiler. This is called during the detect
phase, so the Compiler is never used in a partially initialized state.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
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.
|
|
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>
|
|
Fixes: #15222
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
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>
|
|
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>
|
|
Follow the suggestion in https://github.com/rust-lang/rust/issues/39016#issuecomment-2391095973
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Produce -Cembed-bitcode for Rust, and also disable bitcode
generation when LTO is not enabled.
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
This is used for project to require a nightly Rust compiler, and also
for Meson to enable nightly feature if available.
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This fixes the following error occured in the test 3 of the Emscripten
build.
> wasm-ld: error: unable to find library -llibvalue.a
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
|
|
Use the same check for all of clang, nasm and rustc.
This also avoids the following warning:
Sanity check compiler command line: clang++ sanitycheckobjcpp.mm -o sanitycheckobjcpp.exe -D_MT -D_DLL -D_DEBUG -D_FILE_OFFSET_BITS=64 -Wl,-fms-runtime-lib=dll_dbg Sanity check compile stdout:
LINK : warning LNK4044: unrecognized option /fms-runtime-lib=dll_dbg; ignored
iWhat happens is that -fms-runtime-lib sets up an automatic dependency
from the .o files to the final link product, and therefore must be
passed as a compiler argument. But the constructor for ClangCompiler
was incorrectly allowing b_vscrt for MINGW, so I messed up the logic.
With this change, MINGW won't get the b_vscrt option.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
On Windows, rustc searches both FOO.lib and libFOO.a when passed -lfoo.
This means that the check for nonstandard names in the Unix sense is
too struct, and indeed it breaks passing for example -lkernel32 (which
adds kernel32.lib to the link).
Fix this by special casing Windows. Extract the logic to the Rust
compiler class for clarity.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This reverts commit 806289a5d27958a084bc6cba41b7cf9ccee4ecf4.
|
|
The goal is to reduce code duplication, and allow each language to
implement as little as possible to get good checking. The main
motivation is that half of the checks are fragile, as they add the work
directory to the paths of the generated files they want to use. This
works when run inside mesonmain because we always have an absolute build
directory, but when put into run_project_tests.py it doesn't work
because that gives a relative build directory.
|
|
Rust 1.84 uses the latest emsdk 3.1.68 [1], and it fixed an
issue with Emscripten dynamic linking and libc [2]. After that no
native-static-libs in the output if running:
```
rustc --target=wasm32-unknown-emscripten --crate-type staticlib --print native-static-libs - < /dev/null
```
[1] https://github.com/rust-lang/rust/pull/131533
[2] https://github.com/rust-lang/libc/pull/4002
|
|
|
|
rustdoc does not support --print, and therefore the rpath argument corresponding
to the rust installation is not passed to doctests.
Forward anything that requires --print to the RustCompiler, thus fixing
doctests with a shared library dependency.
Fixes: #14813
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
As an initial implementation, simply adding "-C prefer-dynamic" works
for binary crates (as well as dylib and proc-macro that already used it).
In the future this could be extended to other crate types. For more
information see the comment in the changed file, as well as
https://github.com/mesonbuild/meson/issues/8828 and
https://github.com/mesonbuild/meson/issues/14215.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
RustCompiler.build_rpath_args works by appending the directory to the
arguments computed by self.linker.build_rpath_args. This does not
work if there is no argument to begin with, which happens for example
in program crates.
Use the new extra_paths argument to force inclusion of the libdir into
the rpath of the binary, even in that case.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
|
|
Avoid reinventing the wheel and instead use a single helper, taking care
of logging and cross compilation.
Fixes: #14373
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This will be handled by target binary link. And if it's not compatible
with what Rust uses, it wouldn't work anyway.
|
|
|
|
Move building the -std option to the new get_option_std_args method,
special casing CUDA to never include the option from the host compiler.
This fixes again #8523, which was broken by the option refactoring
(unsurprisingly, since the fix was ripped out unceremoniously without
a replacement).
Fixes: #14365
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Windows toolchains append `.exe` to executables. When cross-compiling on
Linux, attempting to run `./rusttest` will not execute the generated
`rusttest.exe`.
Fix this by always appending `.exe`, which is a valid filename on all
supported platforms. This is what the `CLikeCompiler` class does too.
While reviewing `rust.py`, there are opportunities for improvements and
better unification with the rest of the Meson code. However, this commit
focuses on fixing cross-compilation with minimal changes.
Fixes: #14374
|
|
Pass down the full_version, otherwise assigning "self.is_beta"
fails.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|