Commit Graph

422 Commits

Author SHA1 Message Date
William D. Jones
94dc3753aa Add preliminary support for inline assembly for msp430. 2022-01-22 23:42:46 -05:00
bjorn3
47c311a705 Use Symbol for target features in asm handling
This saves a couple of Symbol::intern calls
2022-01-17 18:06:27 +01:00
Antoni Boucher
e690fb1273 Add comment 2022-01-15 08:57:34 -05:00
Tomasz Miąsko
68cbb46913 Remove deprecated LLVM-style inline assembly 2022-01-12 18:51:31 +01:00
Aaron Hill
09afd64969 Store a Symbol instead of an Ident in VariantDef/FieldDef
The field is also renamed from `ident` to `name. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.

This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.
2022-01-11 10:16:22 -05:00
Josh Triplett
37069f1a08 Update references to -Z symbol-mangling-version to use -C
Replace `-Z symbol-mangling-version=v0` with `-C symbol-mangling-version=v0`.

Replace `-Z symbol-mangling-version=legacy` with
`-Z unstable-options -C symbol-mangling-version=legacy`.
2022-01-01 15:53:11 -08:00
antoyo
0be9d1e887
Merge pull request #114 from bjorn3/sync_from_rust
Sync from rust 028c6f1454
2022-01-01 12:04:05 -05:00
bors
da4a39264b Auto merge of #92419 - erikdesjardins:coldland, r=nagisa
Mark drop calls in landing pads `cold` instead of `noinline`

Now that deferred inlining has been disabled in LLVM (#92110), this shouldn't cause catastrophic size blowup.

I confirmed that the test cases from https://github.com/rust-lang/rust/issues/41696#issuecomment-298696944 still compile quickly (<1s) after this change. ~Although note that I wasn't able to reproduce the original issue using a recent rustc/llvm with deferred inlining enabled, so those tests may no longer be representative. I was also unable to create a modified test case that reproduced the original issue.~ (edit: I reproduced it on CI by accident--the first commit timed out on the LLVM 12 builder, because I forgot to make it conditional on LLVM version)

r? `@nagisa`
cc `@arielb1` (this effectively reverts #42771 "mark calls in the unwind path as !noinline")
cc `@RalfJung` (fixes #46515)

edit: also fixes #87055
2022-01-01 13:28:13 +00:00
bjorn3
e6e46055df Remove unused extern crate rustc_symbol_mangling 2021-12-31 16:57:33 +01:00
bjorn3
54d2ec1a82 Merge commit '1411a98352ba6bee8ba3b0131c9243e5db1e6a2e' into sync_cg_clif-2021-12-31 2021-12-31 16:26:32 +01:00
bjorn3
1411a98352 Remove unnecessary report_symbol_names call (#113)
rustc_interface already calls it for you
2021-12-30 13:55:42 -05:00
bjorn3
92fbc8f591 Ignore new failing test_is_sorted test 2021-12-30 18:16:04 +01:00
bjorn3
0afd012837 Disable long running libcore tests
These only finish in reasonable time with optimizations enabled.

This patch file is copied from cg_clif.
2021-12-30 17:50:54 +01:00
bjorn3
d7fb7aa76d Disable portable-simd test
Support for portable-simd isn't implemented yet
2021-12-30 16:57:11 +01:00
bjorn3
a2c5d29fc9 Add missing feature gate 2021-12-30 16:41:11 +01:00
bjorn3
31482a94a0 Import std::arch::asm 2021-12-30 15:36:30 +01:00
bjorn3
049b6aeba4 Rustup to rustc 1.59.0-nightly (78fd0f633 2021-12-29) 2021-12-30 15:30:27 +01:00
bjorn3
ebc6ad4185 Sync from rust 65d8785f0a 2021-12-30 15:25:38 +01:00
Erik Desjardins
f3e1f33e3c keep noinline for system llvm < 14 2021-12-30 00:15:51 -05:00
Erik Desjardins
2fec53053e Mark drop calls in landing pads cold instead of noinline
Now that deferred inlining has been disabled in LLVM,
this shouldn't cause catastrophic size blowup.
2021-12-29 15:47:49 -05:00
bors
c5d0023afb Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
Remove `SymbolStr`

This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.

Best reviewed one commit at a time.

r? `@oli-obk`
2021-12-19 09:31:37 +00:00
antoyo
2989a25273
Feature/global rvalue initialization petter tomner (#111)
* Use new initialization functions

* Fix for new reflection patch

* Fix for new TLS patch
2021-12-15 23:48:10 -05:00
antoyo
ddb015a09e
Fix discarded in-out constraint in inline asm (#110)
Fixes #109
2021-12-15 22:06:16 -05:00
Nicholas Nethercote
bba8b97b83 Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
Matthias Krüger
f87a8f88e3 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/..`.
2021-12-15 01:28:06 +01:00
Tomasz Miąsko
379fb40277 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/..`.
2021-12-13 00:00:00 +00:00
Amanieu d'Antras
eec5f919e7 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.
2021-12-12 11:20:03 +00:00
Matthias Krüger
c6009ca30f Rollup merge of #91625 - est31:remove_indexes, r=oli-obk
Remove redundant [..]s
2021-12-10 22:40:36 +01:00
Matthias Krüger
10a9b1202b 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``
2021-12-09 05:08:32 +01:00
est31
b1d329ba55 Remove redundant [..]s 2021-12-09 00:01:29 +01:00
bors
2e7bc96321 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`
2021-12-08 14:58:48 +00:00
Amanieu d'Antras
0d936e19c9 Remove the reg_thumb register class for asm! on ARM
Also restricts r8-r14 from being used on Thumb1 targets as per #90736.
2021-12-07 23:54:09 +00:00
Nikita Popov
98afc30b95 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.
2021-12-07 09:39:05 +01:00
Andrew Dona-Couch
4e68093d8c Implement inline asm! for AVR platform 2021-12-06 01:02:49 -05:00
cynecx
4fa64fd1c3 rustc_codegen_gcc: proper check for may_unwind 2021-12-03 23:51:49 +01:00
cynecx
b7cb08d4e7 rustc_codegen_gcc: error on unwinding inline asm 2021-12-03 23:51:49 +01:00
bors
48fc7d9351 Auto merge of #91003 - psumbera:sparc64-abi, r=nagisa
fix sparc64 ABI for aggregates with floating point members

Fixes #86163
2021-12-02 02:59:44 +00:00
Petr Sumbera
dcd48250d7 fix sparc64 ABI for aggregates with floating point members 2021-12-01 10:03:45 +01:00
rdambrosio
0d61135280 Feat: make cg_ssa get_param borrow the builder mutable 2021-11-23 22:30:20 -05:00
Andreas Jonson
a912fedd0f Remove workaround for the forward progress handling in LLVM 2021-11-14 16:35:09 +01:00
antoyo
ebe6f6785c
Fix negation operation (#108) 2021-10-31 14:27:52 -04:00
bjorn3
08183f9f2d
Remove unused dependency on object (#102) 2021-10-31 12:17:13 -04:00
antoyo
fc8e79fea9
Sync from rust (#107)
* Rebase fallout.

* Move rustc_middle::middle::cstore to rustc_session.

* 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.

* Remove alloc::prelude

As per the libs team decision in #58935.

Closes #58935

* Make hash_result an Option.

* Properly check `target_features` not to trigger an assertion

* 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).

* Update to nightly-2021-10-30

* Add deduplication of constant values as rustc relies on LLVM doing that

Co-authored-by: Camille GILLOT <gillot.camille@gmail.com>
Co-authored-by: Michael Woerister <michaelwoerister@posteo>
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
Co-authored-by: Yuki Okushi <yuki.okushi@huawei.com>
Co-authored-by: Ramon de C Valle <rcvalle@users.noreply.github.com>
2021-10-30 18:21:33 -04:00
bors
d5a6aafb88 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!
2021-10-27 09:19:42 +00:00
Yuki Okushi
8094e2e5ae Properly check target_features not to trigger an assertion 2021-10-26 11:02:51 +09:00
Ramon de C Valle
14b83de047 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).
2021-10-25 16:23:01 -07:00
antoyo
1d064f1741
Disable strict aliasing (#104) 2021-10-25 17:48:15 -04:00
Camille GILLOT
ce9faca631 Make hash_result an Option. 2021-10-20 18:29:18 +02:00
Amanieu d'Antras
98f0580cdb Remove alloc::prelude
As per the libs team decision in #58935.

Closes #58935
2021-10-15 01:41:31 +02:00
Fisher Darling
863cfb2d63
Fix FIXME in Builder::and and Builder::or impls (#101)
* impl bitwise and & or
2021-10-12 12:39:14 -04:00