| Age | Commit message (Collapse) | Author | Lines |
|
A lot of places had special handling just in case they would get an
allocator module even though most of these places could never get one or
would have a trivial implementation for the allocator module. Moving all
handling of the allocator module to a single place simplifies things a
fair bit.
|
|
Making it participate in LTO would be incorrect if you compile a crate
as both a dylib (which needs it) and rlib (which must not include it) in
the same rustc invocation. With linker plugin LTO, the allocator shim
will still participate in LTO as it is safe to do so in that case.
|
|
|
|
Ensure we emit an allocator shim when only some crate types need one
Found this while trying to write a test for https://github.com/rust-lang/rust/pull/145955.
|
|
Allow `inline(always)` with a target feature behind a unstable feature `target_feature_inline_always`.
Rather than adding the inline always attribute to the function definition, we add it to the callsite. We can then check that the target features match and that the call would be safe to inline. If the function isn't inlined due to a mismatch, we emit a warning informing the user that the function can't be inlined due to the target feature mismatch.
See tracking issue rust-lang/rust#145574
|
|
Revert "Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins`
This reverts commit cf8753e4f9c3597f04cd5d3aa261e4561d5378a6 (PR https://github.com/rust-lang/rust/pull/145368) and fix the regressions reported at rust-lang/rust#145981, rust-lang/rust#146109, and rust-lang/rust#146145.
|
|
|
|
`compiler_builtins`"
This reverts commit cf8753e4f9c3597f04cd5d3aa261e4561d5378a6 and fixes the
regressions reported.
|
|
explicitly end the lifetime of `va_list`
tracking issue: https://github.com/rust-lang/rust/issues/44930
split out from: https://github.com/rust-lang/rust/pull/144549
The `va_list` is created in the compiler itself when the variable argument list `...` is desugared, and hence the lifetime end is not inserted automatically. The value can't outlive the function in which it was created, so it is correct to end the lifetime here. Ending the lifetime explicitly also appears to give slightly better codegen in https://github.com/rust-lang/rust/pull/144549.
I also included a little drive-by improvement to not cast pointers to integers and back again.
r? codegen
|
|
|
|
|
|
|
|
exported
Previously it would attempt to export the allocator shim even linking
for a crate type which pulls in the allocator shim from a dylib rather
than locally defining it.
|
|
|
|
|
|
Move exporting of profiler and sanitizer symbols to the LLVM backend
Only the LLVM backend needs those specific symbols exported and it only needs them to be exported for LTO, not from cdylibs in general.
|
|
CFI: Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins`
Fix rust-lang/rust#142284 by ensuring that `#![no_builtins]` crates can still emit bitcode when proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto) is used.
|
|
Don't export them from cdylibs. There is no need to do so and it
complicates exported_non_generic_symbols. In addition the GCC backend
likely uses different symbols and may potentially not even need us to
explicitly tell it to export the symbols it needs.
|
|
Port `#[link]` to the new attribute parsing infrastructure
Ports `link` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
|
|
Ensure the coordinator thread terminates before its channels drop
Fixes rust-lang/rust#142949
Explanation: https://github.com/rust-lang/rust/issues/142949#issuecomment-3224573185
|
|
|
|
|
|
Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
|
|
Fix #142284 by ensuring that `#![no_builtins]` crates can still emit bitcode
when proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto) is used.
|
|
add a flag to codegen fn attrs for foreign items
r? `@ghost`
refiled to rerun CI
|
|
rustc_codegen_ssa: More comprehensive RISC-V ELF flags
This change implements more conformant, more comprehensive RISC-V ELF flags handling when generating certain object files directly from rustc.
* Use `"zca"` instead of `"c"`
The "Zca" extension (a subset of "C") is the minimal configuration for compressed instructions to set `EF_RISCV_RVC` flag.
* Set TSO flag from `"ztso"`
The "Ztso" extension denotes that the program depends on the RVTSO (Total Store Ordering) memory consistency model, which is stronger than the standard RVWMO (Weak Memory Ordering) consistency model and on ELF targets, we need to set `EF_RISCV_TSO` flag.
|
|
|
|
|
|
|
|
Don't show warnings from xcrun with -Zverbose-internals
These kinds of warnings can make our test suite fail spuriously, so if we want them, we'll need a different flag.
This was introduced in https://github.com/rust-lang/rust/pull/131477. Fixes https://github.com/rust-lang/rust/issues/145543.
r? apiraino
```@bors``` rollup
|
|
Handle unwinding fatal errors in codegen workers
Also directly unwind on fatal errors at the point they are emitted inside the codegen backends.
Fixes the coordinator ICE of https://github.com/rust-lang/rust/issues/132240, https://github.com/rust-lang/rust/issues/135075 and https://github.com/rust-lang/rust/issues/145800.
|
|
This commit implements more conformant, more comprehensive RISC-V ELF
flags handling when generating certain object files directly from rustc.
* Use "zca" instead of "c"
The "Zca" extension (a subset of "C") is the minimal configuration
for compressed instructions to set `EF_RISCV_RVC` flag.
* Set TSO flag from "ztso"
The "Ztso" extension denotes that the program depends on the RVTSO
(Total Store Ordering) memory consistency model, which is stronger
than the standard RVWMO (Weak Memory Ordering) consistency model and
on ELF targets, we need to set `EF_RISCV_TSO` flag.
|
|
|
|
These kinds of warnings can make our test suites fail, so if we want
them, we'll need a different flag.
|
|
raw-dylib-elf: set correct `DT_VERDEFNUM`
Previously it indicated a single version, regardless of their count.
Observed in: https://github.com/davidlattimore/wild/pull/1041
|
|
Previously it indicated a single version, regardless of their count.
Observed in: https://github.com/davidlattimore/wild/pull/1041
|
|
As opposed to passing it around through Result.
|
|
|
|
|
|
This uses the feature gate for
https://github.com/rust-lang/rust/issues/143352, but is described in
https://github.com/rust-lang/rfcs/pull/3820 which is strongly tied to
the experiment.
|
|
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#145538 (bufreader::Buffer::backshift: don't move the uninit bytes)
- rust-lang/rust#145542 (triagebot: Don't warn no-mentions on subtree updates)
- rust-lang/rust#145549 (Update rust maintainers in openharmony.md)
- rust-lang/rust#145550 (Avoid using `()` in `derive(From)` output.)
- rust-lang/rust#145556 (Allow stability attributes on extern crates)
- rust-lang/rust#145560 (Remove unused `PartialOrd`/`Ord` from bootstrap)
- rust-lang/rust#145568 (ignore frontmatters in `TokenStream::new`)
- rust-lang/rust#145571 (remove myself from some adhoc-groups and pings)
- rust-lang/rust#145576 (Add change tracker entry for `--timings`)
- rust-lang/rust#145578 (Add VEXos "linked files" support to `armv7a-vex-v5`)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Rollup of 15 pull requests
Successful merges:
- rust-lang/rust#145338 (actually provide the correct args to coroutine witnesses)
- rust-lang/rust#145429 (Couple of codegen_fn_attrs improvements)
- rust-lang/rust#145452 (Do not strip binaries in bootstrap everytime if they are unchanged)
- rust-lang/rust#145464 (Stabilize `const_pathbuf_osstring_new` feature)
- rust-lang/rust#145474 (Properly recover from parenthesized use-bounds (precise capturing lists) plus small cleanups)
- rust-lang/rust#145486 (Fix `unicode_data.rs` mention message)
- rust-lang/rust#145490 (Trace some basic I/O operations in bootstrap)
- rust-lang/rust#145493 (remove `should_render` in `PrintAttribute` derive)
- rust-lang/rust#145500 (Port must_use to the new target checking)
- rust-lang/rust#145505 (Simplify span caches)
- rust-lang/rust#145510 (Visit and print async_fut local for async drop.)
- rust-lang/rust#145511 (Rust build fails on OpenBSD after using file_lock feature)
- rust-lang/rust#145532 (resolve: debug for block module)
- rust-lang/rust#145533 (Reorder `lto` options from most to least optimizing)
- rust-lang/rust#145537 (Do not consider a `T: !Sized` candidate to satisfy a `T: !MetaSized` obligation.)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Add VEXos "linked files" support to `armv7a-vex-v5`
Third-party programs running on the VEX V5 platform need a linker script to ensure code and data are always placed in the allowed range `0x3800000-0x8000000` which is read/write/execute. However, developers can also configure the operating system (VEXos) to preload a separate file at any location between these two addresses before the program starts (as a sort of basic linking or configuration loading system). Programs have to know about this at compile time - in the linker script - to avoid placing data in a spot that overlaps where the linked file will be loaded. This is a very popular feature with existing V5 runtimes because it can be used to modify a program's behavior without re-uploading the entire binary to the robot controller.
It's important for Rust to support this because while VEXos's runtime user-exposed file system APIs may only read data from an external SD card, linked files are allowed to load data directly from the device's onboard storage.
This PR adds the `__linked_file_start` symbol to the existing VEX V5 linker script which can be used to shrink the stack and heap so that they do not overlap with a memory region containing a linked file. It expects the linked file to be loaded in the final N bytes of user RAM (this is not technically required but every existing runtime does it this way to avoid having discontinuous memory regions).
With these changes, a developer targeting VEX V5 might add a second linker script to their project by specifying `-Clink-arg=-Tcustom.ld` and creating the file `custom.ld` to configure their custom memory layout. The linker would prepend this to the builtin target linker script.
```c
/* custom.ld: Reserves 10MiB for a linked file. */
/* (0x7600000-0x8000000) */
__linked_file_length = 10M;
/* The above line is equivalent to -Clink-arg=--defsym=__linked_file_length=10M */
/* Optional: specify one or more sections that */
/* represent the developer's custom format. */
SECTIONS {
.linked_file_metadata (NOLOAD) : {
__linked_file_metadata_start = .;
. += 1M;
__linked_file_metadata_end = .;
}
.linked_file_data (NOLOAD) : {
__linked_file_data_start = .;
. += 9M;
__linked_file_data_end = .;
}
} INSERT AFTER .stack;
```
Then, using an external tool like the `vex-v5-serial` crate, they would configure the metadata of their uploaded program to specify the path of their linked file and the address where it should be loaded into memory (in the above example, `0x7600000`).
|
|
Couple of codegen_fn_attrs improvements
As noted in https://github.com/rust-lang/rust/pull/144678#discussion_r2245060329 here is no need to keep link_name and export_name separate, which the third commit fixes by merging them. The second commit removes some dead code and the first commit merges two ifs with equivalent conditions. The last commit is an unrelated change which removes an unused `feature(autodiff)`.
|
|
Extend `QueryStability` to handle `IntoIterator` implementations
This PR extends the `rustc::potential_query_instability` lint to check values passed as `IntoIterator` implementations.
Full disclosure: I want the lint to warn about this line (please see #138871 for why): https://github.com/rust-lang/rust/blob/aa8f0fd7163a2f23aa958faed30c9c2b77b934a5/src/librustdoc/json/mod.rs#L261
However, the lint warns about several other lines as well.
Final note: the functions `get_callee_generic_args_and_args` and `get_input_traits_and_projections` were copied directly from [Clippy's source code](https://github.com/rust-lang/rust/blob/4fd8c04da0674af2c51310c9982370bfadfa1b98/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs#L445-L496).
|
|
|
|
This removes the #[no_sanitize] attribute, which was behind an unstable
feature named no_sanitize. Instead, we introduce the sanitize attribute
which is more powerful and allows to be extended in the future (instead
of just focusing on turning sanitizers off).
This also makes sanitize(kernel_address = ..) attribute work with
-Zsanitize=address
To do it the same as how clang disables address sanitizer, we now
disable ASAN on sanitize(kernel_address = "off") and KASAN on
sanitize(address = "off").
The same was added to clang in https://reviews.llvm.org/D44981.
|
|
This change implements the #[sanitize(..)] attribute, which opts to
replace the currently unstable #[no_sanitize]. Essentially the new
attribute works similar as #[no_sanitize], just with more flexible
options regarding where it is applied. E.g. it is possible to turn
a certain sanitizer either on or off:
`#[sanitize(address = "on|off")]`
This attribute now also applies to more places, e.g. it is possible
to turn off a sanitizer for an entire module or impl block:
```rust
\#[sanitize(address = "off")]
mod foo {
fn unsanitized(..) {}
#[sanitize(address = "on")]
fn sanitized(..) {}
}
\#[sanitize(thread = "off")]
impl MyTrait for () {
...
}
```
This attribute is enabled behind the unstable `sanitize` feature.
|
|
Fix adjacent code
Fix duplicate warning; merge test into `tests/ui-fulldeps/internal-lints`
Use `rustc_middle::ty::FnSig::inputs`
Address two review comments
- https://github.com/rust-lang/rust/pull/139345#discussion_r2109006991
- https://github.com/rust-lang/rust/pull/139345#discussion_r2109058588
Use `Instance::try_resolve`
Import `rustc_middle::ty::Ty` as `Ty` rather than `MiddleTy`
Simplify predicate handling
Add more `#[allow(rustc::potential_query_instability)]` following rebase
Remove two `#[allow(rustc::potential_query_instability)]` following rebase
Address review comment
Update compiler/rustc_lint/src/internal.rs
Co-authored-by: lcnr <rust@lcnr.de>
|
|
|