Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync rustc_codegen_cranelift #86927

Merged
merged 92 commits into from Jul 8, 2021
Merged

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Jul 7, 2021

The main hightlight this sync is basic support for AArch64. Most things should work on Linux, but there does seem to be an ABI incompatibility causing proc-macros to crash, see rust-lang/rustc_codegen_cranelift#1184. Thanks to @afonso360 for implementing all Cranelift features that were necessary to compile for AArch64 using cg_clif. Also thanks to @shamatar for implementing the llvm.x86.addcarry.64 and llvm.x86.subborrow.64 llvm intrinsics used by num-bigint (rust-lang/rustc_codegen_cranelift#1178) and @eggyal for implementing multi-threading support for the lazy jit mode. (rust-lang/rustc_codegen_cranelift#1166)

r? @ghost

@rustbot label +A-codegen +A-cranelift +T-compiler

alessandrod and others added 30 commits May 23, 2021 18:03
This change adds the bpfel-unknown-none and bpfeb-unknown-none targets
which can be used to generate little endian and big endian BPF
Both cg_llvm and cg_clif don't override it. cg_spirv does override it,
so it needs to be preserved.
…k(kind = "raw-dylib")].

This does not yet support #[link_name] attributes on functions, the #[link_ordinal]
attribute, #[link(kind = "raw-dylib")] on extern blocks in bin crates, or
stdcall functions on 32-bit x86.
BPF target support

This adds `bpfel-unknown-none` and `bpfeb-unknown-none`, two new no_std targets that generate little and big endian BPF. The approach taken is very similar to the cuda target, where `TargetOptions::obj_is_bitcode` is enabled and code generation is done by the linker.

I added the targets to `dist-various-2`. There are [some tests](https://github.com/alessandrod/bpf-linker/tree/main/tests/assembly) in bpf-linker and I'm planning to add more. Those are currently not ran as part of rust CI.
…enkov

Partial support for raw-dylib linkage

First cut of functionality for issue rust-lang#58713: add support for `#[link(kind = "raw-dylib")]` on `extern` blocks in lib crates compiled to .rlib files.  Does not yet support `#[link_name]` attributes on functions, or the `#[link_ordinal]` attribute, or `#[link(kind = "raw-dylib")]` on `extern` blocks in bin crates; I intend to publish subsequent PRs to fill those gaps.  It's also not yet clear whether this works for functions in `extern "stdcall"` blocks; I also intend to investigate that shortly and make any necessary changes as a follow-on PR.

This implementation calls out to an LLVM function to construct the actual `.idata` sections as temporary `.lib` files on disk and then links those into the generated .rlib.
Driver improvements

This PR contains a couple of cleanups for the driver and a few small improvements for the custom codegen backend interface. It also implements `--version` and `-Cpasses=list` support for custom codegen backends.
…ochenkov

Unify duplicate linker_and_flavor methods in rustc_codegen_{cranelift,ssa}.

The two methods were exactly the same so this removes the cranelift copy. This will help make sure both they don't get out of sync.
Drop metadata_encoding_version.

Part of rust-lang#85153

r? `@Aaron1011`
@rustbot rustbot added A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 7, 2021
@rust-log-analyzer

This comment has been minimized.

Object started depending on it
@bjorn3
Copy link
Member Author

bjorn3 commented Jul 7, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Jul 7, 2021

📌 Commit 00b2f56 has been approved by bjorn3

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 7, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jul 7, 2021
…jorn3

Sync rustc_codegen_cranelift

The main hightlight this sync is basic support for AArch64. Most things should work on Linux, but there does seem to be an ABI incompatibility causing proc-macros to crash, see rust-lang/rustc_codegen_cranelift#1184. Thanks to `@afonso360` for implementing all Cranelift features that were necessary to compile for AArch64 using cg_clif. Also thanks to `@shamatar` for implementing the `llvm.x86.addcarry.64` and `llvm.x86.subborrow.64` llvm intrinsics used by num-bigint (rust-lang/rustc_codegen_cranelift#1178) and `@eggyal` for implementing multi-threading support for the lazy jit mode. (rust-lang/rustc_codegen_cranelift#1166)

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jul 7, 2021
…jorn3

Sync rustc_codegen_cranelift

The main hightlight this sync is basic support for AArch64. Most things should work on Linux, but there does seem to be an ABI incompatibility causing proc-macros to crash, see rust-lang/rustc_codegen_cranelift#1184. Thanks to ``@afonso360`` for implementing all Cranelift features that were necessary to compile for AArch64 using cg_clif. Also thanks to ``@shamatar`` for implementing the `llvm.x86.addcarry.64` and `llvm.x86.subborrow.64` llvm intrinsics used by num-bigint (rust-lang/rustc_codegen_cranelift#1178) and ``@eggyal`` for implementing multi-threading support for the lazy jit mode. (rust-lang/rustc_codegen_cranelift#1166)

r? ``@ghost``

``@rustbot`` label +A-codegen +A-cranelift +T-compiler
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 8, 2021
Rollup of 9 pull requests

Successful merges:

 - rust-lang#86639 (Support lint tool names in rustc command line options)
 - rust-lang#86812 (Recover from `&dyn mut ...` parse errors)
 - rust-lang#86917 (Add doc comment for `impl From<LayoutError> for TryReserveError`)
 - rust-lang#86925 (Add self to mailmap)
 - rust-lang#86927 (Sync rustc_codegen_cranelift)
 - rust-lang#86932 (Fix ICE when misplaced visibility cannot be properly parsed)
 - rust-lang#86933 (Clean up rustdoc static files)
 - rust-lang#86955 (Fix typo in `ops::Drop` docs)
 - rust-lang#86956 (Revert "Add "every" as a doc alias for "all".")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 89638a1 into rust-lang:master Jul 8, 2021
@rustbot rustbot added this to the 1.55.0 milestone Jul 8, 2021
@bjorn3 bjorn3 deleted the sync_cg_clif-2021-07-07 branch July 8, 2021 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet