Skip to content

Commit b68e57b

Browse files
alexcrichtonmark-i-m
authored andcommitted
Bring the updating LLVM guide up to date
1 parent 1ff2ac0 commit b68e57b

File tree

1 file changed

+27
-35
lines changed

1 file changed

+27
-35
lines changed

src/codegen/updating-llvm.md

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,25 @@ For updates of LLVM that typically just update a bug, we cherry-pick the bugfix
3636
to the branch we're already using. The steps for this are:
3737

3838
1. Make sure the bugfix is in upstream LLVM.
39-
2. Identify the branch that rustc is currently using. The `src/llvm` submodule
40-
is always pinned to a branch of the
41-
[rust-lang/llvm](https://github.com/rust-lang/llvm) repository.
42-
3. Fork the rust-lang/llvm repository
43-
4. Check out the appropriate branch (typically named `rust-llvm-release-*`)
39+
2. Identify the branch that rustc is currently using. The `src/llvm-project`
40+
submodule is always pinned to a branch of the
41+
[rust-lang/llvm-project](https://github.com/rust-lang/llvm-project) repository.
42+
3. Fork the rust-lang/llvm-project repository
43+
4. Check out the appropriate branch (typically named `rustc/a.b-yyyy-mm-dd`)
4444
5. Cherry-pick the upstream commit onto the branch
4545
6. Push this branch to your fork
46-
7. Send a Pull Request to rust-lang/llvm to the same branch as before
46+
7. Send a Pull Request to rust-lang/llvm-project to the same branch as before
4747
8. Wait for the PR to be merged
48-
9. Send a PR to rust-lang/rust updating the `src/llvm` submodule with your bugfix
48+
9. Send a PR to rust-lang/rust updating the `src/llvm-project` submodule with
49+
your bugfix
4950
10. Wait for PR to be merged
5051

5152
The tl;dr; is that we can cherry-pick bugfixes at any time and pull them back
52-
into the rust-lang/llvm branch that we're using, and getting it into the
53+
into the rust-lang/llvm-project branch that we're using, and getting it into the
5354
compiler is just updating the submodule via a PR!
5455

5556
Example PRs look like:
56-
[#56313](https://github.com/rust-lang/rust/pull/56313)
57+
[#59089](https://github.com/rust-lang/rust/pull/59089)
5758

5859
## Feature updates
5960

@@ -66,37 +67,28 @@ lot more work. This is where we can't reasonably cherry-pick commits backwards
6667
so we need to do a full update. There's a lot of stuff to do here, so let's go
6768
through each in detail.
6869

69-
1. Create new branches in all repositories for this update. Branches should be
70-
named `rust-llvm-release-X-Y-Z-vA` where `X.Y.Z` is the LLVM version and `A`
71-
is just increasing based on if there's previous branches of this name. All
72-
repositories here should be branched at the same time from the upstream LLVM
73-
projects, we currently use https://github.com/llvm-mirror repositories. The
74-
list of repositories that need a new branch are:
75-
76-
* rust-lang/llvm
77-
* rust-lang/compiler-rt
78-
* rust-lang/lld
79-
* rust-lang-nursery/lldb
80-
* rust-lang-nursery/clang
81-
82-
2. Apply Rust-specific patches to LLVM repositories. All features and bugfixes
83-
are upstream, but there's often some weird build-related patches that don't
84-
make sense to upstream which we have on our repositories. These patches are
85-
typically the latest patches on the branch. All repositories, except `clang`,
86-
currently have Rust-specific patches.
70+
1. Create a new branch in the rust-lang/llvm-project repository. This branch
71+
should be named `rustc/a.b-yyyy-mm-dd` where `a.b` is the current version
72+
number of LLVM in-tree at the time of the branch and the remaining part is
73+
today's date.
74+
75+
2. Apply Rust-specific patches to the llvm-project repository. All features and
76+
bugfixes are upstream, but there's often some weird build-related patches
77+
that don't make sense to upstream which we have on our repositories. These
78+
patches are around the latest patches in the rust-lang/llvm-project branch
79+
that rustc is currently using.
8780

8881
3. Update the `compiler-rt` submodule in the
89-
`rust-lang-nursery/compiler-builtins` repository. Push this update to a
90-
`rust-llvm-release-*` branch of the `compiler-builtins` repository.
82+
`rust-lang-nursery/compiler-builtins` repository. Push this update to the
83+
same branch name of the `llvm-project` submodule to the
84+
of the `rust-lang/compiler-rt` repository. Then push this update to a branch
85+
of `compiler-builtins` with the same-named branch. Note that this step is
86+
frequently optional since we may not need to update `compiler-rt`.
9187

9288
4. Prepare a commit to rust-lang/rust
9389

94-
* Update `src/llvm`
95-
* Update `src/tools/lld`
96-
* Update `src/tools/lldb`
97-
* Update `src/tools/clang`
98-
* Update `src/libcompiler_builtins
99-
* Edit `src/rustllvm/llvm-rebuild-trigger` to update its contents
90+
* Update `src/llvm-project`
91+
* Update `compiler-builtins` crate in `Cargo.lock` (if necessary)
10092

10193
5. Build your commit. Make sure you've committed the previous changes to ensure
10294
submodule updates aren't reverted. Some commands you should execute are:

0 commit comments

Comments
 (0)