blob: 00474feec6b40625e6ca90d5795552aa0fa7089a [file] [log] [blame] [view]
andybons3322f762015-08-24 21:37:091# Updating clang
2
Nico Weber4071eca2018-09-25 12:29:143We distribute prebuilt packages of LLVM binaries, including clang and lld, that
4all developers and bots pull at `gclient runhooks` time. These binaries are
5just regular LLVM binaries built at a fixed upstream revision. This document
6describes how to build a package at a newer revision and update Chromium to it.
7An archive of all packages built so far is at https://is.gd/chromeclang
8
Nico Weberf218afd2018-09-20 19:11:2191. Check that https://ci.chromium.org/p/chromium/g/chromium.clang/console
10 looks reasonably green.
nodir06cbaa02015-08-25 17:15:24111. Sync your Chromium tree to the latest revision to pick up any plugin
rnk61e1abc62016-05-04 16:50:2112 changes
pccc9228e42017-06-16 10:36:53131. Run `python tools/clang/scripts/upload_revision.py NNNN`
hansc3a66162017-05-12 16:27:0714 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).
171. If the clang upload try bots succeed, copy the binaries from the staging
18 bucket to the production one. For example:
19
ingloriond277c61f2017-09-15 23:08:0620 ```shell
Hans Wennborg9549a982019-05-22 07:51:2921 $ export rev=123456-abcd1234-1
ingloriond277c61f2017-09-15 23:08:0622 $ 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 Weberc3ea97e2019-05-06 22:30:2725 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 ; \
ingloriond277c61f2017-09-15 23:08:0627 gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/llvmobjdump-$rev.tgz \
28 gs://chromium-browser-clang/$x/llvmobjdump-$rev.tgz ; \
29 gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/translation_unit-$rev.tgz \
30 gs://chromium-browser-clang/$x/translation_unit-$rev.tgz ; \
31 gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/llvm-code-coverage-$rev.tgz \
32 gs://chromium-browser-clang/$x/llvm-code-coverage-$rev.tgz ; \
Taylor Woll8e5423332019-10-24 17:34:2033 gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/libclang-$rev.tgz \
34 gs://chromium-browser-clang/$x/libclang-$rev.tgz ; \
Hans Wennborg955cfdf2019-07-17 14:00:4735 done && gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/Mac/lld-$rev.tgz \
36 gs://chromium-browser-clang/Mac/lld-$rev.tgz
ingloriond277c61f2017-09-15 23:08:0637 ```
Hans Wennborge583b5e2017-10-11 02:40:5538
hansc3a66162017-05-12 16:27:07391. Run the goma package update script to push these packages to goma. If you do
40 not have the necessary credentials to do the upload, ask clang@chromium.org
41 to find someone who does
thakis3447dcd2016-05-05 18:17:15421. Run an exhaustive set of try jobs to test the new compiler:
ingloriond277c61f2017-09-15 23:08:0643
44 ```shell
Nico Weberb8603fb2018-05-21 15:42:1045 git cl try &&
Hans Wennborg31942cf2019-11-05 14:58:2946 git cl try -B chromium/try -b mac_chromium_asan_rel_ng \
Nico Weberf218afd2018-09-20 19:11:2147 -b linux_chromium_cfi_rel_ng \
inglorion475c6e192018-06-22 20:42:2548 -b linux_chromium_chromeos_asan_rel_ng -b linux_chromium_msan_rel_ng \
Hans Wennborga8d99632018-10-01 11:37:3749 -b linux_chromium_chromeos_msan_rel_ng -b linux-chromeos-dbg \
Hans Wennborgf6103012019-08-12 08:32:0350 -b win-asan -b chromeos-amd64-generic-cfi-thin-lto-rel \
Hans Wennborgf7e88972019-08-19 11:24:5851 -b linux_chromium_compile_dbg_32_ng -b win7-rel \
52 -b win-angle-deqp-rel-64 &&
Hans Wennborg31942cf2019-11-05 14:58:2953 git cl try -B chrome/try -b iphone-device -b ipad-device
ingloriond277c61f2017-09-15 23:08:0654 ```
55
Hans Wennborgad4e8842018-08-01 09:25:13561. Optional: Start Pinpoint perf tryjobs. These are generally too noisy to
57 catch minor regressions pre-commit, but make sure there are no large
58 regressions.
Hans Wennborg62e06b212018-06-18 14:44:4259
60 a. (Log in to store OAuth2 token in the depot_tools cache. Only needs to be
61 run once:)
62
Hans Wennborg62e06b212018-06-18 14:44:4263 $ PYTHONPATH=$(dirname $(which git-cl)) python -c"import auth;auth.OAUTH_CLIENT_ID='62121018386-h08uiaftreu4dr3c4alh3l7mogskvb7i.apps.googleusercontent.com';auth.OAUTH_CLIENT_SECRET='vc1fZfV1cZC6mgDSHV-KSPOz';print auth.get_authenticator_for_host('pinpoint',auth.make_auth_config()).login()"
Hans Wennborg62e06b212018-06-18 14:44:4264
Hans Wennborg40d03572018-10-09 12:16:5165 b. Generate a fresh Oauth2 token:
Hans Wennborg62e06b212018-06-18 14:44:4266
Hans Wennborg62e06b212018-06-18 14:44:4267 $ TOKEN=$(PYTHONPATH=$(dirname $(which git-cl)) python -c"import auth;print auth.get_authenticator_for_host('pinpoint',auth.make_auth_config()).get_access_token().token")
Hans Wennborg62e06b212018-06-18 14:44:4268
Hans Wennborg07b9d9e2018-10-09 09:34:3069 c. Launch Pinpoint job:
Hans Wennborg62e06b212018-06-18 14:44:4270
Hans Wennborg62e06b212018-06-18 14:44:4271 $ curl -H"Authorization: Bearer $TOKEN" -F configuration=chromium-rel-win7-gpu-nvidia \
Hans Wennborg07b9d9e2018-10-09 09:34:3072 -F target=performance_test_suite -F benchmark=speedometer2 \
Hans Wennborg62e06b212018-06-18 14:44:4273 -F patch=https://chromium-review.googlesource.com/c/chromium/src/+/$(git cl issue | cut -d' ' -f3) \
74 -F start_git_hash=HEAD -F end_git_hash=HEAD https://pinpoint-dot-chromeperf.appspot.com/api/new
Hans Wennborg62e06b212018-06-18 14:44:4275
Hans Wennborg07b9d9e2018-10-09 09:34:3076 d. Use the URL returned by the command above to see the progress and result
Hans Wennborg62e06b212018-06-18 14:44:4277 of the tryjob, checking that it doesn't regress significantly (> 10%).
78 Post the URL to the codereview.
79
nodir06cbaa02015-08-25 17:15:24801. Commit roll CL from the first step
811. The bots will now pull the prebuilt binary, and goma will have a matching
82 binary, too.
Nico Weber4071eca2018-09-25 12:29:1483
84## Adding files to the clang package
85
86The clang package is downloaded unconditionally by all bots and devs. It's
87called "clang" for historical reasons, but nowadays also contains other
88mission-critical toolchain pieces besides clang.
89
90We try to limit the contents of the clang package. They should meet these
91criteria:
92
93- things that are used by most developers use most of the time (e.g. a
94 compiler, a linker, sanitizer runtimes)
95- things needed for doing official builds
96
97If you want to add something to the clang package that doesn't (yet?) meet
98these criteria, you can make package.py upload it to a separate zip file
Hans Wennborg8ee64a12019-11-05 17:31:3099and then download it on an opt-in basis by using update.py's --package option.
Nico Weber4071eca2018-09-25 12:29:14100
101If you're adding a new feature that you expect will meet the inclusion criteria
102eventually but doesn't yet, start by having your things in a separate zip
103and move it to the main zip once the criteria are met.