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 |
Hans Wennborg | 9549a98 | 2019-05-22 07:51:29 | [diff] [blame] | 21 | $ export rev=123456-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 ; \ |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 27 | 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 Woll | 8e542333 | 2019-10-24 17:34:20 | [diff] [blame] | 33 | 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 Wennborg | 955cfdf | 2019-07-17 14:00:47 | [diff] [blame] | 35 | 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 |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 37 | ``` |
Hans Wennborg | e583b5e | 2017-10-11 02:40:55 | [diff] [blame] | 38 | |
hans | c3a6616 | 2017-05-12 16:27:07 | [diff] [blame] | 39 | 1. 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 |
thakis | 3447dcd | 2016-05-05 18:17:15 | [diff] [blame] | 42 | 1. Run an exhaustive set of try jobs to test the new compiler: |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 43 | |
| 44 | ```shell |
Nico Weber | b8603fb | 2018-05-21 15:42:10 | [diff] [blame] | 45 | git cl try && |
Hans Wennborg | 31942cf | 2019-11-05 14:58:29 | [diff] [blame] | 46 | git cl try -B chromium/try -b mac_chromium_asan_rel_ng \ |
Nico Weber | f218afd | 2018-09-20 19:11:21 | [diff] [blame] | 47 | -b linux_chromium_cfi_rel_ng \ |
inglorion | 475c6e19 | 2018-06-22 20:42:25 | [diff] [blame] | 48 | -b linux_chromium_chromeos_asan_rel_ng -b linux_chromium_msan_rel_ng \ |
Hans Wennborg | a8d9963 | 2018-10-01 11:37:37 | [diff] [blame] | 49 | -b linux_chromium_chromeos_msan_rel_ng -b linux-chromeos-dbg \ |
Hans Wennborg | f610301 | 2019-08-12 08:32:03 | [diff] [blame] | 50 | -b win-asan -b chromeos-amd64-generic-cfi-thin-lto-rel \ |
Hans Wennborg | f7e8897 | 2019-08-19 11:24:58 | [diff] [blame] | 51 | -b linux_chromium_compile_dbg_32_ng -b win7-rel \ |
| 52 | -b win-angle-deqp-rel-64 && |
Hans Wennborg | 31942cf | 2019-11-05 14:58:29 | [diff] [blame] | 53 | git cl try -B chrome/try -b iphone-device -b ipad-device |
inglorion | d277c61f | 2017-09-15 23:08:06 | [diff] [blame] | 54 | ``` |
| 55 | |
Hans Wennborg | ad4e884 | 2018-08-01 09:25:13 | [diff] [blame] | 56 | 1. 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 Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 59 | |
| 60 | a. (Log in to store OAuth2 token in the depot_tools cache. Only needs to be |
| 61 | run once:) |
| 62 | |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 63 | $ 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] | 64 | |
Hans Wennborg | 40d0357 | 2018-10-09 12:16:51 | [diff] [blame] | 65 | b. Generate a fresh Oauth2 token: |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 66 | |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 67 | $ 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] | 68 | |
Hans Wennborg | 07b9d9e | 2018-10-09 09:34:30 | [diff] [blame] | 69 | c. Launch Pinpoint job: |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 70 | |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 71 | $ curl -H"Authorization: Bearer $TOKEN" -F configuration=chromium-rel-win7-gpu-nvidia \ |
Hans Wennborg | 07b9d9e | 2018-10-09 09:34:30 | [diff] [blame] | 72 | -F target=performance_test_suite -F benchmark=speedometer2 \ |
Hans Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 73 | -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 Wennborg | 62e06b21 | 2018-06-18 14:44:42 | [diff] [blame] | 75 | |
Hans Wennborg | 07b9d9e | 2018-10-09 09:34:30 | [diff] [blame] | 76 | 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] | 77 | of the tryjob, checking that it doesn't regress significantly (> 10%). |
| 78 | Post the URL to the codereview. |
| 79 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 80 | 1. Commit roll CL from the first step |
| 81 | 1. The bots will now pull the prebuilt binary, and goma will have a matching |
| 82 | binary, too. |
Nico Weber | 4071eca | 2018-09-25 12:29:14 | [diff] [blame] | 83 | |
| 84 | ## Adding files to the clang package |
| 85 | |
| 86 | The clang package is downloaded unconditionally by all bots and devs. It's |
| 87 | called "clang" for historical reasons, but nowadays also contains other |
| 88 | mission-critical toolchain pieces besides clang. |
| 89 | |
| 90 | We try to limit the contents of the clang package. They should meet these |
| 91 | criteria: |
| 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 | |
| 97 | If you want to add something to the clang package that doesn't (yet?) meet |
| 98 | 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^] | 99 | 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] | 100 | |
| 101 | If you're adding a new feature that you expect will meet the inclusion criteria |
| 102 | eventually but doesn't yet, start by having your things in a separate zip |
| 103 | and move it to the main zip once the criteria are met. |