about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
AgeCommit message (Collapse)AuthorLines
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
2022-11-26Rewrite LLVM's archive writer in Rustbjorn3-2/+205
This allows it to be used by other codegen backends
2022-11-24rustc_codegen_ssa: write `.dwp` in a streaming fashionWeihang Lo-4/+5
2022-11-19Rollup merge of #104001 - Ayush1325:custom-entry, r=bjorn3Dylan DPC-1/+2
Improve generating Custom entry function This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316. Currently, this moves the entry function name and Call convention to the target spec. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-14Issue error when `-C link-self-contained` option is used on unsupported ↵StackDoubleFlow-0/+3
platforms Document supported targets for `-C link-self-contained` Move `LinkSelfContainedDefault::True` from wasm_base to wasm32_wasi
2022-11-15Auto merge of #104091 - BelovDV:issue-103044, r=petrochenkovbors-15/+31
Wrap bundled static libraries into object files Fixes #103044 (not sure, couldn't test locally) Bundled static libraries should be wrapped into object files as it's done for metadata file. r? `@petrochenkov`
2022-11-14Wrap bundlen static libraries into object filesDaniil Belov-15/+31
2022-11-12linker: Link `profiler_builtins` even if it's marked as `NotLinked`Vadim Petrochenkov-3/+4
2022-11-12linker: Support mixing crates built with different values of ↵Vadim Petrochenkov-9/+7
`-Zpacked_bundled_libs` So you can change the value of `-Zpacked_bundled_libs` without rebuilding standard library
2022-11-12linker: Move some inner functions to the outsideVadim Petrochenkov-133/+127
Inline `fn unlib`
2022-11-12linker: Simplify linking of `compiler_builtins` and `profiler_builtins`Vadim Petrochenkov-68/+33
This also fixes linking of native libraries bundled into these crates when `-Zpacked-bundled-libs` is enabled
2022-11-12linker: Factor out native library linking to a separate functionVadim Petrochenkov-213/+207
2022-11-11Rollup merge of #102215 - alexcrichton:wasm-link-whole-archive, r=estebankManish Goregaokar-2/+2
Implement the `+whole-archive` modifier for `wasm-ld` This implements the `Linker::{link_whole_staticlib,link_whole_rlib}` methods for the `WasmLd` linker used on wasm targets. Previously these methods were noops since I think historically `wasm-ld` did not have support for `--whole-archive` but nowadays it does, so the flags are passed through.
2022-11-11Improve generating Custom entry functionAyush Singh-1/+2
This commit is aimed at making compiler generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316. Currently, this moves the entry function name and Call convention to the target spec. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-09Add constructor for `Diagnostic` that takes `Vec<(DiagnosticMessage, Style)>`SLASHLogin-2/+1
2022-11-09Add `replace_args` method for `rustc_errors::diagnostic::Diagnostic`SLASHLogin-3/+1
2022-11-09Delay diagnostic translation in `rustc_codegen_ssa`SLASHLogin-9/+18
2022-11-05Rollup merge of #103660 - ozkanonur:master, r=jyn514Dylan DPC-1/+2
improve `filesearch::get_or_default_sysroot` `fn get_or_default_sysroot` is now improved and used in `miri` and `clippy`, and tests are still passing as they should. So we no longer need to implement custom workarounds/hacks to find sysroot in tools like miri/clippy. Resolves https://github.com/rust-lang/rust/issues/98832 re-opened from #103581
2022-11-04improve `filesearch::get_or_default_sysroot` r=ozkanonurOnur Özkan-1/+2
Signed-off-by: Onur Özkan <work@onurozkan.dev>
2022-11-04UPDATE - accept dyn error and make Box<dyn error> conform to IntoDiagnosticArgJhonny Bill Mena-15/+14