Movatterモバイル変換


[0]ホーム

URL:


Google Git
Sign in
chromium /chromium /src /refs/heads/main /. /docs /updating_clang.md
blob: 1d5eefde7f8db7675c4bf1172d640a3a08bcc465 [file] [log] [blame] [view]
andybons3322f762015-08-24 21:37:09[diff] [blame]1# Updating clang
2
Nico Weber4071eca2018-09-25 12:29:14[diff] [blame]3We distribute prebuilt packages of LLVM binaries, including clangand lld, that
4all developersand bots pull at`gclient runhooks` time.These binaries are
5just regular LLVM binaries built at afixed upstream revision.This document
6describes how to build apackage at a newer revisionand updateChromium to it.
7An archive of all packages built so faris at https://is.gd/chromeclang
8
Nico Weberf218afd2018-09-20 19:11:21[diff] [blame]91.Check that https://ci.chromium.org/p/chromium/g/chromium.clang/console
Arthur Eubanksa8722a52020-08-25 17:15:12[diff] [blame]10 looks reasonably green.Red botswith seemingly normal test failures are
11 usually ok, that likely means the testis brokenwith the stableClangas
12 well.
nodir06cbaa02015-08-25 17:15:24[diff] [blame]131.Sync yourChromium tree to the latest revision to pick up any plugin
Arthur Eubanksf055cc52020-06-10 02:21:37[diff] [blame]14 changes.
Hans Wennborgfbda6212025-04-04 14:30:44[diff] [blame]151.Run
16[go/chrome-promote-clang](https://goto.google.com/chrome-promote-clang),
17 passingin the revision of theClangandRustpackage version you want to
18 push.For example:
19
20```
21 $ copy_staging_to_prod_and_goma.sh --clang-rev llvmorg-21-init-5118-g52cd27e6-1 --rust-rev f7b43542838f0a4a6cfdb17fbeadf45002042a77-1
22 ```
23
24Alternatively,use
25[go/chrome-push-clang-to-goma](https://goto.google.com/chrome-push-clang-to-goma).
Nico Weber98926b022020-06-28 11:27:36[diff] [blame]26This takes a recent dry run CL to update clang,andif the trybots were
27 successful it will copy the binariesfrom the staging bucket to the
Hans Wennborgfbda6212025-04-04 14:30:44[diff] [blame]28 production one.
29
30Writing to the production bucket requires special permissions.
31Then it will push the packages to RBE.If you
Nico Weber98926b022020-06-28 11:27:36[diff] [blame]32donot have the necessary credentials todo the upload, ask
Arthur Eubanksf055cc52020-06-10 02:21:37[diff] [blame]33 clang@chromium.org to find someone who does.
Arthur Eubanksa8722a52020-08-25 17:15:12[diff] [blame]34*Alternatively, to create your own roll CL, you can manually run
35`tools/clang/scripts/upload_revision.py`with a recent upstream LLVM
Hans Wennborgfbda6212025-04-04 14:30:44[diff] [blame]36 commit hashas the argument.After the`*_upload_clang`and`*_upload_rust`
37 trybots are successfully finished, run
Arthur Eubanksa8722a52020-08-25 17:15:12[diff] [blame]38[go/chrome-promote-clang](https://goto.google.com/chrome-promote-clang)
Hans Wennborgfbda6212025-04-04 14:30:44[diff] [blame]39with thenewClangandRustpackage names.
Josip Sokcevica41c3c452024-05-30 15:25:38[diff] [blame]401.Run`tools/clang/scripts/sync_deps.py` to update the deps entriesin DEPS.
Hans Wennborgfbda6212025-04-04 14:30:44[diff] [blame]411.`gclient sync` to download those packages.
421.Run`tools/rust/gnrt_stdlib.py` to update the GN filesfor theRust standard library.
Nico Weber916702902020-01-30 19:25:47[diff] [blame]431.Run an exhaustiveset oftry jobs to test thenew compiler.The CL
Arthur Eubanksf055cc52020-06-10 02:21:37[diff] [blame]44 description created previouslyby upload_revision.py includes
45`Cq-Include-Trybots:` linesfor all needed bots, so it's sufficient to just
46 run `git cl try` (or hit "CQ DRY RUN" on gerrit).
471. Commit the roll CL from the previous step.
Takuto Ikuta7478af722024-05-27 07:23:19[diff] [blame]481. The bots will now pull the prebuilt binary, and RBE will have a matching
nodir06cbaa02015-08-25 17:15:24[diff] [blame]49 binary, too.
Nico Weber4071eca2018-09-25 12:29:14[diff] [blame]50
Arthur Eubanks637eab42020-06-15 18:03:07[diff] [blame]51## Performance regressions
52
53After doing a clang roll, you may get a performance bug assigned to you
54([example](https://crbug.com/1094671)). Some performance noise is expected
55while doing a clang roll.
56
57You can check all performance data for a clang roll via
58`https://chromeperf.appspot.com/group_report?rev=XXXXXX`, where `XXXXXX` is the
Hans Wennborgfbda6212025-04-04 14:30:44[diff] [blame]59Chromium revision number, e.g. `778090` for the example bug (look in the first
60message of the performance bug to find this). Click the checkboxes to display
61graphs. Hover over points in the graph to see the value and error.
Arthur Eubanks637eab42020-06-15 18:03:07[diff] [blame]62
63Serious regressions require bisecting upstream commits (TODO: how to repro?).
64If the regressions look insignificant and there is green as well as red, you
65can close the bug as "WontFix" with an explanation.
66
Nico Weber4071eca2018-09-25 12:29:14[diff] [blame]67## Adding files to the clang package
68
69The clang package is downloaded unconditionally by all bots and devs. It's
70called"clang"for historical reasons, but nowadays also contains other
71mission-critical toolchain pieces besides clang.
72
73Wetry to limit the contents of the clangpackage.They should meet these
74criteria:
75
76- things that are usedby most developersuse most of the time(e.g. a
77 compiler, a linker, sanitizer runtimes)
78- things neededfor doing official builds
79
Andrew Grieve2989fb82024-04-22 14:42:36[diff] [blame]80# Adding a New Package
Nico Weber4071eca2018-09-25 12:29:14[diff] [blame]81
Andrew Grieve2989fb82024-04-22 14:42:36[diff] [blame]82If you want to make artifacts available thatdonot meet the criteriafor
83being includedin the"clang"package, you can makepackage.py upload it to
84a separate zip fileandthen download it on an opt-in basisbyusing
85update.py's --package option. Here is [an example of adding a new package].
86
87To test changes to `package.py`, change `CLANG_SUB_REVISION` in `update.py` to
88a random number above 2000 and run the `*_upload_clang` trybots.
89
90Once the change to `package.py` is in, file a bug under `Tools > LLVM`
91requesting that a new package be created ([example bug]).
92
93Once it's been uploadedand rolled, you can download it via:
94
95```
96tools/clang/scripts/update.py --package your-package-name
97```
98
99[an example of adding anewpackage](https://chromium-review.googlesource.com/c/chromium/src/+/5463029)
Takuto Ikuta7478af722024-05-27 07:23:19[diff] [blame]100[example bug]: https://crbug.com/335730441
Hans Wennborg0499381b2025-04-07 11:13:59[diff] [blame]101
102# On local patches and cherry-picks
103
104Exceptfor the addition ofClang plugins, whichdonot affect the compiler
105output,Chromium's LLVM binaries are vanilla builds of the upstream source code
106at a specific revision, with no alterations.
107
108We believe this helps when working with upstream: our compiler should behave
109exactly the same as if someone else built LLVM at the same revision, making
110collaboration easier.
111
112It also creates an incentive for stabilizing the HEAD revision of LLVM: since
113we ship a vanilla build of an upstream revision, we have to ensure that a
114revision can be found which is stable enough to build Chromium and pass all its
115tests. While allowing local cherry-picks, reverts, or other patches, would
116probably allow more regular toolchain releases, we believe we can perform
117toolchain testing and fix issues fast enough that finding a stable revision is
118possible, and that this is the right trade-off for us and for the LLVM
119community.
120
121For Rust, since the interface between tip-of-tree rustc and LLVM is less
122stable, and since landing fixes in Rust is much slower (even after approval, a
123patch can take more than 24 hours to land), we allow cherry-picks of such fixes
124in our Rust toolchain build.

[8]ページ先頭

©2009-2025 Movatter.jp