about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
AgeCommit message (Collapse)AuthorLines
2022-08-29Simplify get_trait_ref a bitMichael Goulet-11/+7
2022-08-28Support `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`Martin Nordholts-6/+10
This makes it possible to instruct libstd to never touch the signal handler for `SIGPIPE`, which makes programs pipeable by default (e.g. with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe` errors.
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-27Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3bors-27/+23
Shrink `FnAbi` Because they can take up a lot of memory in debug and release builds. r? `@bjorn3`
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-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-7/+7
2022-08-26Move `ArgAbi::pad_i32` into `PassMode::Cast`.Nicholas Nethercote-22/+18
Because it's only needed for that variant. This shrinks the types and clarifies the logic.
2022-08-26Turn `ArgAbi::pad` into a `bool`.Nicholas Nethercote-5/+5
Because it's only ever set to `None` or `Some(Reg::i32())`.
2022-08-26Box `CastTarget` within `PassMode`.Nicholas Nethercote-6/+6
Because `PassMode::Cast` is by far the largest variant, but is relatively rare. This requires making `PassMode` not impl `Copy`, and `Clone` is no longer necessary. This causes lots of sigil adjusting, but nothing very notable.
2022-08-25Code cleaningAdrian Tombu-6/+6
2022-08-25Replace spaghetti with a simple errors enumAdrian Tombu-59/+16
2022-08-25Start adding enum errors for deserialize_rlinkAdrian Tombu-7/+61
2022-08-24Remove LLVM ARM bug workaroundMichael Benfield-11/+0
This memset was inserted as a workaround to Rust issue #34427, which was an LLVM bug that apparently no longer manifests.
2022-08-24Rollup merge of #99993 - petrochenkov:linkdated, r=bjorn3Matthias Krüger-18/+18
linker: Update some outdated comments r? ``@bjorn3``
2022-08-22Refactor part of codegen_call_terminatorEric Holk-47/+44
2022-08-19use <[u8]>::escape_ascii instead of core::ascii::escape_defaultKaDiWa-17/+8
2022-08-19Rollup merge of #100208 - RalfJung:dyn-upcast-nop, r=petrochenkovDylan DPC-0/+1
make NOP dyn casts not require anything about the vtable As suggested [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/dyn-upcasting.20stabilization/near/292151439). This matches what the codegen backends already do, and what Miri did do until https://github.com/rust-lang/rust/pull/99420 when I made it super extra paranoid.
2022-08-17Rollup merge of #100379 - davidtwco:triagebot-diag, r=Mark-SimulacrumMatthias Krüger-9/+11
triagebot: add translation-related mention groups - Move some code around so that triagebot can ping relevant parties when translation logic is modified. - Add mention groups to triagebot for translation-related files/folders. - Auto-label pull requests with changes to translation-related files/folders with `A-translation`. r? `@Mark-Simulacrum`
2022-08-16Move the cast_float_to_int fallback code to GCCJosh Stone-155/+3
Now that we require at least LLVM 13, that codegen backend is always using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it doesn't need the manual implementation. However, the GCC backend still needs it, so we can move all of that code down there.
2022-08-15Rollup merge of #100528 - tux3:riscv-bitmanip-features, r=davidtwcoMatthias Krüger-0/+4
Support 1st group of RISC-V Bitmanip backend target features These target features use the same names as LLVM and `is_riscv_feature_detected!`, they are: - zba (address generation instructions) - zbb (basic bit manipulation) - zbc (carry-less multiplication) - zbs (single-bit manipulation) The extension is frozen and ratified, and I don't think we should expect LLVM to change those feature names in the future. For reference, the specification for the B extension can be found here: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf) On my current project, I see a 7.6% reduction in binary size with these features on, so I have some incentive to try to silence the "unknown feature" warning from `-Ctarget-feature` =)
2022-08-15Auto merge of #98393 - michaelwoerister:new-cpp-like-enum-debuginfo, ↵bors-50/+6
r=wesleywiser debuginfo: Generalize C++-like encoding for enums. The updated encoding should be able to handle niche layouts where more than one variant has fields (as introduced in https://github.com/rust-lang/rust/pull/94075). The new encoding is more uniform as there is no structural difference between direct-tag, niche-tag, and no-tag layouts anymore. The only difference between those cases is that the "dataful" variant in a niche-tag enum will have a `(start, end)` pair denoting the tag range instead of a single value. The new encoding now also supports 128-bit tags, which occur in at least some standard library types. These tags are represented as `u64` pairs so that debuggers (which don't always have support for 128-bit integers) can reliably deal with them. The downside is that this adds quite a bit of complexity to the encoding and especially to the corresponding NatVis. The new encoding seems to increase the size of (x86_64-pc-windows-msvc) debuginfo by 10-15%. The size of binaries is not affected (release builds were built with `-Cdebuginfo=2`, numbers are in kilobytes): EXE | before | after | relative -- | -- | -- | -- cargo (debug) | 40453 | 40450 | +0% ripgrep (debug) | 10275 | 10273 | +0% cargo (release) | 16186 | 16185 | +0% ripgrep (release) | 4727 | 4726 | +0% PDB | before | after | relative -- | -- | -- | -- cargo (debug) | 236524 | 261412 | +11% ripgrep (debug) | 53140 | 59060 | +11% cargo (release) | 148516 | 169620 | +14% ripgrep (release) | 10676 | 11804 | +11% Given that the new encoding is more general, this is to be expected. Only platforms using C++-like debuginfo are affected -- which currently is only `*-pc-windows-msvc`. *TODO* - [x] Properly update documentation - [x] Add regression tests for new optimized enum layouts as introduced by #94075. r? `@wesleywiser`
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-14feat: Target features for 1st group of RISC-V Bitmanip extensionstux3-0/+4
These use the same names as LLVM and is_riscv_feature_detected!: - zba (address generation instructions) - zbb (basic bit manipulation) - zbc (carry-less multiplication) - zbs (single-bit manipulation)
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-12Use enum2<_> instead of enum<_> for Cpp-like debuginfo enum type names.Michael Woerister-2/+2
And add more comments about niche tag enum encoding.
2022-08-12debuginfo: Change C++-like encoding for enums.Michael Woerister-48/+4
The updated encoding should be able to handle niche layouts where more than one variant has fields.
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-06make NOP dyn casts not require anything about the vtableRalf Jung-0/+1
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-81/+48
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-76/+43
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.