about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
AgeCommit message (Collapse)AuthorLines
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-5/+5
2022-03-02Auto merge of #94514 - matthiaskrgr:rollup-pdzn82h, r=matthiaskrgrbors-2/+2
Rollup of 9 pull requests Successful merges: - #94464 (Suggest adding a new lifetime parameter when two elided lifetimes should match up for traits and impls.) - #94476 (7 - Make more use of `let_chains`) - #94478 (Fix panic when handling intra doc links generated from macro) - #94482 (compiler: fix some typos) - #94490 (Update books) - #94496 (tests: accept llvm intrinsic in align-checking test) - #94498 (9 - Make more use of `let_chains`) - #94503 (Provide C FFI types via core::ffi, not just in std) - #94513 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-01compiler: fix some typoscuishuang-2/+2
2022-03-01Querify `global_backend_features`Simonas Kazlauskas-1/+2
At the very least this serves to deduplicate the diagnostics that are output about unknown target features provided via CLI.
2022-02-23rustc_errors: let `DiagnosticBuilder::emit` return a "guarantee of emission".Eduard-Mihai Burtescu-1/+1
2022-02-23rustc_errors: add `downgrade_to_delayed_bug` to `Diagnostic` itself.Eduard-Mihai Burtescu-1/+1
2022-02-20Auto merge of #93816 - bjorn3:rlib_metadata_first, r=nagisabors-40/+68
Put crate metadata first in the rlib This should make metadata lookup faster Fixes https://github.com/rust-lang/rust/issues/93806
2022-02-19Adopt let else in more placesest31-16/+9
2022-02-18Put crate metadata first in the rlib when possiblebjorn3-40/+68
This should make metadata lookup faster
2022-02-16Adopt let_else in even more placesest31-16/+13
2022-02-10Unconditionally update symbolsbjorn3-7/+0
All paths to an ArchiveBuilder::build call update_symbols first.
2022-02-10Remove unnecessary update_symbols callbjorn3-11/+5
For cg_llvm update_symbols merely sets a flag, so changing the position or removing an additional call doesn't have any effect.
2022-02-09Ensure that queries only return Copy types.Camille GILLOT-2/+2
2022-01-30Rollup merge of #93192 - theidexisted:patch-1, r=wesleywiserEric Huss-1/+1
Add VS 2022 into error message
2022-01-22Add VS 2022 into error messagetheidexisted-1/+1
2022-01-21adapt L4Bender implementationBenjamin Lamowski-80/+62
- Fix style errors. - L4-bender does not yet support dynamic linking. - Stack unwinding is not yet supported for x86_64-unknown-l4re-uclibc. For now, just abort on panics. - Use GNU-style linker options where possible. As suggested by review: - Use standard GNU-style ld syntax for relro flags. - Use standard GNU-style optimization flags and logic. - Use standard GNU-style ld syntax for --subsystem. - Don't read environment variables in L4Bender linker. Thanks to CARGO_ENCODED_RUSTFLAGS introduced in #9601, l4-bender's arguments can now be passed from the L4Re build system without resorting to custom parsing of environment variables.
2022-01-21Add L4Bender as linker variantSebastian Humenda-1/+172
2022-01-20Rollup merge of #91606 - joshtriplett:stabilize-print-link-args, r=pnkfelixMatthias Krüger-1/+1
Stabilize `-Z print-link-args` as `--print link-args` We have stable options for adding linker arguments; we should have a stable option to help debug linker arguments. Add documentation for the new option. In the documentation, make it clear that the *exact* format of the output is not a stable guarantee.
2022-01-17Rollup merge of #92877 - Amanieu:remove_llvm_nounwind, r=Mark-SimulacrumMatthias Krüger-3/+1
Remove LLVMRustMarkAllFunctionsNounwind This was originally introduced in #10916 as a way to remove all landing pads when performing LTO. However this is no longer necessary today since rustc properly marks all functions and call-sites as nounwind where appropriate. In fact this is incorrect in the presence of `extern "C-unwind"` which must create a landing pad when compiled with `-C panic=abort` so that foreign exceptions are caught and properly turned into aborts.
2022-01-15Reduce use of local_def_id_to_hir_id.Camille GILLOT-1/+1
2022-01-14Remove LLVMRustMarkAllFunctionsNounwindAmanieu d'Antras-3/+1
This was originally introduced in #10916 as a way to remove all landing pads when performing LTO. However this is no longer necessary today since rustc properly marks all functions and call-sites as nounwind where appropriate. In fact this is incorrect in the presence of `extern "C-unwind"` which must create a landing pad when compiled with `-C panic=abort` so that foreign exceptions are caught and properly turned into aborts.
2022-01-09Stabilize -Z print-link-args as --print link-argsJosh Triplett-1/+1
We have stable options for adding linker arguments; we should have a stable option to help debug linker arguments.
2022-01-07rustc_codegen_ssa: set static lifetime for object::write::ObjectLain Yang-1/+1
2022-01-07Make rlib metadata strip works with MIPSr6 architectureLain Yang-2/+14
Because MIPSr6 has many differences with previous MIPSr2 arch, the previous rlib metadata stripping code in `rustc_codegen_ssa` is only for MIPSr2/r3/r5 (which share the same elf e_flags). This commit fixed this problem. It makes `rustc_codegen_ssa` happy when compiling rustc for MIPSr6 target or hosts.
2022-01-06cg: use thorin instead of llvm-dwpDavid Wood-54/+111
`thorin` is a Rust implementation of a DWARF packaging utility that supports reading DWARF objects from archive files (i.e. rlibs) and therefore is better suited for integration into rustc. Signed-off-by: David Wood <david.wood@huawei.com>
2022-01-06sess/cg: re-introduce split dwarf kindDavid Wood-34/+66
In #79570, `-Z split-dwarf-kind={none,single,split}` was replaced by `-C split-debuginfo={off,packed,unpacked}`. `-C split-debuginfo`'s packed and unpacked aren't exact parallels to single and split, respectively. On Unix, `-C split-debuginfo=packed` will put debuginfo into object files and package debuginfo into a DWARF package file (`.dwp`) and `-C split-debuginfo=unpacked` will put debuginfo into dwarf object files and won't package it. In the initial implementation of Split DWARF, split mode wrote sections which did not require relocation into a DWARF object (`.dwo`) file which was ignored by the linker and then packaged those DWARF objects into DWARF packages (`.dwp`). In single mode, sections which did not require relocation were written into object files but ignored by the linker and were not packaged. However, both split and single modes could be packaged or not, the primary difference in behaviour was where the debuginfo sections that did not require link-time relocation were written (in a DWARF object or the object file). This commit re-introduces a `-Z split-dwarf-kind` flag, which can be used to pick between split and single modes when `-C split-debuginfo` is used to enable Split DWARF (either packed or unpacked). Signed-off-by: David Wood <david.wood@huawei.com>
2022-01-04Rollup merge of #92107 - nikic:rmeta-lnk-remove, r=nagisaMatthias Krüger-6/+5
Actually set IMAGE_SCN_LNK_REMOVE for .rmeta The code intended to set the IMAGE_SCN_LNK_REMOVE flag for the .rmeta section, however the value of this flag was set to zero. Instead use the actual value provided by the object crate. This dates back to the original introduction of this code in PR #84449, so we were never setting this flag. As I'm not on Windows, I'm not sure whether that means we were embedding .rmeta into executables, or whether the section ended up getting stripped for some other reason.
2021-12-30Auto merge of #91125 - eskarn:llvm-passes-plugin-support, r=nagisabors-0/+2
Allow loading LLVM plugins with both legacy and new pass manager Opening a draft PR to get feedback and start discussion on this feature. There is already a codegen option `passes` which allow giving a list of LLVM pass names, however we currently can't use a LLVM pass plugin (as described here : https://llvm.org/docs/WritingAnLLVMPass.html), the only available passes are the LLVM built-in ones. The proposed modification would be to add another codegen option `pass-plugins`, which can be set with a list of paths to shared library files. These libraries are loaded using the LLVM function `PassPlugin::Load`, which calls the expected symbol `lvmGetPassPluginInfo`, and register the pipeline parsing and optimization callbacks. An example usage with a single plugin and 3 passes would look like this in the `.cargo/config`: ```toml rustflags = [ "-C", "pass-plugins=/tmp/libLLVMPassPlugin", "-C", "passes=pass1 pass2 pass3", ] ``` This would give the same functionality as the opt LLVM tool directly integrated in rust build system. Additionally, we can also not specify the `passes` option, and use a plugin which inserts passes in the optimization pipeline, as one could do using clang.
2021-12-20Load new pass manager plugins only if the new pm is actually usedAxel Cohen-5/+1
2021-12-19Actually set IMAGE_SCN_LNK_REMOVE for .rmetaNikita Popov-6/+5
The code intended to set the IMAGE_SCN_LNK_REMOVE flag for the .rmeta section, however the value of this flag was set to zero. Instead use the actual value provided by the object crate. This dates back to the original introduction of this code in PR #84449, so we were never setting this flag. As I'm not on Windows, I'm not sure whether that means we were embedding .rmeta into executables, or whether the section ended up getting stripped for some other reason.
2021-12-19Rollup merge of #92029 - nikic:section-flags-fix, r=davidtwcoMatthias Krüger-1/+8
Explicitly set no ELF flags for .rustc section For a data section, the object crate will set the SHF_ALLOC by default, which is exactly what we don't want. Explicitly set sh_flags to zero to avoid this. I checked with `objdump -h` that this produces the right flags for ELF. Fixes #92013.
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-2/+2
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-18Auto merge of #92065 - matthiaskrgr:rollup-qmpcsuj, r=matthiaskrgrbors-6/+15
Rollup of 7 pull requests Successful merges: - #91566 (Apply path remapping to DW_AT_GNU_dwo_name when producing split DWARF) - #91926 (Remove `in_band_lifetimes` from `rustc_metadata`) - #91931 (Remove `in_band_lifetimes` from `rustc_codegen_llvm`) - #92024 (rustc_codegen_llvm: Give each codegen unit a unique DWARF name on all platforms, not just Apple ones.) - #92037 (Use a const ParamEnv when in default_method_body_is_const) - #92047 (Set `RUST_BACKTRACE=0` when running location-detail tests) - #92050 (Add a space and 2 grave accents ) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-18Explicitly set no ELF flags for .rustc sectionNikita Popov-1/+8
For a data section, the object crate will set the SHF_ALLOC by default, which is exactly what we don't want. Explicitly set sh_flags to zero to avoid this.
2021-12-18Rollup merge of #91566 - cbeuw:remap-dwo-name, r=davidtwcoMatthias Krüger-6/+15
Apply path remapping to DW_AT_GNU_dwo_name when producing split DWARF `--remap-path-prefix` doesn't apply to paths to `.o` (in case of packed) or `.dwo` (in case of unpacked) files in `DW_AT_GNU_dwo_name`. GCC also has this bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91888
2021-12-17pass -Wl,-z,origin to set DF_ORIGIN when using rpathSébastien Marie-1/+4
DF_ORIGIN flag signifies that the object being loaded may make reference to the $ORIGIN substitution string. Some implementations are just ignoring DF_ORIGIN and do substitution for $ORIGIN if present (whatever DF_ORIGIN pr Set the flag inconditionally if rpath is wanted.
2021-12-15Rollup merge of #91885 - LegionMammal978:less-inband-codegen_ssa, ↵Matthias Krüger-1/+1
r=workingjubilee Remove `in_band_lifetimes` from `rustc_codegen_ssa` See #91867 for more information. In `compiler/rustc_codegen_ssa/src/coverageinfo/map.rs`, there are several functions with an explicit `'a` lifetime but only a single `&'a self` parameter. These lifetimes should be redundant given lifetime elision, unless the existential `impl Iterator` has weird issues regarding that. Should the redundant lifetimes be removed?
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-2/+2
2021-12-15Remove `in_band_lifetimes` from `rustc_codegen_ssa`LegionMammal978-1/+1
See #91867 for more information.
2021-12-14fix clippy::single_char_pattern perf findingsMatthias Krüger-2/+2
2021-12-13Provide object files to llvm-dwp instead of .dwoAndy Wang-6/+6
2021-12-13Fix conditions for using legacy or new pm pluginsAxel Cohen-1/+5
2021-12-13Use the existing llvm-plugins option for both legacy and new pm registrationAxel Cohen-4/+2
2021-12-13Add a codegen option to allow loading LLVM pass pluginsAxel Cohen-0/+4
2021-12-09Remove redundant [..]sest31-2/+2
2021-12-07Use object crate for .rustc metadata generationNikita Popov-150/+203
We already use the object crate for generating uncompressed .rmeta metadata object files. This switches the generation of compressed .rustc object files to use the object crate as well. These have slightly different requirements in that .rmeta should be completely excluded from any final compilation artifacts, while .rustc should be part of shared objects, but not loaded into memory. The primary motivation for this change is #90326: In LLVM 14, the current way of setting section flags (and in particular, preventing the setting of SHF_ALLOC) will no longer work. There are other ways we could work around this, but switching to the object crate seems like the most elegant, as we already use it for .rmeta, and as it makes this independent of the codegen backend. In particular, we don't need separate handling in codegen_llvm and codegen_gcc. codegen_cranelift should be able to reuse the implementation as well, though I have omitted that here, as it is not based on codegen_ssa. This change mostly extracts the existing code for .rmeta handling to allow using it for .rustc as well, and adjust the codegen infrastructure to handle the metadata object file separately: We no longer create a backend-specific module for it, and directly produce the compiled module instead. This does not fix #90326 by itself yet, as .llvmbc will need to be handled separately.
2021-12-06Provide .dwo paths to llvm-dwp explicitlyAndy Wang-5/+14
2021-11-16Rollup merge of #90058 - joshtriplett:stabilize-strip, r=wesleywiserYuki Okushi-2/+12
Stabilize -Z strip as -C strip Leave -Z strip available temporarily as an alias, to avoid breaking cargo until cargo transitions to using -C strip.
2021-11-15Auto merge of #90717 - kit-981:fix-ld64-flags, r=petrochenkovbors-42/+50
Fix ld64 flags - The `-exported_symbols_list` argument appears to be malformed for `ld64` (if you are not going through `clang`). - The `-dynamiclib` argument isn't support for `ld64`. It should be guarded behind a compiler flag. These problems are fixed by these changes. I have also refactored the way linker arguments are generated to be ld/compiler agnostic and therefore less error prone. These changes are necessary to support cross-compilation to darwin targets.
2021-11-15Stabilize -Z strip as -C stripJosh Triplett-2/+12
Leave -Z strip available temporarily as an alias, to avoid breaking cargo until cargo transitions to using -C strip. (If the user passes both, the -C version wins.)