Commit graph

4592 commits

Author SHA1 Message Date
bjorn3
c5291585b3 Sync from rust 4ba4ac612d 2024-12-19 15:13:56 +00:00
bjorn3
da415e17c8
Merge pull request #1550 from jyn514/logging
hook up tracing to cg_cranelift
2024-12-19 13:53:18 +01:00
jyn
b046e32262 hook up tracing to cg_cranelift
this was easier than expected. here is an example of using RUSTC_LOG with a build of cranelift from rust-lang/rust:
```
$ RUSTC_LOG=rustc_codegen_cranelift cargo +stage1 b
   Compiling example v0.1.0 (/home/jyn/src/example)
 INFO rustc_codegen_cranelift codegen crate example
 INFO rustc_codegen_cranelift codegen crate example
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.44s
```
2024-12-18 17:53:20 -05:00
bjorn3
53bbef8305 Remove host and target configuration from config.txt
They can still be set using HOST_TRIPLE and TARGET_TRIPLE.
2024-12-18 18:36:05 +00:00
bjorn3
88139f0c6b Move the benchmark markdown files from dist/ to build/ 2024-12-18 18:24:13 +00:00
bjorn3
cae568eeb4 Use the compiler returned by build_sysroot for benchmarking
Rather than trying to fish it out of the default target location dist/.
This reduces the amount of places where the presence of the dist dir is
hardcoded.
2024-12-18 18:13:59 +00:00
bjorn3
8521e70019 Simplify RelPath implementation 2024-12-18 18:11:47 +00:00
bjorn3
a220a53af3 Disable testing on wine
Wine started crashing for whatever reason. Supporting native Windows is
much more important and already tested separately.
2024-12-18 17:48:08 +00:00
bjorn3
9f50fa7e21 Ensure user trap code 0 is never used
Cranelift will return None from TrapCode::user(0).

Fixes rust-lang/rustc_codegen_cranelift#1548
2024-12-18 17:07:56 +00:00
bjorn3
67c241e33b Fix rustc test suite 2024-12-18 15:23:22 +00:00
bjorn3
076ae56bda Rustup to rustc 1.85.0-nightly (a4cb3c831 2024-12-17) 2024-12-18 15:12:35 +00:00
bjorn3
1587f77aa9 Sync from rust a4cb3c8318 2024-12-18 14:55:12 +00:00
Nicholas Nethercote
4dd8941d3f Re-export more rustc_span::symbol things from rustc_span.
`rustc_span::symbol` defines some things that are re-exported from
`rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some
closely related things such as `Ident` and `kw`. So you can do `use
rustc_span::{Symbol, sym}` but you have to do `use
rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good
reason.

This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`,
and changes many `rustc_span::symbol::` qualifiers in `compiler/` to
`rustc_span::`. This is a 200+ net line of code reduction, mostly
because many files with two `use rustc_span` items can be reduced to
one.
2024-12-18 13:38:53 +11:00
Matthias Krüger
884dcee945 Rollup merge of #134251 - bjorn3:various_cleanups2, r=oli-obk
A bunch of cleanups (part 2)

Just like https://github.com/rust-lang/rust/pull/133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
2024-12-14 03:54:35 +01:00
bjorn3
c99d4f0f51 Make dependency_formats an FxIndexMap rather than a list of tuples
It is treated as a map already. This is using FxIndexMap rather than
UnordMap because the latter doesn't provide an api to pick a single
value iff all values are equal, which each_linked_rlib depends on.
2024-12-13 11:29:15 +00:00
bjorn3
37b47f9542 Remove jobserver from Session
It is effectively a global resource and the jobserver::Client in Session
was a clone of GLOBAL_CLIENT anyway.
2024-12-13 10:21:22 +00:00
Ralf Jung
8d3a263c79 generalize 'forbidden feature' concept so that even (un)stable feature can be invalid to toggle
Also rename some things for extra clarity
2024-12-11 22:11:15 +01:00
bjorn3
3ebaf04707 Fix rustc test suite 2024-12-11 11:04:50 +00:00
bjorn3
e1461e2c7e Rustup to rustc 1.85.0-nightly (33c245b9e 2024-12-10) 2024-12-11 10:47:08 +00:00
bjorn3
14fbfb0460 Sync from rust 33c245b9e9 2024-12-11 10:36:18 +00:00
León Orell Valerian Liehr
1c9a333c7c Rollup merge of #134008 - jswrenn:unsafe-fields-copy, r=compiler-errors
Make `Copy` unsafe to implement for ADTs with `unsafe` fields

As a rule, the application of `unsafe` to a declaration requires that use-sites of that declaration also entail `unsafe`. For example, a field declared `unsafe` may only be read in the lexical context of an `unsafe` block.

For nearly all safe traits, the safety obligations of fields are explicitly discharged when they are mentioned in method definitions. For example, idiomatically implementing `Clone` (a safe trait) for a type with unsafe fields will require `unsafe` to clone those fields.

Prior to this commit, `Copy` violated this rule. The trait is marked safe, and although it has no explicit methods, its implementation permits reads of `Self`.

This commit resolves this by making `Copy` conditionally safe to implement. It remains safe to implement for ADTs without unsafe fields, but unsafe to implement for ADTs with unsafe fields.

Tracking: #132922

r? ```@compiler-errors```
2024-12-10 13:51:10 +01:00
Matthias Krüger
14f12919f6 Rollup merge of #133567 - bjorn3:various_cleanups, r=cjgillot
A bunch of cleanups

These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries.

Previous PR: https://github.com/rust-lang/rust/pull/132410
2024-12-09 01:56:32 +01:00
Jack Wrenn
03746a5511 Make Copy unsafe to implement for ADTs with unsafe fields
As a rule, the application of `unsafe` to a declaration requires that use-sites
of that declaration also require `unsafe`. For example, a field declared
`unsafe` may only be read in the lexical context of an `unsafe` block.

For nearly all safe traits, the safety obligations of fields are explicitly
discharged when they are mentioned in method definitions. For example,
idiomatically implementing `Clone` (a safe trait) for a type with unsafe fields
will require `unsafe` to clone those fields.

Prior to this commit, `Copy` violated this rule. The trait is marked safe, and
although it has no explicit methods, its implementation permits reads of `Self`.

This commit resolves this by making `Copy` conditionally safe to implement. It
remains safe to implement for ADTs without unsafe fields, but unsafe to
implement for ADTs with unsafe fields.

Tracking: #132922
2024-12-07 20:50:00 +00:00
Ben Kimock
4d01ca8ae9 Remove polymorphization 2024-12-06 16:42:09 -05:00
bjorn3
e7e58f4505 Move some timers around 2024-12-06 18:42:30 +00:00
bjorn3
294d2da5d9 Merge branch 'sync_from_rust' 2024-12-06 12:15:07 +00:00
bjorn3
e8ad19987d Merge commit '57845a397e' into sync_cg_clif-2024-12-06 2024-12-06 12:10:30 +00:00
bjorn3
57845a397e Rustup to rustc 1.85.0-nightly (c94848c04 2024-12-05) 2024-12-06 11:56:16 +00:00
bjorn3
7e0d1b69fd
Merge pull request #1546 from rust-lang/libcall_abi_fixes
Fix the ABI for libcalls
2024-12-05 16:56:04 +01:00
bjorn3
d8edcd516a Handle abi adjusting in lib_call correctly for s390x 2024-12-05 15:41:05 +00:00
bjorn3
9fd3b18b0b Avoid depending on the unadjusted abi
It is ill defined and for this specific case it may become impossible
to call using Cranelift in the future.
2024-12-05 15:36:03 +00:00
bjorn3
0974099e30 Revert "Switch to -ffunction-sections by default"
This reverts commit 65c5c7f8cf.

It unfortunately regresses the size of the target dir by a non-trivial
amount. It could be re-enabled again once each subsection doesn't get a
unique name anymore.
2024-12-05 12:43:01 +00:00
bjorn3
92b5873072 Make artifact_size usage closer to what cg_llvm does 2024-12-05 12:09:07 +00:00
bjorn3
65c5c7f8cf Switch to -ffunction-sections by default
With lld the perf difference is within noise while producing slightly
(or in exceptional cases significantly) smaller binaries.
2024-12-05 12:03:58 +00:00
bjorn3
a767a103bb Extract codegen_cgu_content 2024-12-05 11:41:14 +00:00
bjorn3
53e1043e82 Extract emit_allocator_module 2024-12-05 11:38:18 +00:00
bjorn3
1d940adc86 Extract emit_metadata_module 2024-12-05 11:37:19 +00:00
bjorn3
623a6dadfd Move SelfProfilerRef out of CodegenCx 2024-12-05 11:33:03 +00:00
bjorn3
357deaa849 Move disabling of f16 and f128 in compiler-builtins to liballoc
This way it gets disabled even when trying to compile just liballoc and
not the sysroot crate.
2024-12-04 14:38:37 +00:00
bjorn3
28533886c3 Fix rustc test suite 2024-12-04 12:24:24 +00:00
bjorn3
eff1c5d627 Rustup to rustc 1.85.0-nightly (c44b3d50f 2024-12-03) 2024-12-04 11:25:10 +00:00
bjorn3
812edd21e0 Sync from rust c44b3d50fe 2024-12-04 11:08:01 +00:00
Matthias Krüger
7174bcc8d6 Rollup merge of #133545 - clubby789:symbol-intern-lit, r=jieyouxu
Lint against Symbol::intern on a string literal

Disabled in tests where this doesn't make much sense
2024-12-03 17:27:06 +01:00
Matthias Krüger
c5acac93fd Rollup merge of #133395 - calebzulawski:simd_relaxed_fma, r=workingjubilee
Add simd_relaxed_fma intrinsic

Adds compiler support for https://github.com/rust-lang/portable-simd/issues/387#issuecomment-2337169786

r? `@workingjubilee`

cc `@RalfJung` is this kind of nondeterminism a problem for miri/opsem?
2024-12-03 07:48:33 +01:00
bjorn3
95bb635853 Fix std_example on s390x 2024-11-28 18:26:56 +00:00
bjorn3
e82b533efd Fix rustc test suite 2024-11-28 18:10:15 +00:00
bjorn3
e595d03b1d Rustup to rustc 1.85.0-nightly (6b6a867ae 2024-11-27) 2024-11-28 17:46:12 +00:00
bjorn3
632ccacd81 Sync from rust 6b6a867ae9 2024-11-28 17:36:44 +00:00
clubby789
a2e9aac905 Replace Symbol::intern calls with preinterned symbols 2024-11-28 15:45:27 +00:00
Guillaume Gomez
1aded6079a Rollup merge of #133463 - taiki-e:aarch64-asm-x18, r=Amanieu
Fix handling of x18 in AArch64 inline assembly on ohos/trusty or with -Zfixed-x18

Currently AArch64 inline assembly allows using x18 on ohos/trusty or with -Zfixed-x18.

7db7489f9b/compiler/rustc_target/src/asm/aarch64.rs (L74-L76)

However, x18 is reserved in these environments and should not be allowed in the input/output operands of inline assemblies as it is in Android, Windows, etc..

7db7489f9b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs (L19)
7db7489f9b/compiler/rustc_target/src/spec/targets/aarch64_unknown_trusty.rs (L18)
7db7489f9b/compiler/rustc_codegen_llvm/src/llvm_util.rs (L764-L771)

(As for ohos, +reserve-x18 is [redundant](c417b7a695 (diff-0ddf23e0bf2b28b2d05f842f087d1e6f694e8e06d1765e8d0f10d47fddcdff9c)) since 7a966b9188 that starting using llvm's ohos targets. So removed it from target-spec.)

This fix may potentially break the code for tier 2 target (aarch64-unknown-linux-ohos). (As for others, aarch64-unknown-trusty is tier 3 and -Zfixed-x18 is unstable so breaking them should be fine.)
However, in any case, it seems suspicious that the code that is broken by this was sound.

r? `@Amanieu`

`@rustbot` label O-AArch64 +A-inline-assembly
2024-11-28 12:06:02 +01:00