880 Commits

Author SHA1 Message Date
Oli Scherer
4238ce2195 s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
David Wood
9c6f7cb3c7 session: diagnostic migration lint on more fns
Apply the diagnostic migration lint to more functions on `Session`.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30 17:11:35 +00:00
antoyo
8d0ff6bf07
Merge pull request #249 from rust-lang/fix/signed-integer-overflow
Fix/signed integer overflow
2023-01-26 18:26:52 -05:00
Antoni Boucher
2dc7dbc012 Run rustc's testsuite in release mode 2023-01-26 17:39:34 -05:00
Antoni Boucher
41f5e701e6 Fix signed integer overflow 2023-01-26 17:14:09 -05:00
antoyo
e6024f3bf3
Merge pull request #246 from rust-lang/cleanup
Cleanup
2023-01-26 17:13:50 -05:00
Antoni Boucher
fa6ae3c8bb Cleanup 2023-01-26 13:53:36 -05:00
Erik Desjardins
01241f8888 create and use GlobalAlloc::address_space 2023-01-25 01:46:19 -05:00
Erik Desjardins
559b57e50a abi: add AddressSpace field to Primitive::Pointer
...and remove it from `PointeeInfo`, which isn't meant for this.

There are still various places (marked with FIXMEs) that assume all pointers
have the same size and alignment. Fixing this requires parsing non-default
address spaces in the data layout string, which will be done in a followup.
2023-01-22 23:41:39 -05:00
Antoni Boucher
f5ced68a66 Adjust failing tests 2023-01-22 20:16:46 -05:00
antoyo
f6ad065fc8
Merge pull request #243 from bjorn3/no_codegen_hir
Avoid a hir access inside get_static
2023-01-13 21:36:51 -05:00
bjorn3
7fa06f6b88 Avoid a hir access inside get_static 2023-01-12 20:26:24 +00:00
Albert Larsan
2671f378bc Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
antoyo
6c5a70de20
Merge pull request #244 from rust-lang/feature/unwinding
Implement unwinding
2023-01-11 00:24:47 -05:00
Antoni Boucher
8e77fbf0cc Fix LLVM builtin mapping 2023-01-10 18:38:50 -05:00
Antoni Boucher
246ba9b393 Add missing libgccjit 12 failing tests 2023-01-09 22:19:10 -05:00
Antoni Boucher
ea75295180 Fix tests 2023-01-09 19:41:13 -05:00
Antoni Boucher
5f8cdd2d36 Fix tests 2023-01-09 18:27:16 -05:00
Antoni Boucher
e87b01447f Add missing failing tests 2023-01-09 18:08:50 -05:00
Antoni Boucher
4b628e5334 Fix tests 2023-01-09 17:42:35 -05:00
Antoni Boucher
f1f136bb66 Fix tests 2023-01-09 17:27:28 -05:00
Antoni Boucher
2bf7fb402b Use gccjit from repo 2023-01-09 17:12:08 -05:00
Antoni Boucher
af8db759be Support libgccjit12 2023-01-09 17:04:59 -05:00
Antoni Boucher
70659f7591 Cleanup 2023-01-08 11:42:00 -05:00
Antoni Boucher
a4b74e3adf Fix unwinding 2023-01-06 10:42:38 -05:00
Michael Goulet
26c010c941 Simplify some iterator combinators 2023-01-04 00:48:07 +00:00
Antoni Boucher
7c1d21c3b9 Don't automatically run asm_tests in test.sh 2023-01-03 15:08:07 -05:00
Antoni Boucher
71d7e561bd Comment 2023-01-03 08:56:00 -05:00
Antoni Boucher
b0cf0e8c06 WIP 2023-01-02 14:57:38 -05:00
Antoni Boucher
889a33a500 WIP: Implement unwinding 2023-01-02 14:57:38 -05:00
Jeremy Stucki
2d09c9bc94 Add missing anonymous lifetime 2022-12-20 22:34:42 +01:00
Jeremy Stucki
b4e9ba5cf3 rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
bors
6ec5ebdc2c Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisa
Use struct types during codegen in less places

This makes it easier to use cg_ssa from a backend like Cranelift that doesn't have any struct types at all. After this PR struct types are still used for function arguments and return values. Removing those usages is harder but should still be doable.
2022-12-12 10:38:31 +00:00
Jules Bertholet
ac4e9caaf5 Add round_ties_even to f32 and f64 2022-12-11 01:20:17 -05:00
Matthias Krüger
79f7b7b874 Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3
Add LLVM KCFI support to the Rust compiler

This PR adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.)

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) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653).

LLVM KCFI can be enabled with -Zsanitizer=kcfi.

Thank you again, `@bjorn3,` `@eddyb,` `@nagisa,` and `@ojeda,` for all the help!
2022-12-10 09:24:43 +01:00
Ramon de C Valle
d5f7c20ce5 Add LLVM KCFI support to the Rust compiler
This commit adds LLVM Kernel Control Flow Integrity (KCFI) support to
the Rust compiler. It initially provides forward-edge control flow
protection for operating systems kernels for Rust-compiled code only by
aggregating function pointers in groups identified by their return and
parameter types. (See llvm/llvm-project@cff5bef.)

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) will be provided in later work as
part of this project by identifying C char and integer type uses at the
time types are encoded (see Type metadata in the design document in the
tracking issue #89653).

LLVM KCFI can be enabled with -Zsanitizer=kcfi.

Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-12-08 17:24:39 -08:00
Peter Collingbourne
6181cb2929 Move linkage type check to HIR analysis and fix semantics issues.
This ensures that the error is printed even for unused variables,
as well as unifying the handling between the LLVM and GCC backends.

This also fixes unusual behavior around exported Rust-defined variables
with linkage attributes. With the previous behavior, it appears to be
impossible to define such a variable such that it can actually be imported
and used by another crate. This is because on the importing side, the
variable is required to be a pointer, but on the exporting side, the
type checker rejects static variables of pointer type because they do
not implement `Sync`. Even if it were possible to import such a type, it
appears that code generation on the importing side would add an unexpected
additional level of pointer indirection, which would break type safety.

This highlighted that the semantics of linkage on Rust-defined variables
is different to linkage on foreign items. As such, we now model the
difference with two different codegen attributes: linkage for Rust-defined
variables, and import_linkage for foreign items.

This change gives semantics to the test
src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs which was
previously expected to fail to compile. Therefore, convert it into a
test that is expected to successfully compile.

The update to the GCC backend is speculative and untested.
2022-12-05 15:05:43 -08:00
bjorn3
213ced1c43 Destruct landing_pad return value before passing it to cg_ssa 2022-12-03 18:27:18 +00:00
bors
12224e81c9 Auto merge of #97485 - bjorn3:new_archive_writer, r=wesleywiser
Rewrite LLVM's archive writer in Rust

This allows it to be used by other codegen backends.

Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1155
2022-12-03 15:07:39 +00:00
Matthias Krüger
f9805a2186 Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillot
Prefer doc comments over `//`-comments in compiler

Doc comments are generally nicer: they show up in the documentation, they are shown in IDEs when you hover other mentions of items, etc. Thus it makes sense to use them instead of `//`-comments.
2022-11-27 22:14:08 +01:00
Maybe Waffle
38dfdee36a Prefer doc comments over //-comments in compiler 2022-11-27 11:19:04 +00:00
bjorn3
690085c2da Rewrite LLVM's archive writer in Rust
This allows it to be used by other codegen backends
2022-11-26 19:35:32 +00:00
Chris Denton
39511672e7 Remove more redundant alls 2022-11-26 09:54:54 +00:00
antoyo
0a54f243f6
Merge pull request #225 from rust-lang/feature/stdarch-tests
Run stdarch tests in the CI
2022-11-25 15:12:29 -05:00
Antoni Boucher
054696e4a3 Disable stdarch examples which require unwinding 2022-11-25 11:38:49 -05:00
Antoni Boucher
3791646c02 Run stdarch tests in the CI 2022-11-25 11:38:49 -05:00
antoyo
8520bc7f9f
Merge pull request #174 from rust-lang/ci/ubuntu-libgccjit-12
Download libgccjit-12-dev package in the CI
2022-11-24 21:29:42 -05:00
antoyo
57b50df17e
Merge pull request #241 from rust-lang/fix/avx-intrinsics
Fix the argument order for some AVX-512 intrinsics
2022-11-24 21:27:42 -05:00
Antoni Boucher
69341c44cc Fix the argument order for some AVX-512 intrinsics 2022-11-24 18:32:17 -05:00
Antoni Boucher
bbc0c26508 Download libgccjit-12-dev package in the CI 2022-11-24 18:13:23 -05:00