Commit Graph

767 Commits

Author SHA1 Message Date
Manish Goregaokar
6933be588e Rollup merge of #105452 - rcvalle:rust-cfi-3, r=bjorn3
Add cross-language LLVM CFI support to the Rust compiler

This PR adds cross-language LLVM Control Flow Integrity (CFI) support to the Rust compiler by adding the `-Zsanitizer-cfi-normalize-integers` option to be used with Clang `-fsanitize-cfi-icall-normalize-integers` for normalizing integer types (see https://reviews.llvm.org/D139395).

It provides forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space). For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653.

Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and -Zsanitizer-cfi-normalize-integers, and requires proper (i.e., non-rustc) LTO (i.e., -Clinker-plugin-lto).

Thank you again, ``@bjorn3,`` ``@nikic,`` ``@samitolvanen,`` and the Rust community for all the help!
2023-05-03 16:42:48 -07:00
Ramon de C Valle
0d183f8e74 Add cross-language LLVM CFI support to the Rust compiler
This commit adds cross-language LLVM Control Flow Integrity (CFI)
support to the Rust compiler by adding the
`-Zsanitizer-cfi-normalize-integers` option to be used with Clang
`-fsanitize-cfi-icall-normalize-integers` for normalizing integer types
(see https://reviews.llvm.org/D139395).

It provides forward-edge control flow protection for C or C++ and Rust
-compiled code "mixed binaries" (i.e., for when C or C++ and Rust
-compiled code share the same virtual address space). For more
information about LLVM CFI and cross-language LLVM CFI support for the
Rust compiler, see design document in the tracking issue #89653.

Cross-language LLVM CFI can be enabled with -Zsanitizer=cfi and
-Zsanitizer-cfi-normalize-integers, and requires proper (i.e.,
non-rustc) LTO (i.e., -Clinker-plugin-lto).
2023-05-03 22:41:29 +00:00
Ralf Jung
7a48ba9096 Merge from rustc 2023-04-30 22:35:29 +02:00
Ralf Jung
f822f8fc5d Merge from rustc 2023-04-28 15:49:39 +02:00
Boxy
43f2b1696f rename needs_infer to has_infer 2023-04-27 08:35:19 +01:00
Ralf Jung
9c69c0d67b Merge from rustc 2023-04-26 09:51:54 +02:00
bors
403ebdcdef Auto merge of #101069 - zhaixiaojuan:loongarch64-inline-asm, r=Amanieu
Add loongarch64 asm! support
2023-04-25 09:18:58 +00:00
zhaixiaojuan
7ec90e3077 Add loongarch64 asm! support 2023-04-25 14:15:31 +08:00
Matthias Krüger
94735c7a5c Revert "Remove #[alloc_error_handler] from the compiler and library"
This reverts commit abc0660118.
2023-04-25 00:08:35 +02:00
Ralf Jung
fab5943828 Merge from rustc 2023-04-24 11:59:11 +02:00
bors
321337b0a5 Auto merge of #109507 - Amanieu:panic-oom-payload, r=davidtwco
Report allocation errors as panics

OOM is now reported as a panic but with a custom payload type (`AllocErrorPanicPayload`) which holds the layout that was passed to `handle_alloc_error`.

This should be review one commit at a time:
- The first commit adds `AllocErrorPanicPayload` and changes allocation errors to always be reported as panics.
- The second commit removes `#[alloc_error_handler]` and the `alloc_error_hook` API.

ACP: https://github.com/rust-lang/libs-team/issues/192

Closes #51540
Closes #51245
2023-04-22 12:27:45 +00:00
Ralf Jung
7dc2487e6a Merge from rustc 2023-04-22 10:35:35 +02:00
Nilstrieb
f40e4da5d9 Add rustc_fluent_macro to decouple fluent from rustc_macros
Fluent, with all the icu4x it brings in, takes quite some time to
compile. `fluent_messages!` is only needed in further downstream rustc
crates, but is blocking more upstream crates like `rustc_index`. By
splitting it out, we allow `rustc_macros` to be compiled earlier, which
speeds up `x check compiler` by about 5 seconds (and even more after the
needless dependency on `serde_json` is removed from
`rustc_data_structures`).
2023-04-18 18:56:22 +00:00
antoyo
0cbf2b9715
Merge pull request #267 from rust-lang/inline-attribute
Add support for inline attribute
2023-04-16 17:55:00 -04:00
Antoni Boucher
b93041af0a Add support for inline attribute 2023-04-16 17:17:05 -04:00
Amanieu d'Antras
5f30b63b3b Remove #[alloc_error_handler] from the compiler and library 2023-04-16 08:35:50 -07:00
bors
6883c25a9b Auto merge of #109989 - ids1024:m68k-asm, r=Amanieu
Add inline assembly support for m68k

I believe this should be correct, to the extent I understand the logic around inline assembly. M68k is fairly straightforward here, other than having separate address registers.
2023-04-13 11:41:57 +00:00
Ian Douglas Scott
387718fedc Add inline assembly support for m68k 2023-04-12 17:58:15 -07:00
Michael Goulet
8541fce93c Rollup merge of #96971 - zhaixiaojuan:master, r=wesleywiser
Initial support for loongarch64-unknown-linux-gnu

Hi, We hope to add a new port in rust for LoongArch.

LoongArch intro
LoongArch is a RISC style ISA which is independently designed by Loongson
Technology in China. It is divided into two versions, the 32-bit version (LA32)
and the 64-bit version (LA64). LA64 applications have application-level
backward binary compatibility with LA32 applications. LoongArch is composed of
a basic part (Loongson Base) and an expanded part. The expansion part includes
Loongson Binary Translation (LBT), Loongson VirtualiZation (LVZ), Loongson SIMD
EXtension (LSX) and Loongson Advanced SIMD EXtension(LASX).

Currently the LA464 processor core supports LoongArch ISA and the Loongson
3A5000 processor integrates 4 64-bit LA464 cores. LA464 is a four-issue 64-bit
high-performance processor core. It can be used as a single core for high-end
embedded and desktop applications, or as a basic processor core to form an
on-chip multi-core system for server and high-performance machine applications.

Documentations:
ISA:
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html
ABI:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
More docs can be found at:
https://loongson.github.io/LoongArch-Documentation/README-EN.html

Since last year, we have locally adapted two versions of rust, rust1.41 and rust1.57, and completed the test locally.
I'm not sure if I'm submitting all the patches at once, so I split up the patches and here's one of the commits
2023-04-11 20:28:45 -07:00
antoyo
17cbb61c08
Merge pull request #266 from rust-lang/test/stdarch-emulator
Run emulated stdarch tests in the CI
2023-04-09 20:57:52 -04:00
Antoni Boucher
a6d7ab5b00 Run emulated stdarch tests in the CI 2023-04-08 16:00:50 -04:00
zhaixiaojuan
556ab26283 Define MIN_ALIGN for loongarch64 2023-04-08 00:09:54 +08:00
antoyo
76c10cc1c9
Merge pull request #262 from rust-lang/fix/vpshrdvw
Fix vpshrd llvm instrinsics
2023-04-07 09:00:41 -04:00
Antoni Boucher
65a20d3f71 Fix vpshrd llvm instrinsics 2023-04-07 08:10:34 -04:00
antoyo
ba60936e48
Merge pull request #260 from GuillaumeGomez/ignore-llvm
Add `llvm` folder to .gitignore file
2023-04-06 12:17:02 -04:00
antoyo
24ea06b0bf
Merge pull request #259 from GuillaumeGomez/regen-intrinsics
Regenerate intrinsics
2023-04-06 12:16:40 -04:00
Guillaume Gomez
98482ad1e4 Regen intrinsics 2023-04-06 17:39:05 +02:00
Guillaume Gomez
b769ad26b0 Add llvm folder to .gitignore file 2023-04-06 17:38:45 +02:00
antoyo
5af59b67b4
Merge pull request #261 from GuillaumeGomez/update-gcc-jit
Update gccjit dependency version
2023-04-06 11:34:04 -04:00
Guillaume Gomez
7e2e5054a6 Update gccjit dependency version 2023-04-05 16:30:21 +02:00
Ulrich Weigand
2bfd89d91b Update gccjit and remove libc 0.1 dependency 2023-03-30 18:30:56 +02:00
antoyo
ade3739c07
Merge pull request #257 from arpankapoor/master
Optimize bitreverse codegen
2023-03-28 17:15:12 -04:00
Arpan Kapoor
68b8500235
move u128 test to std_example 2023-03-27 20:33:05 +05:30
Arpan Kapoor
6e1a79c6a4
Add u128 PartialEq impl in mini_core.rs 2023-03-26 13:19:57 +05:30
Arpan Kapoor
77a9effd3d
Optimize bitreverse codegen 2023-03-24 13:06:20 +05:30
Nikita Popov
0c115bf8b8 Use poison instead of undef
In cases where it is legal, we should prefer poison values over
undef values.

This replaces undef with poison for aggregate construction and
for uninhabited types. There are more places where we can likely
use poison, but I wanted to stay conservative to start with.

In particular the aggregate case is important for newer LLVM
versions, which are not able to handle an undef base value during
early optimization due to poison-propagation concerns.
2023-03-16 15:07:04 +01:00
clubby789
ee38de5155 Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
est31
fe93911ebc Simplify message paths
This makes it easier to open the messages file while developing on features.

The commit was the result of automatted changes:

for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done

for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-11 22:51:57 +01:00
Pietro Albini
8652bbb072 replace legacy copyright annotations in submodules 2023-03-09 12:24:47 +01:00
Matthias Krüger
cbbaebc34c Rollup merge of #108783 - antoyo:sync-cg_gcc-2023-03-04, r=cjgillot
Sync rustc_codegen_gcc 2023/03/04

Hi.
This sync all the changes from rustc_codegen_gcc.
Thanks for the review.
2023-03-07 19:57:45 +01:00
bors
7b85215c4f Auto merge of #95317 - Jules-Bertholet:round_ties_to_even, r=pnkfelix,m-ou-se,scottmcm
Add `round_ties_even` to `f32` and `f64`

Tracking issue: #96710

Redux of #82273. See also #55107

Adds a new method, `round_ties_even`, to `f32` and `f64`, that rounds the float to the nearest integer , rounding halfway cases to the number with an even least significant bit. Uses the `roundeven` LLVM intrinsic to do this.

Of the five IEEE 754 rounding modes, this is the only one that doesn't already have a round-to-integer function exposed by Rust (others are `round`, `floor`, `ceil`, and `trunc`).  Ties-to-even is also the rounding mode used for int-to-float and float-to-float `as` casts, as well as float arithmentic operations. So not having an explicit rounding method for it seems like an oversight.

Bikeshed: this PR currently uses `round_ties_even` for the name of the method. But maybe `round_ties_to_even` is better, or `round_even`, or `round_to_even`?
2023-03-07 09:43:12 +00:00
Antoni Boucher
cf9c2f840f Fix for diagnostics 2023-03-05 12:31:16 -05:00
Antoni Boucher
94538736a8 Update gccjit 2023-03-05 12:16:33 -05:00
Antoni Boucher
d725cfb6ab Merge commit '08a6d6e16b5efe217123e780398969946266268f' into sync-cg_gcc-2023-03-04 2023-03-05 12:03:19 -05:00
antoyo
08a6d6e16b
Merge pull request #255 from rust-lang/sync_from_rust_2023_feb_28_2
Sync from rust 2023 feb 28
2023-03-04 20:21:03 -05:00
Antoni Boucher
4b878ccab4 Fix tests 2023-03-04 19:49:03 -05:00
Antoni Boucher
3180da5529 Fix tests 2023-03-04 19:18:31 -05:00
Antoni Boucher
f83ede03f5 Fix tests 2023-03-04 18:52:25 -05:00
Antoni Boucher
42a89bd875 Fix tests 2023-03-04 15:41:30 -05:00
Antoni Boucher
9d5bc7c929 Fix tests 2023-03-04 15:25:34 -05:00