about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
AgeCommit message (Collapse)AuthorLines
2023-12-18Rename `Handler` as `DiagCtxt`.Nicholas Nethercote-12/+13
2023-12-17Auto merge of #118828 - mu001999:master, r=b-naberbors-17/+0
Remove dead codes in rustc_codegen_gcc Detected by #118257
2023-12-14Move rustc_codegen_ssa target features to rustc_targetUrgau-7/+6
2023-12-13Add unstable `-Zdefault-hidden-visibility` cmdline flag for `rustc`.Lukasz Anforowicz-1/+1
The new flag has been described in the Major Change Proposal at https://github.com/rust-lang/compiler-team/issues/656
2023-12-11Fix rustc codegen gcc testsUrgau-1/+1
2023-12-11Remove dead codesr0cky-17/+0
2023-12-09Auto merge of #117873 - quininer:android-emutls, r=Amanieubors-0/+1
Add emulated TLS support This is a reopen of https://github.com/rust-lang/rust/pull/96317 . many android devices still only use 128 pthread keys, so using emutls can be helpful. Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false. This commit has some changes to allow users to enable emutls: 1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key. 2. when using emutls, decorate symbol names to find thread local symbol correctly. 3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls. r? `@Amanieu`
2023-12-07Auto merge of #118324 - RalfJung:ctfe-read-only-pointers, r=saethlinbors-3/+5
compile-time evaluation: detect writes through immutable pointers This has two motivations: - it unblocks https://github.com/rust-lang/rust/pull/116745 (and therefore takes a big step towards `const_mut_refs` stabilization), because we can now detect if the memory that we find in `const` can be interned as "immutable" - it would detect the UB that was uncovered in https://github.com/rust-lang/rust/pull/117905, which was caused by accidental stabilization of `copy` functions in `const` that can only be called with UB When UB is detected, we emit a future-compat warn-by-default lint. This is not a breaking change, so completely in line with [the const-UB RFC](https://rust-lang.github.io/rfcs/3016-const-ub.html), meaning we don't need t-lang FCP here. I made the lint immediately show up for dependencies since it is nearly impossible to even trigger this lint without `const_mut_refs` -- the accidentally stabilized `copy` functions are the only way this can happen, so the crates that popped up in #117905 are the only causes of such UB (in the code that crater covers), and the three cases of UB that we know about have all been fixed in their respective crates already. The way this is implemented is by making use of the fact that our interpreter is already generic over the notion of provenance. For CTFE we now use the new `CtfeProvenance` type which is conceptually an `AllocId` plus a boolean `immutable` flag (but packed for a more efficient representation). This means we can mark a pointer as immutable when it is created as a shared reference. The flag will be propagated to all pointers derived from this one. We can then check the immutable flag on each write to reject writes through immutable pointers. I just hope perf works out.
2023-12-07ctfe interpreter: extend provenance so that it can track whether a pointer ↵Ralf Jung-3/+5
is immutable
2023-12-07Allow internal_features in rustc_codegen_gcc examplesUrgau-0/+1
2023-12-07Update rustc_codegen_gcc libcUrgau-2/+2
2023-12-07Add emulated TLS supportquininer-0/+1
Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false. This commit has some changes to allow users to enable emutls: 1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key. 2. when using emutls, decorate symbol names to find thread local symbol correctly. 3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls.
2023-12-04Rename some arguments.Nicholas Nethercote-2/+2
`sess` is a terribly misleading name for a `Handler`! This confused me for a bit.
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-2/+1
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-26Avoid need for `{D,Subd}iagnosticMessage` imports.Nicholas Nethercote-1/+1
The `fluent_messages!` macro produces uses of `crate::{D,Subd}iagnosticMessage`, which means that every crate using the macro must have this import: ``` use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; ``` This commit changes the macro to instead use `rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the imports.
2023-11-19Pass TyCtxt by valueAntoni Boucher-3/+3
2023-11-19Merge commit '2e8386e9fb3506cef991d04f8b3bc78f9a0c2630' into ↵Antoni Boucher-41/+104
subtree-update_cg_gcc_2023-11-17
2023-11-15Bump cfg(bootstrap)sMark Rousskov-3/+3
2023-11-12target_feature: make it more clear what that 'Option' meansRalf Jung-1/+1
2023-11-02Remove `libc` dependency in cg_gcc alloc_system exampleGuillaume Gomez-4/+14
2023-11-02Pass `--sysroot` optionGuillaume Gomez-0/+4
2023-11-02Fix config.sh scriptGuillaume Gomez-1/+1
2023-11-02Fix compilation errors in rustc_codegen_gcc examplesGuillaume Gomez-2/+2
2023-11-02Disable `master` feature by default when building rustc_codegen_gccGuillaume Gomez-1/+0
2023-10-27Merge commit '09ce29d0591a21e1abae22eac4d41ffd32993af8' into ↵Antoni Boucher-53/+98
subtree-update_cg_gcc_2023-10-25
2023-10-26Merge commit 'e4fe941b11a55c5005630696e9b6d81c65f7bd04' into ↵Antoni Boucher-507/+2664
subtree-update_cg_gcc_2023-10-25
2023-10-20s/generator/coroutine/Oli Scherer-1/+1
2023-10-20s/Generator/Coroutine/Oli Scherer-4/+4
2023-10-16docs: add Rust logo to more compiler cratesMichael Howell-0/+2
c6e6ecb1afea9695a42d0f148ce153536b279eb5 added it to some of the compiler's crates, but avoided adding it to all of them to reduce bit-rot. This commit adds to more.
2023-10-09Use IntoDynSyncSendAntoni Boucher-6/+14
2023-10-09Fix checksAntoni Boucher-1/+1
2023-10-09Merge commit '11a0cceab966e5ff1058ddbcab5977e8a1d6d290' into ↵Antoni Boucher-657/+2836
subtree-update_cg_gcc_2023-10-09
2023-10-02Auto merge of #102099 - InnovativeInventor:re-cold-land, r=nikicbors-1/+1
Rebased: Mark drop calls in landing pads cold instead of noinline I noticed that certain inlining optimizations were missing while staring at some compiled code output. I'd like to see this relanded, so I rebased the PR from `@erikdesjardins` (PR #94823). This PR reapplies https://github.com/rust-lang/rust/pull/92419, which was reverted in https://github.com/rust-lang/rust/pull/94402 due to https://github.com/rust-lang/rust/issues/94390. Fixes https://github.com/rust-lang/rust/issues/46515, fixes https://github.com/rust-lang/rust/issues/87055. Update: fixes #97217.
2023-10-02Reapply: Mark drop calls in landing pads cold instead of noinlineErik Desjardins-1/+1
Co-authored-by: Max Fan <git@max.fan> Co-authored-by: Nikita Popov <npopov@redhat.com>
2023-10-02Auto merge of #115898 - onur-ozkan:config-change-tracking, r=Mark-Simulacrumbors-1/+1
bootstrap major change detection implementation The use of `changelog-seen` and `bootstrap/CHANGELOG.md` has not been functional in any way for many years. We often do major/breaking changes but never update the changelog file or the `changelog-seen`. This is an alternative method for tracking major or breaking changes and informing developers when such changes occur. Example output when bootstrap detects a major change: ![image](https://github.com/rust-lang/rust/assets/39852038/ee802dfa-a02b-488b-a433-f853ce079b8a)
2023-10-01implement major change tracking for the bootstrap configurationonur-ozkan-1/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-09-22Have a single struct for queries and hookOli Scherer-3/+2
2023-09-22Add a way to decouple the implementation and the declaration of a TyCtxt method.Oli Scherer-1/+2
2023-09-15fix gcc, cranelift buildRalf Jung-6/+6
2023-09-15clarify PassMode::Indirect as wellRalf Jung-5/+5
2023-09-14treat host effect params as erased generics in codegenDeadbeef-1/+1
This fixes the changes brought to codegen tests when effect params are added to libcore, by not attempting to monomorphize functions that get the host param by being `const fn`.
2023-09-01Deduplicate inlined function debug info, but create a new lexical scope to ↵Daniel Paoliello-1/+1
child subsequent scopes and variables from colliding
2023-08-29Rollup merge of #111580 - atsuzaki:layout-ice, r=oli-obkMatthias Krüger-1/+2
Don't ICE on layout computation failure Fixes #111176 regression. r? `@oli-obk`
2023-08-28Don't ICE on layout computation failureKatherine Philip-1/+2
2023-08-28Rollup merge of #115240 - RalfJung:llvm-no-type, r=bjorn3Matthias Krüger-37/+17
codegen_llvm/llvm_type: avoid matching on the Rust type This `match` is highly suspicious. Looking at `scalar_llvm_type_at` I think it makes no difference. But if it were to make a difference that would be a huge problem, since it doesn't look through `repr(transparent)`! Cc `@eddyb` `@bjorn3`
2023-08-28remove an unused argumentRalf Jung-10/+10
it was already unused before, but due to the recursion the compiler did not realize
2023-08-28carry out the same changes in the gcc backendRalf Jung-27/+7
2023-08-25Revert "Use the same DISubprogram for each instance of the same inlined ↵Wesley Wiser-1/+1
function within the caller" This reverts commit 687bffa49375aa00bacc51f5d9adfb84a9453e17. Reverting to resolve ICEs reported on nightly.
2023-08-22Auto merge of #114643 - dpaoliello:inlinedebuginfo, r=wesleywiserbors-1/+1
Use the same DISubprogram for each instance of the same inlined function within a caller # Issue Details: The call to `panic` within a function like `Option::unwrap` is translated to LLVM as a `tail call` (as it will never return), when multiple calls to the same function like this is inlined LLVM will notice the common `tail call` block (i.e., loading the same panic string + location info and then calling `panic`) and merge them together. When merging these instructions together, LLVM will also attempt to merge the debug locations as well, but this fails (i.e., debug info is dropped) as Rust emits a new `DISubprogram` at each inline site thus LLVM doesn't recognize that these are actually the same function and so thinks that there isn't a common debug location. As an example of this when building for x86_64 Windows (note the lack of `.cv_loc` before the call to `panic`, thus it will be attributed to the same line at the `addq` instruction): ``` .cv_loc 0 1 23 0 # src\lib.rs:23:0 addq $40, %rsp retq leaq .Lalloc_f570dea0a53168780ce9a91e67646421(%rip), %rcx leaq .Lalloc_629ace53b7e5b76aaa810d549cc84ea3(%rip), %r8 movl $43, %edx callq _ZN4core9panicking5panic17h12e60b9063f6dee8E int3 ``` # Fix Details: Cache the `DISubprogram` emitted for each inlined function instance within a caller so that this can be reused if that instance is encountered again, this also requires caching the `DILexicalBlock` and `DIVariable` objects to avoid creating duplicates. After this change the above assembly now looks like: ``` .cv_loc 0 1 23 0 # src\lib.rs:23:0 addq $40, %rsp retq .cv_inline_site_id 5 within 0 inlined_at 1 0 0 .cv_inline_site_id 6 within 5 inlined_at 1 12 0 .cv_loc 6 2 935 0 # library\core\src\option.rs:935:0 leaq .Lalloc_5f55955de67e57c79064b537689facea(%rip), %rcx leaq .Lalloc_e741d4de8cb5801e1fd7a6c6795c1559(%rip), %r8 movl $43, %edx callq _ZN4core9panicking5panic17hde1558f32d5b1c04E int3 ```
2023-08-15Auto merge of #114467 - Amanieu:asm-unstable-features, r=davidtwcobors-2/+2
Use `unstable_target_features` when checking inline assembly This is necessary to properly validate register classes even when the relevant target feature name is still unstable.