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 |
| 21 | $ export rev=123456-1 |
| 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 ; \ |
| 25 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/llvmobjdump-$rev.tgz \ |
| 26 | gs://chromium-browser-clang/$x/llvmobjdump-$rev.tgz ; \ |
Mitch Phillips | cab45830 | 2017-11-20 21:44:36 | [diff] [blame] | 27 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/llvmcfiverify-$rev.tgz \ |
| 28 | gs://chromium-browser-clang/$x/llvmcfiverify-$rev.tgz ; \ |
Vlad Tsyrklevich | eeab6d7 | 2018-08-08 21:06:02 | [diff] [blame] | 29 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/safestack-$rev.tgz \ |
| 30 | gs://chromium-browser-clang/$x/safestack-$rev.tgz ; \ |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 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 ; \ |
| 35 | done |
Fabrice de Gans-Riberi | 0f288583 | 2018-08-31 17:55:25 | [diff] [blame] | 36 | $ for x in Linux_x64 Mac ; do \ |
| 37 | gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/$x/llvmstrip-$rev.tgz \ |
| 38 | gs://chromium-browser-clang/$x/llvmstrip-$rev.tgz ; \ |
| 39 | done |
Nico Weber | 25162258 | 2017-10-09 18:00:51 | [diff] [blame] | 40 | $ gsutil.py cp -n -a public-read gs://chromium-browser-clang-staging/Mac/lld-$rev.tgz \ |
Hans Wennborg | e583b5e | 2017-10-11 02:40:55 | [diff] [blame] | 41 | gs://chromium-browser-clang/Mac/lld-$rev.tgz |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 42 | ``` |
Hans Wennborg | e583b5e | 2017-10-11 02:40:55 | [diff] [blame] | 43 | |
hans | c3a6616 | 2017-05-12 16:27:07 | [diff] [blame] | 44 | 1. Run the goma package update script to push these packages to goma. If you do |
| 45 | not have the necessary credentials to do the upload, ask clang@chromium.org |
| 46 | to find someone who does |
thakis | 3447dcd | 2016-05-05 18:17:15 | [diff] [blame] | 47 | 1. Run an exhaustive set of try jobs to test the new compiler: |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 48 | |
| 49 | ```shell |
Nico Weber | b8603fb | 2018-05-21 15:42:10 | [diff] [blame] | 50 | git cl try && |
Nico Weber | b8603fb | 2018-05-21 15:42:10 | [diff] [blame] | 51 | git cl try -m tryserver.blink -b linux_trusty_blink_rel && |
Eric Foo | 11fc8a17 | 2018-08-31 23:14:33 | [diff] [blame] | 52 | git cl try -B luci.chromium.try -b ios-device -b mac_chromium_asan_rel_ng \ |
Nico Weber | f218afd | 2018-09-20 19:11:21 | [diff] [blame] | 53 | -b linux_chromium_cfi_rel_ng \ |
inglorion | 475c6e19 | 2018-06-22 20:42:25 | [diff] [blame] | 54 | -b linux_chromium_chromeos_asan_rel_ng -b linux_chromium_msan_rel_ng \ |
Hans Wennborg | a8d9963 | 2018-10-01 11:37:37 | [diff] [blame] | 55 | -b linux_chromium_chromeos_msan_rel_ng -b linux-chromeos-dbg \ |
| 56 | -b win-asan |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 57 | ``` |
| 58 | |
Hans Wennborg | ad4e884 | 2018-08-01 09:25:13 | [diff] [blame] | 59 | 1. Optional: Start Pinpoint perf tryjobs. These are generally too noisy to |
| 60 | catch minor regressions pre-commit, but make sure there are no large |
| 61 | regressions. |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 62 | |
| 63 | a. (Log in to store OAuth2 token in the depot_tools cache. Only needs to be |
| 64 | run once:) |
| 65 | |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 66 | $ 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 Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 67 | |
Hans Wennborg | 40d0357 | 2018-10-09 12:16:51 | [diff] [blame] | 68 | b. Generate a fresh Oauth2 token: |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 69 | |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 70 | $ 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 Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 71 | |
Hans Wennborg | 07b9d9e | 2018-10-09 09:34:30 | [diff] [blame] | 72 | c. Launch Pinpoint job: |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 73 | |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 74 | $ curl -H"Authorization: Bearer $TOKEN" -F configuration=chromium-rel-win7-gpu-nvidia \ |
Hans Wennborg | 07b9d9e | 2018-10-09 09:34:30 | [diff] [blame] | 75 | -F target=performance_test_suite -F benchmark=speedometer2 \ |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 76 | -F patch=https://chromium-review.googlesource.com/c/chromium/src/+/$(git cl issue | cut -d' ' -f3) \ |
| 77 | -F start_git_hash=HEAD -F end_git_hash=HEAD https://pinpoint-dot-chromeperf.appspot.com/api/new |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 78 | |
Hans Wennborg | 07b9d9e | 2018-10-09 09:34:30 | [diff] [blame] | 79 | d. Use the URL returned by the command above to see the progress and result |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 80 | of the tryjob, checking that it doesn't regress significantly (> 10%). |
| 81 | Post the URL to the codereview. |
| 82 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 83 | 1. Commit roll CL from the first step |
| 84 | 1. The bots will now pull the prebuilt binary, and goma will have a matching |
| 85 | binary, too. |
Nico Weber | 4071eca | 2018-09-25 12:29:14 | [diff] [blame] | 86 | |
| 87 | ## Adding files to the clang package |
| 88 | |
| 89 | The clang package is downloaded unconditionally by all bots and devs. It's |
| 90 | called "clang" for historical reasons, but nowadays also contains other |
| 91 | mission-critical toolchain pieces besides clang. |
| 92 | |
| 93 | We try to limit the contents of the clang package. They should meet these |
| 94 | criteria: |
| 95 | |
| 96 | - things that are used by most developers use most of the time (e.g. a |
| 97 | compiler, a linker, sanitizer runtimes) |
| 98 | - things needed for doing official builds |
| 99 | |
| 100 | If you want to add something to the clang package that doesn't (yet?) meet |
| 101 | these criteria, you can make package.py upload it to a separate zip file |
| 102 | and then download it on an opt-in basis by requiring users to run a script |
| 103 | to download the additional zip file. You can structure your script in a way that |
| 104 | it downloads your additional zip automatically if the script detects an |
| 105 | old version on disk, that way users have to run the download script just |
| 106 | once. `tools/clang/scripts/download_lld_mac.py` is an example for this |
| 107 | (It doesn't do the "only download if old version is on disk or if requested" |
| 108 | bit, and hence doesn't run as a default DEPS hook. TODO(thakis): Make |
| 109 | coverage stuff a better example and link to that.) |
| 110 | |
| 111 | If you're adding a new feature that you expect will meet the inclusion criteria |
| 112 | eventually but doesn't yet, start by having your things in a separate zip |
| 113 | and move it to the main zip once the criteria are met. |