summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
AgeCommit message (Collapse)AuthorLines
2022-05-10Fix e_flags for 32-bit MIPS targets in generated object fileAyrton-10/+18
In #95604 the compiler started generating a temporary symbols.o which is added to the linker invocation. This object file has an `e_flags` which may be invalid for 32-bit MIPS targets. Even though symbols.o doesn't contain code, linking with [lld fails](https://github.com/llvm/llvm-project/blob/main/lld/ELF/Arch/MipsArchTree.cpp#L79) with ``` rust-lld: error: foo-cgu.0.rcgu.o: ABI 'o32' is incompatible with target ABI 'n64' ``` because it omits the ABI bits (EF_MIPS_ABI_O32) so lld assumes it's using the N64 ABI. This breaks linking on nightly for the out-of-tree [psx target](https://github.com/ayrtonm/psx-sdk-rs/issues/9), the builtin mipsel-sony-psp target (cc @overdrivenpotato) and any other 32-bit MIPS target using lld. This PR sets the ABI in `e_flags` to O32 since that's the only ABI for 32-bit MIPS that LLVM supports. It also sets other `e_flags` bits based on the target. I had to bump the object crate version since some of these constants were [added recently](https://github.com/gimli-rs/object/pull/433). I'm not sure if this PR needs a test, but I can confirm that it fixes the linking issue on both targets I mentioned.
2022-05-03Add support for a new attribute `#[debugger_visualizer]` to support ↵ridwanabdillahi-10/+64
embedding debugger visualizers into a generated PDB. Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries. Merge the queries for debugger visualizers into a single query. Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`. Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate. Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature. Respond to PR comments and minor cleanups.
2022-05-03Rollup merge of #96587 - bjorn3:refactor_backend_write, r=michaelwoeristerYuki Okushi-11/+7
Refactor the WriteBackendMethods and ExtraBackendMethods traits The new interface is slightly less confusing and is easier to implement for non-LLVM backends.
2022-05-02Auto merge of #96436 - petrochenkov:nowhole2, r=wesleywiserbors-44/+8
linker: Stop using whole-archive on dependencies of dylibs https://github.com/rust-lang/rust/pull/95604 implemented a better and more fine-grained way of keeping exported symbols alive. Addresses the second question from https://github.com/rust-lang/rust/pull/93901#issuecomment-1041325522. r? `@wesleywiser`
2022-04-30Merge new_metadata into codegen_allocatorbjorn3-3/+1
2022-04-30Remove config parameter of optimize_fat and avoid interior mutability for modulebjorn3-3/+2
2022-04-30Let LtoModuleCodegen::optimize take self by valuebjorn3-8/+7
2022-04-28Add `@feat.00` symbol to symbols.o for COFFGary Guo-0/+23
2022-04-27Use decorated names for linked_symbols on WindowsGary Guo-2/+76
2022-04-26linker: Generate `symbols.o` for dylibsVadim Petrochenkov-2/+2
2022-04-26linker: Stop using whole-archive on dependencies of dylibsVadim Petrochenkov-42/+6
https://github.com/rust-lang/rust/pull/95604 implemented a better and more fine-grained way of keeping exported symbols alive.
2022-04-25Auto merge of #95604 - nbdd0121:used2, r=petrochenkovbors-56/+231
Generate synthetic object file to ensure all exported and used symbols participate in the linking Fix #50007 and #47384 This is the synthetic object file approach that I described in https://github.com/rust-lang/rust/pull/95363#issuecomment-1079932354, allowing all exported and used symbols to be linked while still allowing them to be GCed. Related #93791, #95363 r? `@petrochenkov` cc `@carbotaniuman`
2022-04-25Stop exporting rust_eh_personality and friends from cdylibGary Guo-15/+9
2022-04-24Fix MSVC hang issueGary Guo-0/+6
2022-04-21Auto merge of #95612 - davidtwco:split-debuginfo-in-bootstrap, r=Mark-Simulacrumbors-1/+1
bootstrap: add split-debuginfo config Replace `run-dysutil` option with more general `split-debuginfo` option that works on all platforms. r? `@Mark-Simulacrum`
2022-04-18Conditionally export msan symbols only if they are definedGary Guo-2/+10
* `__msan_keep_going` is defined when `-Zsanitizer-recover=memory`. * `__msan_track_origins` is defined when `-Zsanitizer-memory-track-origins`.
2022-04-18Refactor exported_symbols and linked_symbols for code reuseGary Guo-44/+26
2022-04-18Synthesis object file for `#[used]` and exported symbolsGary Guo-8/+163
2022-04-18Add `SymbolExportInfo`Gary Guo-21/+51
This is currently a wrapper to `SymbolExportLevel` but it allows later addition of extra information.
2022-04-18ssa: don't pack debuginfo on windows not only msvcDavid Wood-1/+1
Small fix that prevents `thorin` from running on platforms where it definitely shouldn't be running. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-17Stop using CRATE_DEF_INDEX.Camille GILLOT-15/+2
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-13errors: lazily load fallback fluent bundleDavid Wood-1/+1
Loading the fallback bundle in compilation sessions that won't go on to emit any errors unnecessarily degrades compile time performance, so lazily create the Fluent bundle when it is first required. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-08check_doc_keyword: don't alloc string for emptiness checkklensy-2/+2
check_doc_alias_value: get argument as Symbol to prevent needless string convertions check_doc_attrs: don't alloc vec, iterate over slice. Vec introduced in #83149, but no perf run posted on merge replace as_str() check with symbol check get_single_str_from_tts: don't prealloc string trivial string to str replace LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String> AssertModuleSource use BTreeSet<Symbol> instead of BTreeSet<String> CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
2022-04-05errors: implement fallback diagnostic translationDavid Wood-5/+15
This commit updates the signatures of all diagnostic functions to accept types that can be converted into a `DiagnosticMessage`. This enables existing diagnostic calls to continue to work as before and Fluent identifiers to be provided. The `SessionDiagnostic` derive just generates normal diagnostic calls, so these APIs had to be modified to accept Fluent identifiers. In addition, loading of the "fallback" Fluent bundle, which contains the built-in English messages, has been implemented. Each diagnostic now has "arguments" which correspond to variables in the Fluent messages (necessary to render a Fluent message) but no API for adding arguments has been added yet. Therefore, diagnostics (that do not require interpolation) can be converted to use Fluent identifiers and will be output as before.
2022-04-05errors: introduce `DiagnosticMessage`David Wood-2/+2
Introduce a `DiagnosticMessage` type that will enable diagnostic messages to be simple strings or Fluent identifiers. `DiagnosticMessage` is now used in the implementation of the standard `DiagnosticBuilder` APIs. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-04Auto merge of #95606 - petrochenkov:linkregr, r=wesleywiserbors-1/+6
linker: Implicitly link native libs as whole-archive in some more cases Partially revert changes from https://github.com/rust-lang/rust/pull/93901 to address regressions like https://github.com/rust-lang/rust/issues/95561. Fixes https://github.com/rust-lang/rust/issues/95561 r? `@wesleywiser`
2022-04-03Cleanup after some refactoring in rustc_targetLoïc BRANSTETT-3/+3
2022-04-03Replace LinkArgs with Cow<'static, str>Loïc BRANSTETT-5/+6
2022-04-03Replace every Vec in Target(Options) with it's Cow equivalentLoïc BRANSTETT-2/+2
2022-04-03Replace every `String` in Target(Options) with `Cow<'static, str>`Loïc BRANSTETT-12/+12
2022-04-03linker: Implicitly link native libs as whole-archive in some more casesVadim Petrochenkov-1/+6
2022-03-31Rollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errorsDylan DPC-1/+1
Spellchecking compiler comments This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30Stabilize native library modifier syntax and the `whole-archive` modifier ↵Vadim Petrochenkov-41/+73
specifically
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30Spellchecking some commentsYuri Astrakhan-4/+4
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-20Take &mut Diagnostic in emit_diagnostic.Camille GILLOT-1/+1
Taking a Diagnostic by move would break the usual pattern `diag.label(..).emit()`.
2022-03-03Rollup merge of #94433 - Urgau:check-cfg-allowness, r=petrochenkovDylan DPC-1/+2
Improve allowness of the unexpected_cfgs lint This pull-request improve the allowness (`#[allow(...)]`) of the `unexpected_cfgs` lint. Before this PR only crate level `#![allow(unexpected_cfgs)]` worked, now with this PR it also work when put around `cfg!` or if it is in a upper level. Making it work ~for the attributes `cfg`, `cfg_attr`, ...~ for the same level is awkward as the current code is design to give "Some parent node that is close to this macro call" (cf. https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/struct.ExpansionData.html) meaning that allow on the same line as an attribute won't work. I'm note even sure if this would be possible. Found while working on https://github.com/rust-lang/rust/pull/94298. r? ````````@petrochenkov````````
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-01Improve allowness of the unexpected_cfgs lintLoïc BRANSTETT-1/+2
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.