Commit Graph

474 Commits

Author SHA1 Message Date
Amanieu d'Antras
14e0e0fec3 Stabilize asm_sym 2022-10-17 22:38:37 +01:00
bors
f0e40831df Auto merge of #2583 - RalfJung:rustup, r=oli-obk
initial josh subtree sync

This demonstrates what a josh-based rustup would look like with my patched josh. To create it I did
```
git fetch http://localhost:8000/rust-lang/rust.git:start=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri.git master
git merge FETCH_HEAD
./rustup-toolchain HEAD && ./miri fmt
git commit -am rustup
```
Unlike the [previous attempt](https://github.com/rust-lang/miri/pull/2554), this does not add a new root commit to the repo.

Once we merge this, we committed to using josh for subtree syncing, and in particular a version of josh that includes https://github.com/josh-project/josh/pull/961 (or something compatible).
2022-10-08 08:53:29 +00:00
bjorn3
413edf6771 Remove type argument of array_alloca and rename to byte_array_alloca 2022-10-02 13:42:14 +00:00
bjorn3
af0b18b454 Remove dynamic_alloca from BuilderMethods 2022-10-02 13:42:02 +00:00
bjorn3
3f43ee2407 Merge apply_attrs_callsite into call and invoke
Some codegen backends are not able to apply callsite attrs after the fact.
2022-10-01 17:01:31 +00:00
bjorn3
69a065ef81 Remove unused target_cpu and tune_cpu methods from ExtraBackendMethods 2022-10-01 16:45:33 +00:00
bjorn3
29edc888bd Remove several unused methods from MiscMethods 2022-10-01 16:45:07 +00:00
bjorn3
2db7a873de Remove unused Context assoc type from WriteBackendMethods 2022-10-01 16:34:45 +00:00
Matthias Krüger
869203cdb2 Rollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=davidtwco
Migrate rustc_codegen_gcc to SessionDiagnostics

As part of #100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate.

``@rustbot`` label +A-translation
2022-09-30 10:22:36 +02:00
Ellis Hoag
5ae3bf2ed3 print <signal> when ranlib failed without an exit code 2022-09-28 19:02:38 -07:00
Urgau
4d398832a5 Stabilize bench_black_box 2022-09-27 17:38:51 +02:00
Ellis Hoag
277b997adc lint and remove unused diagnostic 2022-09-26 19:57:40 -07:00
Ellis Hoag
d1741f6d62 remove comment 2022-09-24 15:03:14 -07:00
Ellis Hoag
0ae1e27b17 fix lifetime error 2022-09-24 11:36:16 -07:00
Ellis Hoag
43b3206571 rebase and update trait names 2022-09-24 11:06:05 -07:00
Ellis Hoag
5c839d995b impl SessionDiagnostic for LayoutError and Spanned<T> 2022-09-24 10:25:19 -07:00
Ellis Hoag
059326c4bd Add monomorphization errors 2022-09-24 10:24:48 -07:00
Ellis Hoag
70ab0548a0 lint type 2022-09-24 10:24:48 -07:00
Ellis Hoag
d3bb849fe9 Add wrapper type for ExitCode for use in RanlibFailure 2022-09-24 10:24:48 -07:00
Ellis Hoag
ff9bf7b6b3 remove IntoDiagnosticArg impl for Option 2022-09-24 10:24:48 -07:00
Ellis Hoag
1f3ae14c83 Lint against untranslatable diagnostics in rustc_codegen_gcc 2022-09-24 10:24:48 -07:00
Ellis Hoag
534ce39aac Add LayoutSizeOverflow 2022-09-24 10:24:48 -07:00
Ellis Hoag
33b58ebf22 Add LTONotSupported 2022-09-24 10:24:48 -07:00
Ellis Hoag
7fc07caf67 Add UnwindingInlineAsm 2022-09-24 10:24:48 -07:00
Ellis Hoag
7277046d84 Add LinkageConstOrMutType 2022-09-24 10:24:48 -07:00
Ellis Hoag
23eae52d45 Add RanlibFailure 2022-09-24 10:24:48 -07:00
Oli Scherer
c3dce60ac7 Remove dead broken code from const zst handling in backends 2022-09-06 14:09:49 +00:00
Dylan DPC
ecb861316e Rollup merge of #100653 - cuviper:fptoint_sat, r=michaelwoerister,antoyo
Move the cast_float_to_int fallback code to GCC

Now that we require at least LLVM 13, that codegen backend is always
using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it
doesn't need the manual implementation. However, the GCC backend still
needs it, so we can move all of that code down there.
2022-08-30 16:56:09 +05:30
Dylan DPC
f2d73af6d7 Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obk
interpret: make read-pointer-as-bytes a CTFE-only error with extra information

Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456.

Pointer-to-int transmutation during CTFE now produces a message like this:
```
   = help: this code performed an operation that depends on the underlying bytes representing a pointer
   = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
```

r? ``@oli-obk``
2022-08-30 11:26:51 +05:30
bors
7006047b2d Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcm
Add pointer masking convenience functions

This PR adds the following public API:
```rust
impl<T: ?Sized> *const T {
    fn mask(self, mask: usize) -> *const T;
}

impl<T: ?Sized> *mut T {
    fn mask(self, mask: usize) -> *const T;
}

// mod intrinsics
fn mask<T>(ptr: *const T, mask: usize) -> *const T
```
This is equivalent to `ptr.map_addr(|a| a & mask)` but also uses a cool llvm intrinsic.

Proposed in https://github.com/rust-lang/rust/pull/95643#issuecomment-1121562352

cc `@Gankra` `@scottmcm` `@RalfJung`

r? rust-lang/libs-api
2022-08-28 01:34:47 +00:00
Ralf Jung
c32ad5c229 interpret: rename relocation → provenance 2022-08-27 14:11:19 -04:00
bors
1a61b6e919 Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3
Shrink `FnAbi`

Because they can take up a lot of memory in debug and release builds.

r? `@bjorn3`
2022-08-27 14:00:53 +00:00
Nicholas Nethercote
89003418b3 Move ArgAbi::pad_i32 into PassMode::Cast.
Because it's only needed for that variant. This shrinks the types and
clarifies the logic.
2022-08-26 11:12:36 +10:00
Nicholas Nethercote
d83636d3fa Turn ArgAbi::pad into a bool.
Because it's only ever set to `None` or `Some(Reg::i32())`.
2022-08-26 10:53:41 +10:00
Yuki Okushi
5b1229eb45 Rollup merge of #100604 - dtolnay:okorerr, r=m-ou-se
Remove unstable Result::into_ok_or_err

Pending FCP: https://github.com/rust-lang/rust/issues/82223#issuecomment-1214920203

```@rustbot``` label +waiting-on-fcp
2022-08-26 09:51:44 +09:00
Nicholas Nethercote
5a6992916e Simplify arg capacity calculations.
Currently they try to be very precise. But they are wrong, i.e. they
don't match what's happening in the loop below. This code isn't hot
enough for it to matter that much.
2022-08-26 10:45:45 +10:00
Nicholas Nethercote
f78592f1bc Change FnAbi::args to a boxed slice. 2022-08-26 10:30:36 +10:00
Nicholas Nethercote
93191f66dc Box CastTarget within PassMode.
Because `PassMode::Cast` is by far the largest variant, but is
relatively rare.

This requires making `PassMode` not impl `Copy`, and `Clone` is no
longer necessary. This causes lots of sigil adjusting, but nothing very
notable.
2022-08-26 09:35:28 +10:00
Maybe Waffle
1acc3b45e3 Fix ptr_mask impl in cg gcc 2022-08-21 05:27:14 +04:00
Maybe Waffle
34d33f2299 Implement ptr_mask intrinsic in cg gcc 2022-08-21 05:27:14 +04:00
Maybe Waffle
928ef372c3 Replace most uses of pointer::offset with add and sub 2022-08-21 02:21:41 +04:00
David Tolnay
f21a3003e5 Remove unstable Result::into_ok_or_err 2022-08-17 17:20:42 -07:00
Josh Stone
0646f0dda6 Move the cast_float_to_int fallback code to GCC
Now that we require at least LLVM 13, that codegen backend is always
using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it
doesn't need the manual implementation. However, the GCC backend still
needs it, so we can move all of that code down there.
2022-08-16 15:46:17 -07:00
bjorn3
3a8ff6140b Introduce an ArchiveBuilderBuilder
This avoids monomorphizing all linker code for each codegen backend and
will allow passing in extra information to the archive builder from the
codegen backend.
2022-07-28 09:08:47 +00:00
bjorn3
56f34865ae Inline inject_dll_import_lib 2022-07-28 08:43:15 +00:00
bjorn3
a3ea31b846 Move output argument from ArchiveBuilder::new to .build() 2022-07-28 08:39:19 +00:00
bors
fe5cc38098 Auto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoerister
Enable raw-dylib for bin crates

Fixes #93842

When `raw-dylib` is used in a `bin` crate, we need to collect all of the `raw-dylib` functions, generate the import library and add that to the linker command line.

I also changed the tests so that 1) the C++ dlls are created after the Rust dlls, thus there is no chance of accidentally using them in the Rust linking process and 2) disabled generating import libraries when building with MSVC.
2022-07-26 01:47:34 +00:00
bors
c5528ce643 Auto merge of #95548 - rcvalle:rust-cfi-2, r=nagisa
Add fine-grained LLVM CFI support to the Rust compiler

This PR improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types.

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 https://github.com/rust-lang/rust/issues/89653).

LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).

Thank you again, `@eddyb,` `@nagisa,` `@pcc,` and `@tmiasko` for all the help!
2022-07-24 01:22:36 +00:00
Ramon de C Valle
bfe3c24e9a Add fine-grained LLVM CFI support to the Rust compiler
This commit improves the LLVM Control Flow Integrity (CFI) support in
the Rust compiler by providing forward-edge control flow protection for
Rust-compiled code only by aggregating function pointers in groups
identified by their return and parameter types.

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 CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e.,
-Clto).
2022-07-23 10:51:34 -07:00
Daniel Paoliello
fef3b3e27d Enable raw-dylib for binaries 2022-07-22 09:55:14 -07:00