about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2023-05-23Support rust metadata for AIX.Esme Yi-12/+139
2023-05-22Fix #[inline(always)] on closures with target feature 1.1Caleb Zulawski-1/+16
2023-05-21rustc_codegen_ssa: Set e_flags for AVR architecture based on target CPUAdam Gausmann-1/+6
2023-05-21Auto merge of #111675 - Urgau:fix-local-libs-for-native-static-libs, r=bjorn3bors-0/+2
Fix local libs not included when printing native static libs This PR fixes https://github.com/rust-lang/rust/issues/111643 by adding the local used libs to the printed `--print=native-static-libs` output. It seems that `--print=native-static-libs` doesn't have any test, so I added one. It's very simple and doesn't even tries to compile the result to a binary as I don't know how to handle external library linking in CI. (Note that https://github.com/rust-lang/rust/blob/master/tests/run-make/staticlib-dylib-linkage/Makefile does compile to a binary) r? `@bjorn3`
2023-05-20Auto merge of #111413 - workingjubilee:bump-object-0-31-1, r=MarkSimulacrumbors-2/+2
Bump object and thorin-dwp Required to fix watchOS breakage.
2023-05-19Auto merge of #111641 - michaelwoerister:debugger-visualizer-fixes, r=cjgillotbors-3/+3
Fix dependency tracking for debugger visualizers This PR fixes dependency tracking for debugger visualizer files by changing the `debugger_visualizers` query to an `eval_always` query that scans the AST while it is still available. This way the set of visualizer files is already available when dep-info is emitted. Since the query is turned into an `eval_always` query, dependency tracking will now reliably detect changes to the visualizer script files themselves. TODO: - [x] perf.rlo - [x] Needs a bit more documentation in some places - [x] Needs regression test for the incr. comp. case Fixes https://github.com/rust-lang/rust/issues/111226 Fixes https://github.com/rust-lang/rust/issues/111227 Fixes https://github.com/rust-lang/rust/issues/111295 r? `@wesleywiser` cc `@gibbyfree`
2023-05-18Auto merge of #111345 - jyn514:cfg-release-caching, r=cjgillot,est31bors-9/+7
Only depend on CFG_VERSION in rustc_interface This avoids having to rebuild the whole compiler on each commit when `omit-git-hash = false`. cc https://github.com/rust-lang/rust/issues/76720 - this won't fix it, and I'm not suggesting we turn this on by default, but it will make it less painful for people who do have `omit-git-hash` on as a workaround.
2023-05-18Rollup merge of #110884 - korran:unaligned-scalar-mem, r=wesleywiserDylan DPC-0/+1
Support RISC-V unaligned-scalar-mem target feature This adds `unaligned-scalar-mem` as an allowed RISC-V target feature. Some RISC-V cores support unaligned access to memory without trapping. On such cores, the compiler could significantly improve code-size and performance when using functions like core::ptr::read_unaligned<u32> by emitting a single load or store instruction with an unaligned address, rather than a long sequence of byte load/store/bitmanip instructions. Enabling the `unaligned-scalar-mem` target feature allows LLVM to do this optimization. Fixes #110883
2023-05-17Only depend on CFG_VERSION in rustc_interfacejyn-9/+7
this avoids having to rebuild the whole compiler on each commit when `omit-git-hash = false`.
2023-05-17Don't assume that `-Bdynamic` is the default linker modeAmanieu d'Antras-12/+12
In particular this is false when passing `-static` or `-static-pie` to the linker, which changes the default to `-Bstatic`. This PR ensures we explicitly initialize the correct mode when we first need it.
2023-05-17Cache dominators.Camille GILLOT-1/+1
2023-05-17Fix issue #111643 by adding the local used librariesUrgau-0/+2
2023-05-17Rollup merge of #110145 - WaffleLapkin:share_slice_of_bytes, r=NilstriebDylan DPC-10/+7
Share slice of bytes r? `@Nilstrieb` cc `@noamtashma`
2023-05-16Move DebuggerVisualizerFile types from rustc_span to rustc_middleMichael Woerister-3/+3
2023-05-16Remove `MetadataRef` type aliasMaybe Waffle-10/+7
2023-05-15Auto merge of #107707 - calebzulawski:remove-features, r=Amanieubors-3/+0
Remove misleading target feature aliases Fixes #100752. This is a follow up to #103750. These aliases could not be completely removed until rust-lang/stdarch#1355 landed. cc `@Amanieu`
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-6/+6
2023-05-14Auto merge of #111440 - cjgillot:refprop-debuginfo, r=oli-obkbors-49/+101
Allow MIR debuginfo to point to a variable's address MIR optimizations currently do not to operate on borrowed locals. When enabling #106285, many borrows will be left as-is because they are used in debuginfo. This pass allows to replace this pattern directly in MIR debuginfo: ```rust a => _1 _1 = &raw? mut? _2 ``` becomes ```rust a => &_2 // No statement to borrow _2. ``` This pass is implemented as a drive-by in ReferencePropagation MIR pass. This transformation allows following following MIR opts to treat _2 as an unborrowed local, and optimize it as such, even in builds with debuginfo. In codegen, when encountering `a => &..&_2`, we create a list of allocas: ```llvm store ptr %_2.dbg.spill, ptr %a.ref0.dbg.spill store ptr %a.ref0.dbg.spill, ptr %a.ref1.dbg.spill ... call void `@llvm.dbg.declare(metadata` ptr %a.ref{n}.dbg.spill, /* ... */) ``` Caveat: this transformation looses the exact type, we do not differentiate `a` as a immutable, mutable reference or a raw pointer. Everything is declared to `*mut` to codegen. I'm not convinced this is a blocker.
2023-05-13Auto merge of #111374 - tmiasko:align-unsized-locals, r=cjgillotbors-11/+15
Align unsized locals Allocate an extra space for unsized locals and manually align the storage, since alloca doesn't support dynamic alignment. Fixes #71416. Fixes #71695.
2023-05-13Auto merge of #107586 - SparrowLii:parallel-query, r=cjgillotbors-12/+10
Introduce `DynSend` and `DynSync` auto trait for parallel compiler part of parallel-rustc #101566 This PR introduces `DynSend / DynSync` trait and `FromDyn / IntoDyn` structure in rustc_data_structure::marker. `FromDyn` can dynamically check data structures for thread safety when switching to parallel environments (such as calling `par_for_each_in`). This happens only when `-Z threads > 1` so it doesn't affect single-threaded mode's compile efficiency. r? `@cjgillot`
2023-05-13Support ConstantIndex in debuginfo.Camille GILLOT-1/+23
2023-05-13Implement references VarDebugInfo.Camille GILLOT-12/+40
2023-05-13Extract debug_introduce_local_as_var.Camille GILLOT-48/+50
2023-05-12Rollup merge of #111393 - klensy:win-0.48, r=oli-obkMatthias Krüger-1/+1
bump windows crate 0.46 -> 0.48 This drops duped version of crate(0.46), reduces `rustc_driver.dll` ~800kb and reduces exported functions number from 26k to 22k. Also while here, added `tidy-alphabetical` sorting to lists in tidy allowed lists.
2023-05-11Prevent insta-stable no alloc shim supportbjorn3-1/+12
You will need to add the following as replacement for the old __rust_* definitions when not using the alloc shim. #[no_mangle] static __rust_no_alloc_shim_is_unstable: u8 = 0;
2023-05-11Rollup merge of #111382 - Zalathar:ffi, r=cuviperMatthias Krüger-7/+11
Isolate coverage FFI type layouts from their underlying LLVM C++ types I noticed that several of the types used to send coverage information through FFI are not properly isolated from the layout of their corresponding C++ types in the LLVM API. This PR adds more explicitly-defined FFI struct/enum types in `CoverageMappingWrapper.cpp`, so that Rust source files in `rustc_codegen_ssa` and `rustc_codegen_llvm` aren't directly exposed to LLVM C++ types.
2023-05-10Bump object and thorin-dwpJubilee Young-2/+2
object -> 0.31.1 thorin-dwp -> 0.6.0 Required to fix watchOS breakage.
2023-05-10Auto merge of #106560 - bjorn3:support_staticlib_dylib_linking, r=pnkfelixbors-5/+70
Support linking to rust dylib with --crate-type staticlib This allows for example dynamically linking libstd, while statically linking the user crate into an executable or C dynamic library. For this two unstable flags (`-Z staticlib-allow-rdylib-deps` and `-Z staticlib-prefer-dynamic`) are introduced. Without the former you get an error. The latter is the equivalent to `-C prefer-dynamic` for the staticlib crate type to indicate that dynamically linking is preferred when both options are available, like for libstd. Care must be taken to ensure that no crate ends up being merged into two distinct staticlibs that are linked together. Doing so will cause a linker error at best and undefined behavior at worst. In addition two distinct staticlibs compiled by different rustc may not be combined under any circumstances due to some rustc private symbols not being mangled. To successfully link a staticlib, `--print native-static-libs` can be used while compiling to ask rustc for the linker flags necessary when linking the staticlib. This is an existing flag which previously only listed native libraries. It has been extended to list rust dylibs too. Trying to locate libstd yourself to link against it is not supported and may break if for example the libstd of multiple rustc versions are put in the same directory. For an example on how to use this see the `src/test/run-make-fulldeps/staticlib-dylib-linkage/` test.
2023-05-09bump windows crate 0.46 -> 0.48 in workspaceklensy-1/+1
2023-05-09Isolate coverage FFI type layouts from their underlying LLVM C++ typesZalathar-7/+11
2023-05-09Rollup merge of #110304 - cchiw:master, r=davidtwcoDylan DPC-0/+50
Add GNU Property Note Fix #103001 Generates the missing property note: ``` Displaying notes found in: .note.gnu.property Owner Data size Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: x86 feature: IBT ```
2023-05-08Align unsized localsTomasz Miąsko-11/+15
Allocate an extra space for unsized locals and manually align the storage, since alloca doesn't support dynamic alignment.
2023-05-08Rollup merge of #104070 - nbdd0121:unwind, r=AmanieuMichael Goulet-1/+2
Prevent aborting guard from aborting the process in a forced unwind Fix #101469
2023-05-08Rollup merge of #110297 - kylematsuda:earlybinder_tcx_subst, r=BoxyUwUDylan DPC-1/+1
Make `(try_)subst_and_normalize_erasing_regions` take `EarlyBinder` Changes `subst_and_normalize_erasing_regions` and `try_subst_and_normalize_erasing_regions` to take `EarlyBinder<T>` instead of `T`. (related to #105779) This was suggested by `@BoxyUwU` in https://github.com/rust-lang/rust/pull/107753#discussion_r1105828139. After changing `type_of` to return `EarlyBinder`, there were several places where the binder was immediately skipped to call `tcx.subst_and_normalize_erasing_regions`, only for the binder to be reconstructed inside of that method. r? `@BoxyUwU`
2023-05-07Use `landingpad filter` to encode aborting landing padGary Guo-1/+2
2023-05-07Rollup merge of #105583 - luqmana:bitcast-immediates, r=oli-obkYuki Okushi-4/+33
Operand::extract_field: only cast llval if it's a pointer and replace bitcast w/ pointercast. Fixes #105439. Also cc `@erikdesjardins,` looks like another place to cleanup as part of #105545
2023-05-06use EarlyBinder in tcx.(try_)subst_mir_and_normalize_erasing_regionsKyle Matsuda-1/+1
2023-05-06Rollup merge of #110985 - Amanieu:normalize_asm_spans, r=b-naberMatthias Krüger-3/+9
Fix spans in LLVM-generated inline asm errors Previously, incorrect spans were reported if inline assembly contained CRLF (Windows) line endings. Fixes #110885
2023-05-06Fix spans in LLVM-generated inline asm errorsAmanieu d'Antras-3/+9
Previously, incorrect spans were reported if inline assembly contained CRLF (Windows) line endings. Fixes #110885
2023-05-06introduce `DynSend` and `DynSync` auto traitSparrowLii-12/+10
2023-05-06Rollup merge of #109677 - dpaoliello:rawdylib, r=michaelwoerister,wesleywiserYuki Okushi-9/+0
Stabilize raw-dylib, link_ordinal, import_name_type and -Cdlltool This stabilizes the `raw-dylib` feature (#58713) for all architectures (i.e., `x86` as it is already stable for all other architectures). Changes: * Permit the use of the `raw-dylib` link kind for x86, the `link_ordinal` attribute and the `import_name_type` key for the `link` attribute. * Mark the `raw_dylib` feature as stable. * Stabilized the `-Zdlltool` argument as `-Cdlltool`. * Note the path to `dlltool` if invoking it failed (we don't need to do this if `dlltool` returns an error since it prints its path in the error message). * Adds tests for `-Cdlltool`. * Adds tests for being unable to find the dlltool executable, and dlltool failing. * Fixes a bug where we were checking the exit code of dlltool to see if it failed, but dlltool always returns 0 (indicating success), so instead we need to check if anything was written to `stderr`. NOTE: As previously noted (https://github.com/rust-lang/rust/pull/104218#issuecomment-1315895618) using dlltool within rustc is temporary, but this is not the first time that Rust has added a temporary tool use and argument: https://github.com/rust-lang/rust/pull/104218#issuecomment-1318720482 Big thanks to ``````@tbu-`````` for the first version of this PR (#104218)
2023-05-05Address review comments.Luqman Aden-6/+0
Remove bitcasts in OperandRef::extract_field; only pointercasts should be needed.
2023-05-05Don't bitcast aggregate field.Luqman Aden-1/+26
2023-05-05Operand::extract_field: only cast llval if it's a pointer and replace ↵Luqman Aden-3/+13
bitcast w/ pointercast.
2023-05-05rewriting match on endiannessCharisee-9/+6
2023-05-05rewriting match on endiannessCharisee-1/+8
2023-05-05Add GNU Property NoteCharisee-11/+15
2023-05-04Rollup merge of #110826 - cjgillot:place-mention-use, r=JakobDegen,lcnrMatthias Krüger-1/+3
Make PlaceMention a non-mutating use. Fixes https://github.com/rust-lang/rust/issues/110781 r? `@JakobDegen` I don't agree with your statement in https://github.com/rust-lang/rust/issues/110781#issuecomment-1520841434. I suggest that we start fixing `PlaceContext` to be accurate enough for optimizations to use it. This structure is very convenient to use in visitors, and we perhaps have an opportunity to make it less of a footgun.
2023-05-03Rollup merge of #105452 - rcvalle:rust-cfi-3, r=bjorn3Manish Goregaokar-51/+34
Add cross-language LLVM CFI support to the Rust compiler This PR adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the `-Zsanitizer-cfi-normalize-integers` option to be used with Clang `-fsanitize-cfi-icall-normalize-integers` for normalizing integer types (see https://reviews.llvm.org/D139395). It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653. Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto). Thank you again, ``@bjorn3,`` ``@nikic,`` ``@samitolvanen,`` and the Rust community for all the help!
2023-05-03Add cross-language LLVM CFI support to the Rust compilerRamon de C Valle-51/+34
This commit adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the `-Zsanitizer-cfi-normalize-integers` option to be used with Clang `-fsanitize-cfi-icall-normalize-integers` for normalizing integer types (see https://reviews.llvm.org/D139395). It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653. Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto).