about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
AgeCommit message (Collapse)AuthorLines
2022-09-01rustc_target: Refactor internal linker flavors slightlyVadim Petrochenkov-26/+22
Remove one unstable user-facing linker flavor (l4-bender)
2022-09-01rustc_target: Add a compatibility layer to separate internal and user-facing ↵Vadim Petrochenkov-1/+2
linker flavors
2022-09-01Auto merge of #100707 - dzvon:fix-typo, r=davidtwcobors-1/+1
Fix a bunch of typo This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-31Rollup merge of #100753 - LuisCardosoOliveira:translation-migrate-session, ↵Ralf Jung-1/+1
r=davidtwco translations(rustc_session): migrates `rustc_session` to use `SessionDiagnostic` - Pt. 1 ## Description This is the first PR for the migration of the module `rustc_session`. You can follow my progress [here](https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883). The PR migrates the files `cgu_reuse_tracker` and `parse.rs` to use `SessionDiagnostic `.
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-28Auto merge of #92845 - Amanieu:std_personality, r=Mark-Simulacrumbors-11/+7
Move EH personality functions to std These were previously in the panic_unwind crate with dummy stubs in the panic_abort crate. However it turns out that this is insufficient: we still need a proper personality function even with -C panic=abort to handle the following cases: 1) `extern "C-unwind"` still needs to catch foreign exceptions with -C panic=abort to turn them into aborts. This requires landing pads and a personality function. 2) ARM EHABI uses the personality function when creating backtraces. The dummy personality function in panic_abort was causing backtrace generation to get stuck in a loop since the personality function is responsible for advancing the unwind state to the next frame. Fixes #41004
2022-08-28Fix handling of rust_eh_personality in reachable_non_genericsAmanieu d'Antras-11/+7
2022-08-26translations(rustc_session): migrate check_expected_reuseLuis Cardoso-1/+1
This commit migrates the errors in the function check_expected_reuse to use the new SessionDiagnostic. It also does some small refactor for the IncorrectCguReuseType to include the 'at least' word in the fluent translation file
2022-08-24Rollup merge of #99993 - petrochenkov:linkdated, r=bjorn3Matthias Krüger-18/+18
linker: Update some outdated comments r? ``@bjorn3``
2022-08-19use <[u8]>::escape_ascii instead of core::ascii::escape_defaultKaDiWa-17/+8
2022-08-15errors: move translation logic into moduleDavid Wood-9/+11
Just moving code around so that triagebot can ping relevant parties when translation logic is modified. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-12rustc_target: Update some old naming around self contained linkingVadim Petrochenkov-24/+26
The "fallback" naming pre-dates introduction of `-Clink-self-contained`
2022-08-11Rollup merge of #99500 - tmandry:fuchsia-flags, r=petrochenkovMatthias Krüger-4/+16
Fix flags when using clang as linker for Fuchsia Don't add C runtime or set dynamic linker when linking with clang for Fuchsia. Clang already does this for us.
2022-08-10Fix flags when using clang as linker for FuchsiaTyler Mandry-4/+16
Don't add C runtime or set dynamic linker when linking with clang for Fuchsia. Clang already does this for us.
2022-08-09Add support for link-flavor rust-lld for macOSMary-1/+7
Also refactor iOS, watchOS and tvOS common code.
2022-08-06Change implementation of `-Z gcc-ld` and `lld-wrapper` againVadim Petrochenkov-14/+18
2022-08-05Auto merge of #100035 - workingjubilee:merge-functions, r=nikicbors-2/+5
Enable function merging when opt is for size It is, of course, natural to want to merge aliasing functions when optimizing for code size, since that can eliminate several bytes. And an exhaustive match helps make the code less brittle. Closes #98215.
2022-08-05Enable function merging when opt is for sizeJubilee Young-2/+5
It is, of course, natural to want to merge aliasing functions when optimizing for code size, since that can eliminate several bytes. And an exhaustive match helps make the code less brittle.
2022-08-04Auto merge of #100120 - matthiaskrgr:rollup-g6ycykq, r=matthiaskrgrbors-7/+10
Rollup of 6 pull requests Successful merges: - #98771 (Add support for link-flavor rust-lld for iOS, tvOS and watchOS) - #98835 (relate `closure_substs.parent_substs()` to parent fn in NLL) - #99746 (Use `TraitEngine` in more places that don't specifically need `FulfillmentContext::new_in_snapshot`) - #99786 (Recover from C++ style `enum struct`) - #99795 (Delay a bug when failed to normalize trait ref during specialization) - #100029 (Prevent ICE for `doc_alias` on match arm, statement, expression) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-03Add support for link-flavor rust-lld for iOS, tvOS and watchOSmary-7/+10
This adds support for rust-lld for Apple *OS targets. This was tested against targets "aarch64-apple-ios" and "aarch64-apple-ios-sim". For targets "armv7-apple-ios" and "armv7s-apple-ios", it doesn't link because of "symbols.o" not being generated with the correct CPU subtype (changes in the "object" crate needs to be done to support it).
2022-08-02Fix backwards-compatibility check for tests with `+whole-archive`Daniel Sommermann-1/+1
Fixes #100066
2022-08-01Auto merge of #99944 - bjorn3:hide_proc_macro_symbols, r=eddybbors-6/+6
Limit symbols exported from proc macros Only `__rustc_proc_macro_decls_*__` and `rust_metadata_*` need to be exported for proc macros to work. All other symbols only increase binary size and have the potential to conflict with symbols from the host compiler. Fixes https://github.com/rust-lang/rust/issues/99909 Fixes #59998 cc `@eddyb`
2022-07-31linker: Update some outdated commentsVadim Petrochenkov-18/+18
2022-07-31Rollup merge of #99844 - bjorn3:archive_builder_interface_refactor, r=nagisaDylan DPC-100/+123
Introduce an ArchiveBuilderBuilder This avoids monomorphizing all linker code for each codegen backend and will allow passing in extra information to the archive builder from the codegen backend. I'm going to use this in https://github.com/rust-lang/rust/pull/97485 to allow passing in the right function to extract symbols from object files to a generic archive builder to be used by cg_llvm, cg_clif and cg_gcc.
2022-07-31Add issue referencebjorn3-1/+1
2022-07-30Limit symbols exported from proc macrosbjorn3-6/+6
Only __rustc_proc_macro_decls_*__ and rust_metadata_* need to be exported for proc macros to work. All other symbols only increase binary size and have the potential to conflict with symbols from the host compiler.
2022-07-29Auto merge of #99467 - BelovDV:add_option_link_arg, r=petrochenkovbors-9/+29
flag '-l link-arg=___ was added #99427
2022-07-29Auto merge of #99512 - nikic:llvm-15-fixes, r=cuviperbors-27/+44
LLVM 15 compatibility fixes These are LLVM 15 compatibility fixes split out from #99464. There are three changes here: * Emit elementtype attribtue for ldrex/strex intrinsics. This is requires as part of the opaque pointers migration. * Make more tests compatible with opaque pointers. These are either new or aren't run on x86. * Remove a test for `#[rustc_allocator]`. Since #99574 there are more requirement on the function signature. I dropped the test entirely, since we already test the effect of the attribute elsewhere. * The main change: When a worker thread emits an error, wait for other threads to finish before unwinding the main thread and exiting. Otherwise workers may end up using globals for which destructors have already been run. This was probably never quite correct, but became an active problem with LLVM 15, because it started using global dtors in critical places, as part of ManagedStatic removal. Fixes #99432 (and probably also #95679). r? `@cuviper`
2022-07-28fix: remove fake no_dead_strip for osxcsmoe-3/+1
2022-07-28Introduce an ArchiveBuilderBuilderbjorn3-75/+124
This avoids monomorphizing all linker code for each codegen backend and will allow passing in extra information to the archive builder from the codegen backend.
2022-07-28Inline inject_dll_import_libbjorn3-24/+6
2022-07-28Move output argument from ArchiveBuilder::new to .build()bjorn3-19/+11
2022-07-27Also wait on other threads if a WorkerFatalError occursNikita Popov-5/+5
This means that codegen_aborted may be set when new codegen requests arrive, so drop some related assertions. The new work will simply be ignored.
2022-07-27Reliably signal coordinator thread on panic during ongoing codegenNikita Popov-22/+39
Replace the separate AbortCodegenOnDrop guard by integrating this functionality into OngoingCodegen (or rather, the Coordinator part of it). This ensures that we send a CodegenAborted message and wait for workers to finish even if the panic occurs outside codegen_crate() (e.g. inside join_codegen()). This requires some minor changes to the handling of CodegenAborted, as it can now occur when the main thread is LLVMing rather than Codegenning.
2022-07-26Lib kind -l link-arg:Daniil Belov-9/+29
arbitrary link argument like -C link-arg, but respecting relative order to other `-l` options, unstable
2022-07-26Auto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoeristerbors-8/+48
Enable raw-dylib for bin crates Fixes #93842 When `raw-dylib` is used in a `bin` crate, we need to collect all of the `raw-dylib` functions, generate the import library and add that to the linker command line. I also changed the tests so that 1) the C++ dlls are created after the Rust dlls, thus there is no chance of accidentally using them in the Rust linking process and 2) disabled generating import libraries when building with MSVC.
2022-07-25feat: impl export-executable-symbolscsmoe-5/+19
2022-07-22Enable raw-dylib for binariesDaniel Paoliello-8/+48
2022-07-21Auto merge of #98162 - nextsilicon:support_lto_embed_bitcode, r=davidtwcobors-0/+2
Allow to disable thinLTO buffer to support lto-embed-bitcode lld feature Hello This change is to fix issue (https://github.com/rust-lang/rust/issues/84395) in which passing "-lto-embed-bitcode=optimized" to lld when linking rust code via linker-plugin-lto doesn't produce the expected result. Instead of emitting a single unified module into a llvmbc section of the linked elf, it emits multiple submodules. This is caused because rustc emits the BC modules after running llvm `createWriteThinLTOBitcodePass` pass. Which in turn triggers a thinLTO linkage and causes the said issue. This patch allows via compiler flag (-Cemit-thin-lto=<bool>) to select between running `createWriteThinLTOBitcodePass` and `createBitcodeWriterPass`. Note this pattern of selecting between those 2 passes is common inside of LLVM code. The default is to match the old behavior.
2022-07-14Auto merge of #96544 - m-ysk:feature/issue-96358, r=cjgillotbors-22/+3
Stop keeping metadata in memory before writing it to disk Fixes #96358 I created this PR according with the instruction given in the issue except for the following points: - While the issue says "Write metadata into the temporary file in `encode_and_write_metadata` even if `!need_metadata_file`", I could not do that. That is because though I tried to do that and run `x.py test`, I got a lot of test failures as follows. <details> <summary>List of failed tests</summary> <pre> <code> failures: [ui] src/test/ui/json-multiple.rs [ui] src/test/ui/json-options.rs [ui] src/test/ui/rmeta/rmeta-rpass.rs [ui] src/test/ui/save-analysis/emit-notifications.rs [ui] src/test/ui/svh/changing-crates.rs [ui] src/test/ui/svh/svh-change-lit.rs [ui] src/test/ui/svh/svh-change-significant-cfg.rs [ui] src/test/ui/svh/svh-change-trait-bound.rs [ui] src/test/ui/svh/svh-change-type-arg.rs [ui] src/test/ui/svh/svh-change-type-ret.rs [ui] src/test/ui/svh/svh-change-type-static.rs [ui] src/test/ui/svh/svh-use-trait.rs test result: FAILED. 12915 passed; 12 failed; 100 ignored; 0 measured; 0 filtered out; finished in 71.41s Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu Build completed unsuccessfully in 0:01:58 </code> </pre> </details> - I could not resolve the extra tasks about `create_rmeta_file` and `create_compressed_metadata_file` for my lack of ability.
2022-07-14rustc: add ability to output regular LTO bitcode modulesZiv Dunkelman-0/+2
Adding the option to control from rustc CLI if the resulted ".o" bitcode module files are with thinLTO info or regular LTO info. Allows using "-lto-embed-bitcode=optimized" during linkage correctly. Signed-off-by: Ziv Dunkelman <ziv.dunkelman@nextsilicon.com>
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-39/+38
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-08Auto merge of #98638 - bjorn3:less_string_interning, r=tmiaskobors-60/+55
Use less string interning This removes string interning in a couple of places where doing so won't result in perf improvements. I also switched one place to use pre-interned symbols.
2022-07-06ssa: abort if dwarf packaging failsDavid Wood-0/+1
This should have been here from the start... oops. When `thorin` fails to package a DWARF package, that should fail compilation.
2022-07-06ssa: remove dwo of metadata and allocator moduleDavid Wood-14/+18
Compiling with `-Csplit-debuginfo=packed` was leaving behind `.dwo` files because either the metadata or allocator module contained a DWARF object which was not being removed by the `maybe_remove_temps_from_module` closure.
2022-07-06incr: cache dwarf objects in work productsDavid Wood-24/+51
Cache DWARF objects alongside object files in work products when those exist so that DWARF object files are available for thorin in packed mode in incremental scenarios. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-02import all necessary parts of rustc_metadata::fsYoshiki Matsuda-3/+4
2022-07-02fix a typoYoshiki Matsuda-1/+1
2022-07-02move emit_metadata to rustc_metadata::fsYoshiki Matsuda-26/+6
2022-06-28Reduce usage of Symbol in the linker codebjorn3-60/+55
Interning here doesn't save us anything. It rather costs a bit of time.