andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 1 | # Updating clang |
| 2 | |
Nico Weber | 4071eca | 2018-09-25 12:29:14 | [diff] [blame] | 3 | We distribute prebuilt packages of LLVM binaries, including clang and lld, that |
| 4 | all developers and bots pull at `gclient runhooks` time. These binaries are |
| 5 | just regular LLVM binaries built at a fixed upstream revision. This document |
| 6 | describes how to build a package at a newer revision and update Chromium to it. |
| 7 | An archive of all packages built so far is at https://is.gd/chromeclang |
| 8 | |
Nico Weber | f218afd | 2018-09-20 19:11:21 | [diff] [blame] | 9 | 1. Check that https://ci.chromium.org/p/chromium/g/chromium.clang/console |
| 10 | looks reasonably green. |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 11 | 1. Sync your Chromium tree to the latest revision to pick up any plugin |
rnk | 61e1abc6 | 2016-05-04 16:50:21 | [diff] [blame] | 12 | changes |
pcc | c9228e4 | 2017-06-16 10:36:53 | [diff] [blame] | 13 | 1. Run `python tools/clang/scripts/upload_revision.py NNNN` |
hans | c3a6616 | 2017-05-12 16:27:07 | [diff] [blame] | 14 | with the target LLVM SVN revision number. This creates a roll CL on a new |
| 15 | branch, uploads it and starts tryjobs that build the compiler binaries into |
| 16 | a staging bucket on Google Cloud Storage (GCS). |
| 17 | 1. If the clang upload try bots succeed, copy the binaries from the staging |
| 18 | bucket to the production one. For example: |
| 19 | |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 20 | ```shell |
Nico Weber | 8c53321 | 2020-01-23 16:39:56 | [diff] [blame] | 21 | $ export rev=n123456-abcd1234-1 |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 22 | $ for x in Linux_x64 Mac Win ; do \ |
| 23 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/clang-$rev.tgz \ |
| 24 | gs://chromium-browser-clang/$x/clang-$rev.tgz ; \ |
Nico Weber | c3ea97e | 2019-05-06 22:30:27 | [diff] [blame] | 25 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/clang-$rev-buildlog.txt \ |
| 26 | gs://chromium-browser-clang/$x/clang-$rev-buildlog.txt ; \ |
George Burgess IV | 6d81dc1 | 2019-12-05 23:29:28 | [diff] [blame] | 27 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/clang-tidy-$rev.tgz \ |
| 28 | gs://chromium-browser-clang/$x/clang-tidy-$rev.tgz ; \ |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 29 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/llvmobjdump-$rev.tgz \ |
| 30 | gs://chromium-browser-clang/$x/llvmobjdump-$rev.tgz ; \ |
| 31 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/translation_unit-$rev.tgz \ |
| 32 | gs://chromium-browser-clang/$x/translation_unit-$rev.tgz ; \ |
| 33 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/llvm-code-coverage-$rev.tgz \ |
| 34 | gs://chromium-browser-clang/$x/llvm-code-coverage-$rev.tgz ; \ |
Taylor Woll | 8e542333 | 2019-10-24 17:34:20 | [diff] [blame] | 35 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/libclang-$rev.tgz \ |
| 36 | gs://chromium-browser-clang/$x/libclang-$rev.tgz ; \ |
Hans Wennborg | 955cfdf | 2019-07-17 14:00:47 | [diff] [blame] | 37 | done && gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/Mac/lld-$rev.tgz \ |
| 38 | gs://chromium-browser-clang/Mac/lld-$rev.tgz |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 39 | ``` |
Hans Wennborg | e583b5e | 2017-10-11 02:40:55 | [diff] [blame] | 40 | |
George Burgess IV | 587ef37 | 2019-12-14 03:42:24 | [diff] [blame] | 41 | **Note** that writing to this bucket requires special permissions. File a |
| 42 | bug at g.co/bugatrooper if you don't have these already (e.g., |
| 43 | https://crbug.com/1034081). |
| 44 | |
hans | c3a6616 | 2017-05-12 16:27:07 | [diff] [blame] | 45 | 1. Run the goma package update script to push these packages to goma. If you do |
| 46 | not have the necessary credentials to do the upload, ask [email protected] |
| 47 | to find someone who does |
Nico Weber | 91670290 | 2020-01-30 19:25:47 | [diff] [blame^] | 48 | 1. Run an exhaustive set of try jobs to test the new compiler. The CL |
| 49 | description created by upload_revision.py includes `CQ_INCLUDE_TRYBOTS` |
| 50 | lines for all needed bots, so it's sufficient to just run: |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 51 | |
| 52 | ```shell |
Nico Weber | 91670290 | 2020-01-30 19:25:47 | [diff] [blame^] | 53 | git cl try && \ |
Hans Wennborg | ddff372 | 2019-12-13 14:54:09 | [diff] [blame] | 54 | git cl try -B chrome/try -b iphone-device -b ipad-device \ |
| 55 | -b linux-chromeos-chrome |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 56 | ``` |
| 57 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 58 | 1. Commit roll CL from the first step |
| 59 | 1. The bots will now pull the prebuilt binary, and goma will have a matching |
| 60 | binary, too. |
Nico Weber | 4071eca | 2018-09-25 12:29:14 | [diff] [blame] | 61 | |
| 62 | ## Adding files to the clang package |
| 63 | |
| 64 | The clang package is downloaded unconditionally by all bots and devs. It's |
| 65 | called "clang" for historical reasons, but nowadays also contains other |
| 66 | mission-critical toolchain pieces besides clang. |
| 67 | |
| 68 | We try to limit the contents of the clang package. They should meet these |
| 69 | criteria: |
| 70 | |
| 71 | - things that are used by most developers use most of the time (e.g. a |
| 72 | compiler, a linker, sanitizer runtimes) |
| 73 | - things needed for doing official builds |
| 74 | |
| 75 | If you want to add something to the clang package that doesn't (yet?) meet |
| 76 | these criteria, you can make package.py upload it to a separate zip file |
Hans Wennborg | 8ee64a1 | 2019-11-05 17:31:30 | [diff] [blame] | 77 | and then download it on an opt-in basis by using update.py's --package option. |
Nico Weber | 4071eca | 2018-09-25 12:29:14 | [diff] [blame] | 78 | |
| 79 | If you're adding a new feature that you expect will meet the inclusion criteria |
| 80 | eventually but doesn't yet, start by having your things in a separate zip |
| 81 | and move it to the main zip once the criteria are met. |