Nico Weber | 1683eec9 | 2020-02-14 12:31:00 | [diff] [blame] | 1 | Configurations supported by the toolchain team |
| 2 | ============================================== |
| 3 | |
| 4 | This document describes considerations to follow when adding a new build |
| 5 | config. A build config is something like a new compiler / linker configuration, |
| 6 | a new test binary, a new `target_os`, a new `target_cpu`, etc. |
| 7 | |
| 8 | Background |
| 9 | ---------- |
| 10 | |
| 11 | We update our toolchain (the C/C++/Objective-C compiler `clang`, the linker |
| 12 | `lld`, and a small assortment of helper binaries) every 2-4 weeks. |
| 13 | |
| 14 | This toolchain is used to build Chromium for **7+ platforms** (Android, |
| 15 | Chromecast, Chrome OS, Fuchsia, iOS, Linux, macOS, Windows) targeting |
| 16 | **4+ CPUs** (arm, arm64, x86, x64) in **6+ build modes** (debug (component |
| 17 | non-optimized), release (static build optimized), official build (very |
| 18 | optimized and on some platforms LTO+CFI), asan+lsan, msan, tsan), resulting |
| 19 | in **130+** different test binaries. |
| 20 | |
| 21 | Every toolchain update needs to make sure that none of these combinations break. |
| 22 | |
| 23 | To have any chance that this works, we continuously build and run tests in |
| 24 | most of these configurations with trunk clang/llvm, to catch regressions and |
Andrew Williams | e223ab9 | 2021-07-16 23:40:27 | [diff] [blame] | 25 | intentional changes upstream that cause problems for us. |
Nico Weber | 1683eec9 | 2020-02-14 12:31:00 | [diff] [blame] | 26 | |
| 27 | When we land a toolchain update, we rely on the CQ to make sure all combinations |
| 28 | work with the new toolchain. We use all default CQ bots, and a long list of |
| 29 | opt-in trybots. |
| 30 | |
| 31 | The toolchain team has established contacts to most platform owners in |
| 32 | Chromium, so that we can ask for help quickly when needed. |
| 33 | |
| 34 | |
| 35 | Toolchain guarantees |
| 36 | -------------------- |
| 37 | |
| 38 | For configurations that have a bot on the [chromium.clang waterfall]( |
| 39 | https://ci.chromium.org/p/chromium/g/chromium.clang/console) (which |
| 40 | is where all the bots are that test Chromium with trunk clang/llvm) |
| 41 | and that are either part of the default CQ or that have an opt-in bot |
| 42 | that's [used on clang rolls](https://cs.chromium.org/chromium/src/tools/clang/scripts/upload_revision.py?q=upload_revi&sq=package:chromium&g=0&l=33), |
| 43 | we guarantee that we won't land a toolchain update that breaks that |
| 44 | configuration. |
| 45 | |
| 46 | For configurations that don't have a clang tip-of-tree (ToT) bot or that aren't |
| 47 | covered on the CQ, **we won't revert toolchain updates**. We will do our best |
| 48 | to fix things quickly (see below for how to file a good bug) and to fix forward |
| 49 | to get you unblocked. |
| 50 | |
| 51 | |
| 52 | Talk to the toolchain team to make sure your new config is supported |
| 53 | -------------------------------------------------------------------- |
| 54 | |
| 55 | If you add a new build config, or a new bot config: You may want to add a |
| 56 | chromium.clang ToT bot, and you may want to make sure that there's a CQ bot |
| 57 | covering your config on clang rolls. (It's ok if it's an opt-in bot, as long as |
| 58 | you make sure it's |
| 59 | [opted-in](https://cs.chromium.org/chromium/src/tools/clang/scripts/upload_revision.py?q=upload_revi&sq=package:chromium&g=0&l=33) |
| 60 | for clang rolls. If your opt-in is based on filename patterns, make sure it |
| 61 | also fires on changes to `tools/clang/scrips/update.py`.) |
| 62 | |
| 63 | Do not use `-mllvm` or `-Xclang` flags. These are internal flags that aren't |
| 64 | ready for production use yet. Once they're ready, they'll become available |
| 65 | as regular clang flags. |
| 66 | |
| 67 | Follow the style guide. In particular, don't use exceptions. |
| 68 | |
| 69 | Talk to us if you're adding a new build config or bot config, if you'd like to |
| 70 | use an internal flag, if you want to use a flag that's obscure, or if you want |
| 71 | general advice on toolchain questions (clang@chromium.org, or |
| 72 | google-internally, lexan@google.com). |
| 73 | |
| 74 | Filing good toolchain bugs |
| 75 | -------------------------- |
| 76 | |
| 77 | If a toolchain update ("clang roll") broke you, here's how you can file a bug |
| 78 | that we can act on the quickest: |
| 79 | |
| 80 | - File the bug in the `Tools>LLVM` component. |
| 81 | - Link to the CL with the toolchain update that broke you. |
| 82 | - Link to a specific build showing the breakage, ideally the first instance |
| 83 | of the breakage. |
| 84 | - If reproducing your problem requires more than a regular Chromium checkout |
| 85 | and replicating what the bot you linked to does, or if you can't link to a |
| 86 | build: Provide commands on how to reproduce your problem, targeted at someone |
| 87 | who knows the chromium build well but doesn't know your feature / platform |
| 88 | at all. |
Mirko Bonadei | f7309de | 2020-02-17 18:54:44 | [diff] [blame] | 89 | - Tell us which repo to check out, if needed. |
Nico Weber | 1683eec9 | 2020-02-14 12:31:00 | [diff] [blame] | 90 | - Tell us which `args.gn` to use. |
| 91 | - Tell us which target to build. |
| 92 | - Tell us how to run your test. |
| 93 | |
| 94 | We'll try to be helpful, but see "Toolchain guarantees" above. |
| 95 | |
| 96 | Compiler updates can expose latent existing bugs in your code, for example |
| 97 | if you have ODR violations, or other undefined behavior. In that case, |
| 98 | the fix is to change your code. It can be helpful to make a reduced repro |
| 99 | case of the problem before looping us in, so that you can check if your problem |
| 100 | is really due to the toolchain update and not due to a bug in your code. |