summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
AgeCommit message (Collapse)AuthorLines
2023-03-29Fix linker detection for clang with prefixTaiki Endo-1/+3
2023-02-24Rename many interner functions.Nicholas Nethercote-1/+1
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-21Linker: use -z <params> instead of -z<params>Frank Denis-8/+8
The GNU linker accepts -z<params>, but this is undocumented, and not supported by other linkers. In particular, `zig cc`, when used as the C compiler/linker (e.g. when using `cargo-zigbuild`), will not accept this undocumented syntax. In `linker.rs`, both syntaxes are also used inconsistently. The Go compiler used to have the same issue, but fixed it: https://github.com/golang/go/commit/38607c553878da21b5042e63997ecb3b7201e684
2023-02-20Move the resolver into a queryOli Scherer-0/+1
2023-02-16Replace some `then`s with some `then_some`sMaybe Waffle-1/+1
2023-02-14Do not fetch HIR to compute symbols.Camille GILLOT-33/+34
2023-02-12Auto merge of #105601 - BelovDV:change-rlib-with-not-stable, r=petrochenkovbors-96/+39
Enable new rlib in non stable cases If bundled static library uses cfg (unstable) or whole-archive (wasn't supported) bundled libs are packed even without packed_bundled_libs. r? `@petrochenkov`
2023-02-10remove redundant clonesMatthias Krüger-1/+1
2023-02-10[link] enable packed bundled lib in non stable casesDaniil Belov-96/+39
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-2/+6
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-27Revert "Avoid a temporary file when processing macOS fat archives"bjorn3-34/+36
This reverts commit bd8e476d8bd85b6d60a0de7694d154b4a74f5133.
2023-01-26Rollup merge of #106904 - khuey:preserve_debuginfo_for_rlibs, r=davidtwcoMatthias Krüger-6/+0
Preserve split DWARF files when building archives. r? ```@davidtwco```
2023-01-26Rollup merge of #106811 - khuey:dwp_extension, r=davidtwcoMatthias Krüger-1/+2
Append .dwp to the binary filename instead of replacing the existing extension. gdb et al. expect to find the dwp file at `<binary>`.dwp, even if <binary> already has an extension (e.g. libfoo.so's dwp is expected to be at libfoo.so.dwp).
2023-01-19Allow for more efficient sorting when exporting Unord collections.Michael Woerister-1/+1
2023-01-19Use UnordMap instead of FxHashMap in define_id_collections!().Michael Woerister-5/+9
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-10/+10
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-10/+10
2023-01-16Append .dwp to the binary filename instead of replacing the existing extension.Kyle Huey-1/+2
gdb et al. expect to find the dwp file at <binary>.dwp, even if <binary> already has an extension (e.g. libfoo.so's dwp is expected to be at libfoo.so.dwp).
2023-01-15Preserve split DWARF files when building archives.Kyle Huey-6/+0
The optimization that removes artifacts when building libraries is correct from the compiler's perspective but not from a debugger's perspective. Unpacked split debuginfo is referred to by filename and debuggers need the artifact that contains debuginfo to continue to exist at that path. Ironically the test expects the correct behavior but it was not running.
2023-01-14Auto merge of #106646 - Amanieu:ilp32-object, r=Mark-Simulacrumbors-1/+7
Fix aarch64-unknown-linux-gnu_ilp32 target This was broken because the synthetic object files produced by rustc were for 64-bit AArch64, which caused link failures when combined with 32-bit ILP32 object files. This PR updates the object crate to 0.30.1 which adds support for generating ILP32 AArch64 object files.
2023-01-13Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3Matthias Krüger-5/+17
riscv: Fix ELF header flags The previous version added both `EF_RISCV_FLOAT_ABI_DOUBLE` and `EF_RISCV_RVC` if the "D" extension was enabled on riscv64 targets. riscv32 targets were not accounted for. This patch changes this so that: - Only add `EF_RISCV_RVC` if the "C" extension is enabled - Add `EF_RISCV_FLOAT_ABI_SINGLE` if the "F" extension is enabled and the "D" extension is not - Add these ELF flags for riscv32 as well Fixes #104284 r? rust-lang/risc-v
2023-01-13Improve linker-flavor detectionJonathan Schwender-1/+10
Linker drivers such as gcc, clang or lld often have a version postfix, e.g clang-12. The previous logic would not account for this and would fall back to guessing the linker flavor to be the default linker flavor for the target, which causes linker errors when this is not the case. By accounting for the possible version postfix and also considering g++ and clang++, we considerably reduce the amount of times the fallback guess has to be used. To simplify matching check for a version postfix and match against the linker stem without any version postfix. In contrast to gcc, clang supports all architectures in one binary. This means there are no variants like `aarch64-linux-gnu-clang` and there is no need to check for `-clang` variants.
2023-01-12riscv: Fix ELF header flagsFawaz-5/+17
The previous version added both `EF_RISCV_FLOAT_ABI_DOUBLE` and `EF_RISCV_RVC` if the "D" extension was enabled on riscv64 targets. riscv32 targets were not accounted for. This patch changes this so that: - Only add `EF_RISCV_RVC` if the "C" extension is enabled - Add `EF_RISCV_FLOAT_ABI_SINGLE` if the "F" extension is enabled and the "D" extension is not - Add these ELF flags for riscv32 as well
2023-01-11Fix some typos in code comments.Cedric-9/+9
2023-01-09Fix aarch64-unknown-linux-gnu_ilp32 targetAmanieu d'Antras-1/+7
This was broken because the synthetic object files produced by rustc were for 64-bit AArch64, which caused link failures when combined with 32-bit ILP32 object files. This PR updates the object crate to 0.30.1 which adds support for generating ILP32 AArch64 object files.
2023-01-07Rollup merge of #104543 - ↵Matthias Krüger-2/+2
JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt3, r=davidtwco Migrate `codegen_ssa` to diagnostics structs - [Part 3] Completes migrating `codegen_ssa` module except 2 outstanding errors that depend on other crates: 1. [`rustc_middle::mir::interpret::InterpError`](https://github.com/rust-lang/rust/blob/b6097f2e1b2ca62e188ba53cf43bd66b06b36915/compiler/rustc_middle/src/mir/interpret/error.rs#L475): I saw `rustc_middle` is unassigned, I am open to take this work. 2. `codegen_llvm`'s use of `fn span_invalid_monomorphization_error`, which I started to replace in the [last commit](https://github.com/rust-lang/rust/commit/9a31b3cdda78a2c0891828254fe9886e0a1cfd16) of this PR, but would like to know the team's preference on how we should keep replacing the other macros: 2.1. Update macros to expect a `Diagnostic` 2.2. Remove macros and expand the code on each use. See [some examples of the different options in this experimental commit](https://github.com/JhonnyBillM/rust/commit/64aee83e80857dcfa450f0c6e31d5f29c6d577e6) _Part 2 - https://github.com/rust-lang/rust/pull/103792_ r? ``@davidtwco`` Cc ``@compiler-errors``
2023-01-04Auto merge of #106224 - bjorn3:staticlib_fixes, r=wesleywiserbors-77/+81
Small fixes for --crate-type staticlib The first commit doesn't have an effect until we start translating error messages. The second commit fixes potential linker errors when combining `--crate-type staticlib` with another crate type and I think `-Cprefer-dynamic`.
2023-01-04Fix each_linked_rlib when the current crate has 0 crate typesbjorn3-0/+3
2023-01-02only specify --target by default for -Zgcc-ld=lld on wasmRémy Rakic-1/+20
On macOS, it's not yet clear which cases of clang/OS/target/SDK version impact how to find ld/lld/rust-lld. The --target is not needed on our current targets with a vanilla config, but may be in some cases. Specifying it all the time breaks the 10.7+ targets on x64 macOS. We try to only specify it on macOS if the linker flavors are different, for possible cases of cross-compilation with `-Zgcc-ld=lld` but the expectation is that it should be passed manually when needed in these situations.
2022-12-28Explicitly pass in which crate type to use to each_linked_rlibbjorn3-76/+76
Otherwise we may pick the dependency formats for say a dylib when linking a staticlib.
2022-12-28Don't translate --print native-static-libs outputbjorn3-1/+2
This breaks tools that depend on the prefix
2022-12-27UPDATE - migrate outstanding diagnostic in link.rsJhonny Bill Mena-2/+2
2022-12-25Rollup merge of #105955 - ↵Matthias Krüger-1/+1
Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses-for-that, r=cjgillot Remove wrapper functions for some unstable options They are trivial and just forward to the option. Like most other options, we can just access it directly.
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-7/+7
2022-12-20Remove wrapper functions for some unstable optionsNilstrieb-1/+1
They are trivial and just forward to the option. Like most other options, we can just access it directly.
2022-12-19Rollup merge of #105864 - matthiaskrgr:compl, r=NilstriebDylan DPC-1/+1
clippy::complexity fixes filter_next needless_question_mark bind_instead_of_map manual_find derivable_impls map_identity redundant_slicing skip_while_next unnecessary_unwrap needless_bool r? `@compiler-errors`
2022-12-19clippy::complexity fixesMatthias Krüger-1/+1
filter_next needless_question_mark bind_instead_of_map manual_find derivable_impls map_identity redundant_slicing skip_while_next unnecessary_unwrap needless_bool
2022-12-18don't restuct references just to reborrowMatthias Krüger-2/+2
2022-12-16don't copy symbols from dylibs with -Zdylib-ltoRémy Rakic-1/+1
2022-12-14Auto merge of #105221 - alex:fat-archive-cleanup, r=bjorn3bors-36/+34
Avoid a temporary file when processing macOS fat archives r? `@bjorn3`
2022-12-08Rollup merge of #105423 - oli-obk:symbols, r=jackh726Matthias Krüger-1/+1
Use `Symbol` for the crate name instead of `String`/`str` It always got converted to a symbol anyway
2022-12-07Use `Symbol` for the crate name instead of `String`/`str`Oli Scherer-1/+1
2022-12-07fix: remove hack from link.rs (moved to libc)Daniil Belov-9/+0
2022-12-03Avoid a temporary file when processing macOS fat archivesAlex Gaynor-36/+34
2022-12-03Auto merge of #97485 - bjorn3:new_archive_writer, r=wesleywiserbors-2/+229
Rewrite LLVM's archive writer in Rust This allows it to be used by other codegen backends. Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1155
2022-12-03Make sure all input archives are unmapped before persisting the output archivebjorn3-1/+7
2022-12-02Write to temp file before renaming to the final namebjorn3-4/+22
2022-11-28Rollup merge of #104360 - petrochenkov:stabverb, r=TaKO8KiDylan DPC-11/+7
Stabilize native library modifier `verbatim` Stabilization report - https://github.com/rust-lang/rust/pull/104360#issuecomment-1312724787. cc https://github.com/rust-lang/rust/issues/81490 Closes https://github.com/rust-lang/rust/issues/99425
2022-11-27Stabilize native library modifier `verbatim`Vadim Petrochenkov-11/+7
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-45/+45