]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #91868 - tmiasko:llvm-time-trace-out, r=oli-obk
Matthias Krüger [Wed, 15 Dec 2021 00:28:06 +0000 (01:28 +0100)]
Rollup merge of #91868 - tmiasko:llvm-time-trace-out, r=oli-obk

Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`

The resulting profile will include the crate name and will be stored in
the `--out-dir` directory.

This implementation makes it convenient to use LLVM time trace together
with cargo, in the contrast to the previous implementation which would
overwrite profiles or store them in `.cargo/registry/..`.

2 years agoUse `OutputFilenames` to generate output file for `-Zllvm-time-trace`
Tomasz Miąsko [Mon, 13 Dec 2021 00:00:00 +0000 (00:00 +0000)]
Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`

The resulting profile will include the crate name and will be stored in
the `--out-dir` directory.

This implementation makes it convenient to use LLVM time trace together
with cargo, in the contrast to the previous implementation which would
overwrite profiles or store them in `.cargo/registry/..`.

2 years agoStabilize asm! and global_asm!
Amanieu d'Antras [Fri, 10 Dec 2021 00:15:33 +0000 (00:15 +0000)]
Stabilize asm! and global_asm!

They are also removed from the prelude as per the decision in
https://github.com/rust-lang/rust/issues/87228.

stdarch and compiler-builtins are updated to work with the new, stable
asm! and global_asm! macros.

2 years agoRollup merge of #91625 - est31:remove_indexes, r=oli-obk
Matthias Krüger [Fri, 10 Dec 2021 21:40:36 +0000 (22:40 +0100)]
Rollup merge of #91625 - est31:remove_indexes, r=oli-obk

Remove redundant [..]s

2 years agoRollup merge of #90796 - Amanieu:remove_reg_thumb, r=joshtriplett
Matthias Krüger [Thu, 9 Dec 2021 04:08:32 +0000 (05:08 +0100)]
Rollup merge of #90796 - Amanieu:remove_reg_thumb, r=joshtriplett

Remove the reg_thumb register class for asm! on ARM

Also restricts r8-r14 from being used on Thumb1 targets as per #90736.

cc ``@Lokathor``

r? ``@joshtriplett``

2 years agoRemove redundant [..]s
est31 [Fri, 3 Dec 2021 02:06:36 +0000 (03:06 +0100)]
Remove redundant [..]s

2 years agoAuto merge of #91604 - nikic:section-flags, r=nagisa
bors [Wed, 8 Dec 2021 14:58:48 +0000 (14:58 +0000)]
Auto merge of #91604 - nikic:section-flags, r=nagisa

Use object crate for .rustc metadata generation

We already use the object crate for generating uncompressed .rmeta
metadata object files. This switches the generation of compressed
.rustc object files to use the object crate as well. These have
slightly different requirements in that .rmeta should be completely
excluded from any final compilation artifacts, while .rustc should
be part of shared objects, but not loaded into memory.

The primary motivation for this change is #90326: In LLVM 14, the
current way of setting section flags (and in particular, preventing
the setting of SHF_ALLOC) will no longer work. There are other ways
we could work around this, but switching to the object crate seems
like the most elegant, as we already use it for .rmeta, and as it
makes this independent of the codegen backend. In particular, we
don't need separate handling in codegen_llvm and codegen_gcc.
codegen_cranelift should be able to reuse the implementation as
well, though I have omitted that here, as it is not based on
codegen_ssa.

This change mostly extracts the existing code for .rmeta handling
to allow using it for .rustc as well, and adjusts the codegen
infrastructure to handle the metadata object file separately: We
no longer create a backend-specific module for it, and directly
produce the compiled module instead.

This does not `fix` #90326 by itself yet, as .llvmbc will need to be
handled separately.

r? `@nagisa`

2 years agoRemove the reg_thumb register class for asm! on ARM
Amanieu d'Antras [Thu, 11 Nov 2021 12:42:38 +0000 (12:42 +0000)]
Remove the reg_thumb register class for asm! on ARM

Also restricts r8-r14 from being used on Thumb1 targets as per #90736.

2 years agoUse object crate for .rustc metadata generation
Nikita Popov [Thu, 2 Dec 2021 11:24:25 +0000 (12:24 +0100)]
Use object crate for .rustc metadata generation

We already use the object crate for generating uncompressed .rmeta
metadata object files. This switches the generation of compressed
.rustc object files to use the object crate as well. These have
slightly different requirements in that .rmeta should be completely
excluded from any final compilation artifacts, while .rustc should
be part of shared objects, but not loaded into memory.

The primary motivation for this change is #90326: In LLVM 14, the
current way of setting section flags (and in particular, preventing
the setting of SHF_ALLOC) will no longer work. There are other ways
we could work around this, but switching to the object crate seems
like the most elegant, as we already use it for .rmeta, and as it
makes this independent of the codegen backend. In particular, we
don't need separate handling in codegen_llvm and codegen_gcc.
codegen_cranelift should be able to reuse the implementation as
well, though I have omitted that here, as it is not based on
codegen_ssa.

This change mostly extracts the existing code for .rmeta handling
to allow using it for .rustc as well, and adjust the codegen
infrastructure to handle the metadata object file separately: We
no longer create a backend-specific module for it, and directly
produce the compiled module instead.

This does not fix #90326 by itself yet, as .llvmbc will need to be
handled separately.

2 years agoImplement inline asm! for AVR platform
Andrew Dona-Couch [Thu, 25 Nov 2021 04:04:27 +0000 (23:04 -0500)]
Implement inline asm! for AVR platform

2 years agorustc_codegen_gcc: proper check for may_unwind
cynecx [Fri, 19 Nov 2021 22:37:09 +0000 (23:37 +0100)]
rustc_codegen_gcc: proper check for may_unwind

2 years agorustc_codegen_gcc: error on unwinding inline asm
cynecx [Fri, 12 Nov 2021 23:37:30 +0000 (00:37 +0100)]
rustc_codegen_gcc: error on unwinding inline asm

2 years agoAuto merge of #91003 - psumbera:sparc64-abi, r=nagisa
bors [Thu, 2 Dec 2021 02:59:44 +0000 (02:59 +0000)]
Auto merge of #91003 - psumbera:sparc64-abi, r=nagisa

fix sparc64 ABI for aggregates with floating point members

Fixes #86163

2 years agofix sparc64 ABI for aggregates with floating point members
Petr Sumbera [Wed, 1 Dec 2021 09:03:45 +0000 (10:03 +0100)]
fix sparc64 ABI for aggregates with floating point members

2 years agoFeat: make cg_ssa get_param borrow the builder mutable
rdambrosio [Wed, 24 Nov 2021 03:30:20 +0000 (22:30 -0500)]
Feat: make cg_ssa get_param borrow the builder mutable

2 years agoRemove workaround for the forward progress handling in LLVM
Andreas Jonson [Sun, 14 Nov 2021 13:01:30 +0000 (14:01 +0100)]
Remove workaround for the forward progress handling in LLVM

2 years agoAuto merge of #89652 - rcvalle:rust-cfi, r=nagisa
bors [Wed, 27 Oct 2021 09:19:42 +0000 (09:19 +0000)]
Auto merge of #89652 - rcvalle:rust-cfi, r=nagisa

Add LLVM CFI support to the Rust compiler

This PR adds LLVM Control Flow Integrity (CFI) support to the Rust compiler. It initially provides forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their number of arguments.

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 defining and using compatible type identifiers (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).

Thank you, `@eddyb` and `@pcc,` for all the help!

2 years agoProperly check `target_features` not to trigger an assertion
Yuki Okushi [Wed, 20 Oct 2021 19:56:36 +0000 (04:56 +0900)]
Properly check `target_features` not to trigger an assertion

2 years agoAdd LLVM CFI support to the Rust compiler
Ramon de C Valle [Thu, 7 Oct 2021 22:33:13 +0000 (15:33 -0700)]
Add LLVM CFI support to the Rust compiler

This commit adds LLVM Control Flow Integrity (CFI) support to the Rust
compiler. It initially provides forward-edge control flow protection for
Rust-compiled code only by aggregating function pointers in groups
identified by their number of arguments.

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 defining and using compatible type identifiers
(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).

2 years agoMake hash_result an Option.
Camille GILLOT [Sat, 16 Oct 2021 20:31:48 +0000 (22:31 +0200)]
Make hash_result an Option.

2 years agoRemove alloc::prelude
Amanieu d'Antras [Thu, 14 Oct 2021 23:41:31 +0000 (01:41 +0200)]
Remove alloc::prelude

As per the libs team decision in #58935.

Closes #58935

2 years agoAuto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiser
bors [Mon, 11 Oct 2021 04:31:47 +0000 (04:31 +0000)]
Auto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiser

Create more accurate debuginfo for vtables.

Before this PR all vtables would have the same name (`"vtable"`) in debuginfo. Now they get an unambiguous name that identifies the implementing type and the trait that is being implemented.

This is only one of several possible improvements:
- This PR describes vtables as arrays of `*const u8` pointers. It would nice to describe them as structs where function pointer is represented by a field with a name indicative of the method it maps to. However, this requires coming up with a naming scheme that avoids clashes between methods with the same name (which is possible if the vtable contains multiple traits).
- The PR does not update the debuginfo we generate for the vtable-pointer field in a fat `dyn` pointer. Right now there does not seem to be an easy way of getting ahold of a vtable-layout without also knowing the concrete self-type of a trait object.

r? `@wesleywiser`

2 years agoCreate more accurate debuginfo for vtables.
Michael Woerister [Wed, 6 Oct 2021 12:26:50 +0000 (14:26 +0200)]
Create more accurate debuginfo for vtables.

Before this commit all vtables would have the same name "vtable" in
debuginfo. Now they get a name that identifies the implementing type
and the trait that is being implemented.

2 years agoMove rustc_middle::middle::cstore to rustc_session.
Camille GILLOT [Sat, 14 Nov 2020 02:02:03 +0000 (03:02 +0100)]
Move rustc_middle::middle::cstore to rustc_session.

2 years agoRebase fallout.
Camille GILLOT [Thu, 30 Sep 2021 18:22:42 +0000 (20:22 +0200)]
Rebase fallout.

2 years agoFix warnings (#98)
antoyo [Tue, 28 Sep 2021 13:32:54 +0000 (09:32 -0400)]
Fix warnings (#98)

2 years agoUpdate to nightly-2021-09-28 (#97)
antoyo [Tue, 28 Sep 2021 13:18:27 +0000 (09:18 -0400)]
Update to nightly-2021-09-28 (#97)

2 years agoFix/count trailing zeroes (#95)
antoyo [Tue, 28 Sep 2021 00:35:45 +0000 (20:35 -0400)]
Fix/count trailing zeroes (#95)

* Fix count trailing zeroes
* Fix pop count
* Fix bit reverse

2 years agoFix/mismatch types (#94)
antoyo [Mon, 27 Sep 2021 23:31:24 +0000 (19:31 -0400)]
Fix/mismatch types (#94)

* Refactor test.sh script

* Fix mismatched types error

2 years agoCleanup fix for global initialization (#93)
antoyo [Mon, 27 Sep 2021 13:34:06 +0000 (09:34 -0400)]
Cleanup fix for global initialization (#93)

* Cleanup fix for global initialization
* Remove linker script hack
* Use v0 symbol mangling
* Fix warnings

2 years agoFix global initialization (#91)
antoyo [Sun, 26 Sep 2021 16:20:02 +0000 (12:20 -0400)]
Fix global initialization (#91)

* Make define_global() return a RValue directly
* Return LValue in functions declaring a global variable
* Remove useless cast
* Fix bytes_in_context to use an array rvalue
* Remove global_names which is unused
* Make const_struct create a constant struct
* Correctly initialize global in static_addr_of_mut
* Fix global variable initialization
* Remove workaround for ARGV

2 years agoImpove handling of registers in inline asm (#82)
Commeownist [Sun, 26 Sep 2021 13:30:45 +0000 (16:30 +0300)]
Impove handling of registers in inline asm (#82)

* Correctly handle st(0) register in the clobbers list
* Gate the clobbers based on enabled target features

2 years agoAdd notes for cross-compilation to gcc-only targets (#68)
antoyo [Sun, 26 Sep 2021 04:06:42 +0000 (00:06 -0400)]
Add notes for cross-compilation to gcc-only targets (#68)

2 years agoUpdate to nightly-2021-09-11 (#79)
Commeownist [Fri, 17 Sep 2021 21:19:25 +0000 (00:19 +0300)]
Update to nightly-2021-09-11 (#79)

* Implement `black_box` as intrinsic

Responsibility of implementing the black box is now lies on backend

* Remove some TODOs

* Update to nightly-2021-09-17

* CI: don't fail on warnings

2 years agofix: gh origin on readme (#83)
Emerson Laurentino [Fri, 17 Sep 2021 01:47:19 +0000 (22:47 -0300)]
fix: gh origin on readme (#83)

2 years agoRemove FUNDING.yml
Antoni Boucher [Thu, 16 Sep 2021 11:37:23 +0000 (07:37 -0400)]
Remove FUNDING.yml

2 years agoImplement basic inline asm support (#72)
Commeownist [Sun, 5 Sep 2021 15:26:01 +0000 (18:26 +0300)]
Implement basic inline asm support (#72)

* Implement basic support for inline assembly

* Disable LTO

We don't support it yet at all

* Handle `inout(reg) var` correctly

Turns out that `+` readwrite output registers cannot be tied with
input variables.

* Add limited support for llvm_asm!

* Handle CHANNEL correctly

* Add support for arbitrary explicit registers

* Handle symbols properly

* Add rudimentary asm tests

* Exclude llvm_asm! tests from tests runs

* Insert `__builtin_unreachable()` after diverging asm blocks

2 years agoUpdate custom rustc instructions (#73)
antoyo [Sat, 28 Aug 2021 15:34:47 +0000 (11:34 -0400)]
Update custom rustc instructions (#73)

2 years agoEmpty gcc_path
Antoni Boucher [Sun, 15 Aug 2021 14:54:12 +0000 (10:54 -0400)]
Empty gcc_path

2 years agoCleanup (#67)
antoyo [Sun, 15 Aug 2021 12:28:46 +0000 (08:28 -0400)]
Cleanup (#67)

2 years agoUpdate to nightly-2021-08-12 (#61)
antoyo [Sat, 14 Aug 2021 14:05:49 +0000 (10:05 -0400)]
Update to nightly-2021-08-12 (#61)

2 years agoInitial commit
Antoni Boucher [Sun, 10 May 2020 14:54:30 +0000 (10:54 -0400)]
Initial commit