about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
AgeCommit message (Collapse)AuthorLines
2025-07-11Auto merge of #142911 - mejrs:unsized, r=compiler-errorsbors-4/+0
Remove support for dynamic allocas Followup to rust-lang/rust#141811
2025-07-09Add opaque TypeId handles for CTFEOli Scherer-2/+8
2025-07-07Remove support for dynamic allocasmejrs-4/+0
2025-07-07Auto merge of #143601 - matthiaskrgr:rollup-9iw2sqk, r=matthiaskrgrbors-1/+0
Rollup of 9 pull requests Successful merges: - rust-lang/rust#132469 (Do not suggest borrow that is already there in fully-qualified call) - rust-lang/rust#143340 (awhile -> a while where appropriate) - rust-lang/rust#143438 (Fix the link in `rustdoc.md`) - rust-lang/rust#143539 (Regression tests for repr ICEs) - rust-lang/rust#143566 (Fix `x86_64-unknown-netbsd` platform support page) - rust-lang/rust#143572 (Remove unused allow attrs) - rust-lang/rust#143583 (`loop_match`: fix 'no terminator on block') - rust-lang/rust#143584 (make `Machine::load_mir` infallible) - rust-lang/rust#143591 (Fix missing words in future tracking issue) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-07Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubileebors-5/+5
Allow custom default address spaces and parse `p-` specifications in the datalayout string Some targets, such as CHERI, use as default an address space different from the "normal" default address space `0` (in the case of CHERI, [200 is used](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-877.pdf)). Currently, `rustc` does not allow to specify custom address spaces and does not take into consideration [`p-` specifications in the datalayout string](https://llvm.org/docs/LangRef.html#langref-datalayout). This patch tries to mitigate these problems by allowing targets to define a custom default address space (while keeping the default value to address space `0`) and adding the code to parse the `p-` specifications in `rustc_abi`. The main changes are that `TargetDataLayout` now uses functions to refer to pointer-related informations, instead of having specific fields for the size and alignment of pointers in the default address space; furthermore, the two `pointer_size` and `pointer_align` fields in `TargetDataLayout` are replaced with an `FxHashMap` that holds info for all the possible address spaces, as parsed by the `p-` specifications. The potential performance drawbacks of not having ad-hoc fields for the default address space will be tested in this PR's CI run. r? workingjubilee
2025-07-07Remove unused allow attrsYotam Ofek-1/+0
2025-07-07compiler: Parse `p-` specs in datalayout string, allow definition of custom ↵Edoardo Marangoni-5/+5
default data address space
2025-07-05Make tempfile a normal dependencyDiggory Blake-5/+3
2025-07-05Use `object` crate from crates.io to fix windows build errorDiggory Blake-1/+11
2025-07-03Make __rust_alloc_error_handler_should_panic a functionDaniel Paoliello-11/+33
2025-06-30Auto merge of #143254 - matthiaskrgr:rollup-7x8bxek, r=matthiaskrgrbors-1/+1
Rollup of 9 pull requests Successful merges: - rust-lang/rust#143019 (Ensure -V --verbose processes both codegen_backend and codegen-backend) - rust-lang/rust#143140 (give Pointer::into_parts a more scary name and offer a safer alternative) - rust-lang/rust#143175 (Make combining LLD with external LLVM config a hard error) - rust-lang/rust#143180 (Use `tracing-forest` instead of `tracing-tree` for bootstrap tracing) - rust-lang/rust#143223 (Improve macro stats printing) - rust-lang/rust#143228 (Handle build scripts better in `-Zmacro-stats` output.) - rust-lang/rust#143229 ([COMPILETEST-UNTANGLE 1/N] Move some some early config checks to the lib and move the compiletest binary) - rust-lang/rust#143246 (Subtree update of `rust-analyzer`) - rust-lang/rust#143248 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-30Rollup merge of #143140 - RalfJung:ptr-into-parts, r=oli-obkMatthias Krüger-1/+1
give Pointer::into_parts a more scary name and offer a safer alternative `into_parts` is a bit too innocent of a name for a somewhat subtle operation. r? `@oli-obk`
2025-06-30Auto merge of #143239 - GuillaumeGomez:subtree-update_cg_gcc_2025-06-30, ↵bors-171/+131
r=GuillaumeGomez GCC backend subtree update cc `@antoyo` r? ghost
2025-06-30Merge commit '4b5c44b14166083eef8d71f15f5ea1f53fc976a0' into ↵Guillaume Gomez-171/+131
subtree-update_cg_gcc_2025-06-30
2025-06-30Stop backends from needing to support nullary intrinsicsOli Scherer-4/+5
2025-06-29Rollup merge of #142078 - sayantn:more-intrinsics, r=workingjubileeGuillaume Gomez-0/+2
Add SIMD funnel shift and round-to-even intrinsics This PR adds 3 new SIMD intrinsics - `simd_funnel_shl` - funnel shift left - `simd_funnel_shr` - funnel shift right - `simd_round_ties_even` (vector version of `round_ties_even_fN`) TODO (future PR): implement `simd_fsh{l,r}` in miri, cg_gcc and cg_clif (it is surprisingly hard to implement without branches, the common tricks that rotate uses doesn't work because we have 2 elements now. e.g, the `-n&31` trick used by cg_gcc to implement rotate doesn't work with this because then `fshl(a, b, 0)` will be `a | b`) [#t-compiler > More SIMD intrinsics](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/More.20SIMD.20intrinsics/with/522130286) `@rustbot` label T-compiler T-libs A-intrinsics F-core_intrinsics r? `@workingjubilee`
2025-06-29Remove `()` returned valueGuillaume Gomez-1/+1
2025-06-29give Pointer::into_parts a more scary name and offer a safer alternativeRalf Jung-1/+1
2025-06-29Fix signature of `filter_landing_pad`Guillaume Gomez-2/+2
2025-06-28Remove unwanted semi-colon in `rustc_codegen_gcc`Guillaume Gomez-1/+1
2025-06-28Merge commit 'b7091eca6d8eb0fe88b58cc9a7aec405d8de5b85' into ↵Guillaume Gomez-117/+150
subtree-update_cg_gcc_2025-06-28
2025-06-27rustc_codegen_gcc: Fix clippy::manual_is_multiple_ofPhilipp Krones-2/+3
2025-06-22Remove dead instructions in terminate blocksMark Rousskov-2/+2
2025-06-19various minor target feature cleanupsRalf Jung-2/+1
2025-06-19cg_gcc: properly populate cfg(target_features) with -Ctarget-featuresRalf Jung-22/+17
2025-06-19move -Ctarget-feature handling into shared codeRalf Jung-141/+25
2025-06-19move cfg(target_feature) computation into shared placeRalf Jung-37/+22
2025-06-18GCC backend: Remove `add_eval` if no function is createdGuillaume Gomez-1/+0
2025-06-18Merge commit 'fda0bb9588912a3e0606e880ca9f6e913cf8a5a4' into ↵Guillaume Gomez-10357/+11917
subtree-update_cg_gcc_2025-06-18
2025-06-18Auto merge of #141061 - dpaoliello:shimasfn, r=bjorn3bors-36/+42
Change __rust_no_alloc_shim_is_unstable to be a function This fixes a long sequence of issues: 1. A customer reported that building for Arm64EC was broken: #138541 2. This was caused by a bug in my original implementation of Arm64EC support, namely that only functions on Arm64EC need to be decorated with `#` but Rust was decorating statics as well. 3. Once I corrected Rust to only decorate functions, I started linking failures where the linker couldn't find statics exported by dylib dependencies. This was caused by the compiler not marking exported statics in the generated DEF file with `DATA`, thus they were being exported as functions not data. 4. Once I corrected the way that the DEF files were being emitted, the linker started failing saying that it couldn't find `__rust_no_alloc_shim_is_unstable`. This is because the MSVC linker requires the declarations of statics imported from other dylibs to be marked with `dllimport` (whereas it will happily link to functions imported from other dylibs whether they are marked `dllimport` or not). 5. I then made a change to ensure that `__rust_no_alloc_shim_is_unstable` was marked as `dllimport`, but the MSVC linker started emitting warnings that `__rust_no_alloc_shim_is_unstable` was marked as `dllimport` but was declared in an obj file. This is a harmless warning which is a performance hint: anything that's marked `dllimport` must be indirected via an `__imp` symbol so I added a linker arg in the target to suppress the warning. 6. A customer then reported a similar warning when using `lld-link` (<https://github.com/rust-lang/rust/pull/140176#issuecomment-2872448443>). I don't think it was an implementation difference between the two linkers but rather that, depending on the obj that the declaration versus uses of `__rust_no_alloc_shim_is_unstable` landed in we would get different warnings, so I suppressed that warning as well: #140954. 7. Another customer reported that they weren't using the Rust compiler to invoke the linker, thus these warnings were breaking their build: <https://github.com/rust-lang/rust/pull/140176#issuecomment-2881867433>. At that point, my original change was reverted (#141024) leaving Arm64EC broken yet again. Taking a step back, a lot of these linker issues arise from the fact that `__rust_no_alloc_shim_is_unstable` is marked as `extern "Rust"` in the standard library and, therefore, assumed to be a foreign item from a different crate BUT the Rust compiler may choose to generate it either in the current crate, some other crate that will be statically linked in OR some other crate that will by dynamically imported. Worse yet, it is impossible while building a given crate to know if `__rust_no_alloc_shim_is_unstable` will statically linked or dynamically imported: it might be that one of its dependent crates is the one with an allocator kind set and thus that crate (which is compiled later) will decide depending if it has any dylib dependencies or not to import `__rust_no_alloc_shim_is_unstable` or generate it. Thus, there is no way to know if the declaration of `__rust_no_alloc_shim_is_unstable` should be marked with `dllimport` or not. There is a simple fix for all this: there is no reason `__rust_no_alloc_shim_is_unstable` must be a static. It needs to be some symbol that must be linked in; thus, it could easily be a function instead. As a function, there is no need to mark it as `dllimport` when dynamically imported which avoids the entire mess above. There may be a perf hit for changing the `volatile load` to be a `tail call`, so I'm happy to change that part back (although I question what the codegen of a `volatile load` would look like, and if the backend is going to try to use load-acquire semantics). Build with this change applied BEFORE #140176 was reverted to demonstrate that there are no linking issues with either MSVC or MinGW: <https://github.com/rust-lang/rust/actions/runs/15078657205> Incidentally, I fixed `tests/run-make/no-alloc-shim` to work with MSVC as I needed it to be able to test locally (FYI for #128602) r? `@bjorn3` cc `@jieyouxu`
2025-06-17Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obkbors-30/+36
Sized Hierarchy: Part I This patch implements the non-const parts of rust-lang/rfcs#3729. It introduces two new traits to the standard library, `MetaSized` and `PointeeSized`. See the RFC for the rationale behind these traits and to discuss whether this change makes sense in the abstract. These traits are unstable (as is their constness), so users cannot refer to them without opting-in to `feature(sized_hierarchy)`. These traits are not behind `cfg`s as this would make implementation unfeasible, there would simply be too many `cfg`s required to add the necessary bounds everywhere. So, like `Sized`, these traits are automatically implemented by the compiler. RFC 3729 describes changes which are necessary to preserve backwards compatibility given the introduction of these traits, which are implemented and as follows: - `?Sized` is rewritten as `MetaSized` - `MetaSized` is added as a default supertrait for all traits w/out an explicit sizedness supertrait already. There are no edition migrations implemented in this, as these are primarily required for the constness parts of the RFC and prior to stabilisation of this (and so will come in follow-up PRs alongside the const parts). All diagnostic output should remain the same (showing `?Sized` even if the compiler sees `MetaSized`) unless the `sized_hierarchy` feature is enabled. Due to the use of unstable extern types in the standard library and rustc, some bounds in both projects have had to be relaxed already - this is unfortunate but unavoidable so that these extern types can continue to be used where they were before. Performing these relaxations in the standard library and rustc are desirable longer-term anyway, but some bounds are not as relaxed as they ideally would be due to the inability to relax `Deref::Target` (this will be investigated separately). It is hoped that this is implemented such that it could be merged and these traits could exist "under the hood" without that being observable to the user (other than in any performance impact this has on the compiler, etc). Some details might leak through due to the standard library relaxations, but this has not been observed in test output. **Notes:** - Any commits starting with "upstream:" can be ignored, as these correspond to other upstream PRs that this is based on which have yet to be merged. - This best reviewed commit-by-commit. I've attempted to make the implementation easy to follow and keep similar changes and test output updates together. - Each commit has a short description describing its purpose. - This patch is large but it's primarily in the test suite. - I've worked on the performance of this patch and a few optimisations are implemented so that the performance impact is neutral-to-minor. - `PointeeSized` is a different name from the RFC just to make it more obvious that it is different from `std::ptr::Pointee` but all the names are yet to be bikeshed anyway. - `@nikomatsakis` has confirmed [that this can proceed as an experiment from the t-lang side](https://rust-lang.zulipchat.com/#narrow/channel/435869-project-goals/topic/SVE.20and.20SME.20on.20AArch64.20.28goals.23270.29/near/506196491) - FCP in https://github.com/rust-lang/rust/pull/137944#issuecomment-2912207485 Fixes rust-lang/rust#79409. r? `@ghost` (I'll discuss this with relevant teams to find a reviewer)
2025-06-16cranelift/gcc: `{Meta,Pointee,}Sized` in minicoreDavid Wood-30/+36
As in many previous commits, adding the new traits to minicore, but this time for cranelift and gcc.
2025-06-16Change __rust_no_alloc_shim_is_unstable to be a functionDaniel Paoliello-36/+42
2025-06-16Fix RISC-V C function ABI when passing/returning structs containing floatsbeetrees-1/+1
2025-06-15Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, ↵León Orell Valerian Liehr-15/+2
r=workingjubilee,saethlin Move metadata object generation for dylibs to the linker code This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time. Prerequisite of https://github.com/rust-lang/rust/issues/96708.
2025-06-15Rollup merge of #133952 - bjorn3:remove_wasm_legacy_abi, r=alexcrichtonLeón Orell Valerian Liehr-16/+2
Remove wasm legacy abi Closes https://github.com/rust-lang/rust/issues/122532 Closes https://github.com/rust-lang/rust/issues/138762 Fixes https://github.com/rust-lang/rust/issues/71871 https://github.com/rust-lang/rust/issues/88152 Fixes https://github.com/rust-lang/rust/issues/115666 Fixes https://github.com/rust-lang/rust/issues/129486
2025-06-15Implement `simd_round_ties_even` for miri, cg_clif and cg_gccsayantn-0/+2
2025-06-14Auto merge of #142259 - sayantn:simplify-intrinsics, r=workingjubileebors-1/+1
Simplify implementation of Rust intrinsics by using type parameters in the cache The current implementation of intrinsics have a lot of duplication to handle different overloads of overloaded LLVM intrinsic. This PR uses the **base name and the type parameters** in the cache instead of the full, overloaded name. This has the benefit that `call_intrinsic` doesn't need to provide the full name, rather the type parameters (which is most of the time more available). This uses `LLVMIntrinsicCopyOverloadedName2` to get the overloaded name from the base name and the type parameters, and only uses it to declare the function. (originally was part of rust-lang/rust#140763, split off later) `@rustbot` label A-codegen A-LLVM r? codegen
2025-06-14Remove all support for wasm's legacy ABIbjorn3-16/+2
2025-06-14Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errorsMatthias Krüger-4/+0
Unimplement unsized_locals Implements https://github.com/rust-lang/compiler-team/issues/630 Tracking issue here: https://github.com/rust-lang/rust/issues/111942 Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`. There may be more that should be removed (possibly in follow up prs) - the `forget_unsized` function and `forget` intrinsic. - the `unsized_locals` test directory; I've just fixed up the tests for now - various codegen support for unsized values and allocas cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3`` ``@rustbot`` label F-unsized_locals Fixes rust-lang/rust#79409
2025-06-13Auto merge of #142443 - matthiaskrgr:rollup-l1l6d0v, r=matthiaskrgrbors-40/+15
Rollup of 9 pull requests Successful merges: - rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error) - rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features) - rust-lang/rust#140770 (add `extern "custom"` functions) - rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches) - rust-lang/rust#142248 (Add supported asm types for LoongArch32) - rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`) - rust-lang/rust#142274 (Update the stdarch submodule) - rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`) - rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library) Failed merges: - rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling) r? `@ghost` `@rustbot` modify labels: rollup try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-gnu try-job: dist-i586-gnu-i586-i686-musl try-job: test-various
2025-06-13Rollup merge of #140770 - folkertdev:custom-abi, r=tgross35Matthias Krüger-1/+5
add `extern "custom"` functions tracking issue: rust-lang/rust#140829 previous discussion: https://github.com/rust-lang/rust/issues/140566 In short, an `extern "custom"` function is a function with a custom ABI, that rust does not know about. Therefore, such functions can only be defined with `#[unsafe(naked)]` and `naked_asm!`, or via an `extern "C" { /* ... */ }` block. These functions cannot be called using normal rust syntax: calling them can only be done from inline assembly. The motivation is low-level scenarios where a custom calling convention is used. Currently, we often pick `extern "C"`, but that is a lie because the function does not actually respect the C calling convention. At the moment `"custom"` seems to be the name with the most support. That name is not final, but we need to pick something to actually implement this. r? `@traviscross` cc `@tgross35` try-job: x86_64-apple-2
2025-06-13Rollup merge of #135927 - azhogin:azhogin/retpoline, r=davidtwcoMatthias Krüger-39/+10
retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features `-Zretpoline` and `-Zretpoline-external-thunk` flags are target modifiers (tracked to be equal in linked crates). * Enables target features for `-Zretpoline-external-thunk`: `+retpoline-external-thunk`, `+retpoline-indirect-branches`, `+retpoline-indirect-calls`. * Enables target features for `-Zretpoline`: `+retpoline-indirect-branches`, `+retpoline-indirect-calls`. It corresponds to clang -mretpoline & -mretpoline-external-thunk flags. Also this PR forbids to specify those target features manually (warning). Issue: rust-lang/rust#116852
2025-06-13Unimplement unsized_localsmejrs-4/+0
2025-06-12add `extern "custom"` functionsFolkert de Vries-1/+5
2025-06-12intrinsics: rename min_align_of to align_ofRalf Jung-5/+5
2025-06-12Simplify implementation of Rust intrinsics by using type parameters in the cachesayantn-1/+1
2025-06-09Rollup merge of #141993 - tgross35:use-in-tree-builtins, r=bjorn3Trevor Gross-1/+1
Use the in-tree `compiler-builtins` for the sysroot Many of `std`'s dependency have a dependency on the crates.io `compiler-builtins` when used with the feature `rustc-std-workspace-core`. Use a Cargo patch to select the in-tree version instead. `compiler-builtins` is also added as a dependency of `rustc-std-workspace-core` so these crates can remove their crates.io dependency in the future. Zulip discussion: [#t-compiler > Using in-tree compiler-builtins](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Using.20in-tree.20compiler-builtins/with/522445336) Once this merges, the following PRs will need to make it to a release for the relevant crates: - https://github.com/rust-lang/getopts/pull/119 (can merge at any time) - https://github.com/rust-lang/hashbrown/pull/625 (can merge at any time) - https://github.com/rust-lang/stdarch/pull/1825 - https://github.com/rust-lang/rustc-demangle/pull/80 - https://github.com/rust-lang/cfg-if/pull/84 - https://github.com/unicode-rs/unicode-width/pull/77 The above should cover all tier 1 targets with no `std` features enabled. The remaining cover the rest: - https://github.com/alexcrichton/dlmalloc-rs/pull/50 (wasm, xous, sgx) - https://github.com/gimli-rs/gimli/pull/769 - https://github.com/r-efi/r-efi/pull/89 (efi) - https://github.com/r-efi/r-efi-alloc/pull/9 (efi) - https://github.com/fortanix/rust-sgx/pull/770 (sgx) - https://github.com/hermit-os/hermit-rs/pull/718 (hermit) - https://github.com/bytecodealliance/wasi-rs/pull/108 (wasi) - https://github.com/gimli-rs/addr2line/pull/345 - https://github.com/oyvindln/adler2/pull/2 - https://github.com/BurntSushi/memchr/pull/180 - https://github.com/Frommi/miniz_oxide/pull/173 - https://github.com/gimli-rs/object/pull/777 try-job: x86_64-gnu try-job: test-various
2025-06-09-Zretpoline and -Zretpoline-external-thunk flags (target modifiers) to ↵Andrew Zhogin-39/+10
enable retpoline-related target features
2025-06-08Rollup merge of #142194 - bjorn3:less_unstable_features, r=jieyouxuJubilee-1/+1
Remove all unused feature gates from the compiler