Commit Graph

877 Commits

Author SHA1 Message Date
antoyo
4d8c6d3502
Merge pull request #277 from rust-lang/feature/global-visibility
Set visibility of global
2023-05-25 19:35:38 -04:00
bors
a3c1f42c18 Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix
Support #[global_allocator] without the allocator shim

This makes it possible to use liballoc/libstd in combination with `--emit obj` if you use `#[global_allocator]`. This is what rust-for-linux uses right now and systemd may use in the future. Currently they have to depend on the exact implementation of the allocator shim to create one themself as `--emit obj` doesn't create an allocator shim.

Note that currently the allocator shim also defines the oom error handler, which is normally required too. Once `#![feature(default_alloc_error_handler)]` becomes the only option, this can be avoided. In addition when using only fallible allocator methods and either `--cfg no_global_oom_handling` for liballoc (like rust-for-linux) or `--gc-sections` no references to the oom error handler will exist.

To avoid this feature being insta-stable, you will have to define `__rust_no_alloc_shim_is_unstable` to avoid linker errors.

(Labeling this with both T-compiler and T-lang as it originally involved both an implementation detail and had an insta-stable user facing change. As noted above, the `__rust_no_alloc_shim_is_unstable` symbol requirement should prevent unintended dependence on this unstable feature.)
2023-05-25 16:59:57 +00:00
Antoni Boucher
a512e98028 Set visibility of global 2023-05-25 10:03:41 -04:00
John Kåre Alsaker
e5b58425f6 Move expansion of query macros in rustc_middle to rustc_middle::query 2023-05-15 08:49:13 +02:00
bjorn3
da466a2adc Prevent insta-stable no alloc shim support
You will need to add the following as replacement for the old __rust_*
definitions when not using the alloc shim.

    #[no_mangle]
    static __rust_no_alloc_shim_is_unstable: u8 = 0;
2023-05-11 14:35:09 +00:00
bjorn3
2be697f60d Use global_fn_name instead of format! 2023-05-11 14:35:09 +00:00
bjorn3
c50427ba86 Split AllocatorKind::fn_name in global_fn_name and default_fn_name 2023-05-11 14:35:08 +00:00
bjorn3
35836b326b Don't use an allocator shim for #[global_allocator]
This makes it possible to use liballoc/libstd in combination with
`--emit obj` if you use `#[global_allocator]`. Making it work for the
default libstd allocator would require weak functions, which are not
well supported on all systems.
2023-05-11 14:23:31 +00:00
Gary Guo
59177fcb60 Add todo for filter landing pad 2023-05-07 12:38:47 +01:00
Gary Guo
77375ab814 Use landingpad filter to encode aborting landing pad 2023-05-07 12:35:54 +01:00
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