Commit Graph

1123 Commits

Author SHA1 Message Date
Guillaume Gomez
95dfe5ec90 Simplify split_args code, add a unit test for it and run it into CI 2023-12-16 17:39:58 +01:00
Guillaume Gomez
db9b932314 Fix sysroot build 2023-12-14 17:11:35 +01:00
Urgau
b1affb9321 Move rustc_codegen_ssa target features to rustc_target 2023-12-14 14:40:55 +01:00
Lukasz Anforowicz
e1f039f562 Add unstable -Zdefault-hidden-visibility cmdline flag for rustc.
The new flag has been described in the Major Change Proposal at
https://github.com/rust-lang/compiler-team/issues/656
2023-12-13 21:14:23 +00:00
Guillaume Gomez
867ea12488 Fix non-running rustc ui tests 2023-12-13 17:49:08 +01:00
Urgau
a72e20d773 Fix rustc codegen gcc tests 2023-12-11 18:48:49 +01:00
r0cky
92de9d4210 Remove dead codes 2023-12-11 23:24:32 +08:00
bors
c578f4302c Auto merge of #117873 - quininer:android-emutls, r=Amanieu
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-09 05:32:35 +00:00
bors
17f0dd5898 Auto merge of #118324 - RalfJung:ctfe-read-only-pointers, r=saethlin
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-07 18:11:01 +00:00
Ralf Jung
cb32ffd8da ctfe interpreter: extend provenance so that it can track whether a pointer is immutable 2023-12-07 17:46:36 +01:00
Urgau
3cfff05ac7 Allow internal_features in rustc_codegen_gcc examples 2023-12-07 15:26:18 +01:00
Urgau
19e11760ab Update rustc_codegen_gcc libc 2023-12-07 14:59:37 +01:00
quininer
2baa073fb1 Add emulated TLS support
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-07 00:21:32 +08:00
Guillaume Gomez
ebb7aa0b85 Apply suggestions 2023-12-04 17:33:18 +01:00
Guillaume Gomez
996635bad6 Fix chroot command 2023-12-04 15:29:23 +01:00
Guillaume Gomez
2ec8d46dd1 Correctly handle OVERWRITE_TARGET_TRIPLE env variable 2023-12-04 15:29:23 +01:00
Guillaume Gomez
53b2759bef Show command which failed 2023-12-04 15:29:23 +01:00
Guillaume Gomez
ff04316243 Remove --target option 2023-12-04 15:29:23 +01:00
Guillaume Gomez
970b2c7700 Fix build_sysroot by adding missing RUSTFLAGS environment variable 2023-12-04 15:29:23 +01:00
Guillaume Gomez
7d71b87691 Correctly set --cap-lints when running regex tests 2023-12-04 15:29:23 +01:00
Guillaume Gomez
ad1d5417e7 Set RUSTDOCFLAGS environment variable in run_cargo_command_with_callback function 2023-12-04 15:29:23 +01:00
Guillaume Gomez
7013eccc05 Add missing code comment 2023-12-04 15:29:23 +01:00
Guillaume Gomez
3c6bae7fa8 Use the correct folder when deleting rust UI tests 2023-12-04 15:29:23 +01:00
Guillaume Gomez
4bed89f79b Correctly pass toolchain to cargo command 2023-12-04 15:29:23 +01:00
Guillaume Gomez
d793f80bd4 Correctly pass cfg option 2023-12-04 15:29:23 +01:00
Guillaume Gomez
673661db8b Remove newline for llvm FileCheck binary path 2023-12-04 15:29:23 +01:00
Guillaume Gomez
23c97b545d Replace xargs command with pure Rust 2023-12-04 15:29:23 +01:00
Guillaume Gomez
87c284c9bc Only read rust test files 2023-12-04 15:29:23 +01:00
Guillaume Gomez
9d104a0cbf Clone rust repository before modifying it 2023-12-04 15:29:23 +01:00
Guillaume Gomez
c27fe3e036 Correctly handle channel in config 2023-12-04 15:29:23 +01:00
Guillaume Gomez
694a80d372 Add missing --build-sysroot option 2023-12-04 15:29:23 +01:00
Guillaume Gomez
8cc024c84d Fix invalid path in build_sysroot_inner 2023-12-04 15:29:23 +01:00
Guillaume Gomez
d3e14a49c9 Display stdout and stderr if a command failed to run 2023-12-04 15:29:23 +01:00
Guillaume Gomez
84ca4f59c2 Remove test.sh, config.sh and all calls and documentation pointing to it 2023-12-04 15:29:22 +01:00
Guillaume Gomez
7b76ac4eb7 Rustify test.sh 2023-12-04 15:28:53 +01:00
Guillaume Gomez
04f32f2016 Allow rustfmt to run on build_system 2023-12-04 15:28:53 +01:00
Nicholas Nethercote
f9a228df48 Rename some arguments.
`sess` is a terribly misleading name for a `Handler`! This confused me
for a bit.
2023-12-04 18:57:41 +11:00
antoyo
0a67e9cd60
Merge pull request #391 from GuillaumeGomez/fix-build-instructions
Fix build instructions
2023-12-02 11:42:37 -05:00
Guillaume Gomez
bb4d0be014 Fix build instructions 2023-12-02 16:28:28 +01:00
Andy Sadler
17b2c46c88
remove generic-arithmetic-pass from failing tests
This test now passes when tested with a patched libgccjit.  However, due
to [some compiler bugs][1], we can't enable this for non-patched
libgccjit yet.

[1]: https://github.com/sadlerap/rustc_codegen_gcc/actions/runs/6820180639/job/18548672444#step:15:4375

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:43 -06:00
Andy Sadler
3a221320eb
fix simd_neg implementation for ints
gcc_not would panic upon encountering a vector type, which is not what
we want here.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:42 -06:00
Andy Sadler
03e11a214e
impl simd_ctlz/simd_cttz intrinsic
Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:42 -06:00
Andy Sadler
8d42a82b6e
impl simd_bitreverse intrinsic
If we're running against a patched libgccjit, use an algorithm similar
to what LLVM uses for this intrinsic.  Otherwise, fallback to a
per-element bitreverse.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:34 -06:00
Andy Sadler
70586a23a7
fix simd_frem intrinsic implementation
The simd intrinsic handler was delegating implementation of `simd_frem`
to `Builder::frem`, which wasn't able to handle vector-typed inputs.  To
fix this, teach this method how to handle vector inputs.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:23 -06:00
Andy Sadler
6d13f949ee
remove generic-bswap-byte from failing test list
Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:23 -06:00
Andy Sadler
cc7c9bea15
implement simd_bswap intrinsic
Implements lane-local byte swapping through vector shuffles.  While this
is more setup than non-vector shuffles, this implementation can shuffle
multiple integers concurrently.

Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
2023-11-28 21:25:17 -06:00
Nicholas Nethercote
8e13be084a Use rustc_fluent_macro::fluent_messages! directly.
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-26 08:38:40 +11:00
Nicholas Nethercote
4de5d372aa Avoid need for {D,Subd}iagnosticMessage imports.
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-26 08:38:00 +11:00
antoyo
bcd0bf5450
Merge pull request #388 from rust-lang/sync_from_rust_2023_11_21
Sync from rust 2023/11/21
2023-11-22 08:11:06 -05:00
Antoni Boucher
fbb97bd593 Merge branch 'master' into sync_from_rust_2023_11_21 2023-11-22 07:41:52 -05:00