summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
AgeCommit message (Collapse)AuthorLines
2022-12-26don't copy symbols from dylibs with -Zdylib-ltoRémy Rakic-1/+1
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-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
2022-11-04UPDATE - address PR CommentsJhonny Bill Mena-39/+20
FIX - StrippingDebugInfoFailed typo DELETE - unneeded FIXME comment UPDATE - only declare the error with ExtractBundledLibsError as an enum and use the Diagnostic derive macro
2022-11-04FIX - Migrate missing errors in link.rsJhonny Bill Mena-4/+4
2022-11-04ADD - ExtractBundledLibsError. Migrated extract_bundled_libs to translatable ↵Jhonny Bill Mena-19/+42
diagnostics
2022-11-04UPDATE - Complete link.rs migration to new diagnostics infraestructureJhonny Bill Mena-80/+43
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-2/+5
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-10-24Support raw-dylib functions being used inside inlined functionsDaniel Paoliello-5/+37
2022-10-23Introduce dedicated `-Zdylib-lto` flag for enabling LTO on `dylib`sJakub Beránek-4/+9
2022-10-23Allow LTO for dylibsbjorn3-11/+29
2022-10-23Add missing export for the oom strategy symbolbjorn3-1/+10
2022-10-22Auto merge of #103240 - BelovDV:issue-102290, r=petrochenkovbors-0/+4
Add architectures to fn create_object_file Fixes #102290 r? `@petrochenkov`
2022-10-22Auto merge of #103196 - Nilstrieb:no-meta-query, r=cjgillotbors-1/+1
Get rid of native_library projection queries They don't seem particularly useful as I don't expect native libraries to change frequently. Maybe they do provide significant value of keeping incremental compilation green though, I'm not sure.
2022-10-20Auto merge of #103092 - petrochenkov:weaklto, r=wesleywiserbors-1/+1
linker: Fix weak lang item linking with combination windows-gnu + LLD + LTO In https://github.com/rust-lang/rust/pull/100404 this logic was originally disabled for MSVC due to issues with LTO, but the same issues appear on windows-gnu with LLD because that LLD uses the same underlying logic as MSVC LLD, just with re-syntaxed command line options. So this PR just disables it for LTO builds in general.
2022-10-19Get rid of native_library projection queriesnils-1/+1
They don't seem particularly useful as I don't expect native libraries to change frequently.
2022-10-19Add architectures to fn create_object_fileDaniil Belov-0/+4
2022-10-18Auto merge of #102418 - citrus-it:illumos-strip-debug, r=nagisabors-9/+40
The illumos linker does not support --strip-debug When building and testing rust 1.64.0 on illumos, we saw a large number of failing tests associated with: ``` = note: ld: fatal: unrecognized option '--strip-debug' ld: fatal: use the -z help option for usage information collect2: error: ld returned 1 exit status ``` The illumos linker does not support the `--strip-debug` option (although it does support `--strip-all`).
2022-10-15linker: Fix weak lang item linking with combination windows-gnu + LLD + LTOVadim Petrochenkov-1/+1
2022-10-15The illumos linker does not support --strip-debugAndy Fiddaman-9/+40
2022-10-12Rollup merge of #102623 - davidtwco:translation-eager, r=compiler-errorsDylan DPC-2/+5
translation: eager translation Part of #100717. See [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20lists!/near/295010720) for additional context. - **Store diagnostic arguments in a `HashMap`**: Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`. - **Add `AddToDiagnostic::add_to_diagnostic_with`**: `AddToDiagnostic::add_to_diagnostic_with` is similar to the previous `AddToDiagnostic::add_to_diagnostic` but takes a function that can be used by the caller to modify diagnostic messages originating from the subdiagnostic (such as performing translation eagerly). `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an empty closure. - **Add `DiagnosticMessage::Eager`**: Add variant of `DiagnosticMessage` for eagerly translated messages (messages in the target language which don't need translated by the emitter during emission). Also adds `eager_subdiagnostic` function which is intended to be invoked by the diagnostic derive for subdiagnostic fields which are marked as needing eager translation. - **Support `#[subdiagnostic(eager)]`**: Add support for `eager` argument to the `subdiagnostic` attribute which generates a call to `eager_subdiagnostic`. - **Finish migrating `rustc_query_system`**: Using eager translation, migrate the remaining repeated cycle stack diagnostic. - **Split formatting initialization and use in diagnostic derives**: Diagnostic derives have previously had to take special care when ordering the generated code so that fields were not used after a move. This is unlikely for most fields because a field is either annotated with a subdiagnostic attribute and is thus likely a `Span` and copiable, or is a argument, in which case it is only used once by `set_arg` anyway. However, format strings for code in suggestions can result in fields being used after being moved if not ordered carefully. As a result, the derive currently puts `set_arg` calls last (just before emission), such as: let diag = { /* create diagnostic */ }; diag.span_suggestion_with_style( span, fluent::crate::slug, format!("{}", __binding_0), Applicability::Unknown, SuggestionStyle::ShowAlways ); /* + other subdiagnostic additions */ diag.set_arg("foo", __binding_0); /* + other `set_arg` calls */ diag.emit(); For eager translation, this doesn't work, as the message being translated eagerly can assume that all arguments are available - so arguments _must_ be set first. Format strings for suggestion code are now separated into two parts - an initialization line that performs the formatting into a variable, and a usage in the subdiagnostic addition. By separating these parts, the initialization can happen before arguments are set, preserving the desired order so that code compiles, while still enabling arguments to be set before subdiagnostics are added. let diag = { /* create diagnostic */ }; let __code_0 = format!("{}", __binding_0); /* + other formatting */ diag.set_arg("foo", __binding_0); /* + other `set_arg` calls */ diag.span_suggestion_with_style( span, fluent::crate::slug, __code_0, Applicability::Unknown, SuggestionStyle::ShowAlways ); /* + other subdiagnostic additions */ diag.emit(); - **Remove field ordering logic in diagnostic derive:** Following the approach taken in earlier commits to separate formatting initialization from use in the subdiagnostic derive, simplify the diagnostic derive by removing the field-ordering logic that previously solved this problem. r? ```@compiler-errors```
2022-10-10errors: use `HashMap` to store diagnostic argsDavid Wood-2/+5
Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-07ADD - implement IntoDiagnostic for thorin::Error wrapperJhonny Bill Mena-2/+1
2022-10-07Address PR commentsJhonny Bill Mena-11/+5
- UPDATE - revert migration of logs - UPDATE - use derive on LinkRlibError enum - [Gardening] UPDATE - alphabetically sort fluent_messages - UPDATE - use PathBuf and unify both AddNativeLibrary to use Display (which is what PathBuf uses when conforming to IntoDiagnosticArg) - UPDATE - fluent messages sort after rebase