spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 1 | --- |
| 2 | layout: documentation |
| 3 | title: Understanding CROSSTOOL |
| 4 | --- |
| 5 | |
spomorski | 3739168 | 2018-10-08 09:25:34 -0700 | [diff] [blame] | 6 | # Understanding CROSSTOOL |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 7 | |
laurentlb | 27bb948 | 2018-11-12 12:50:34 -0800 | [diff] [blame^] | 8 | * ToC |
| 9 | {:toc} |
| 10 | |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 11 | |
spomorski | 3739168 | 2018-10-08 09:25:34 -0700 | [diff] [blame] | 12 | To get hands-on with `CROSSTOOL`, see the |
| 13 | [Configuring `CROSSTOOL`](tutorial/crosstool.html) tutorial. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 14 | |
| 15 | ## Overview |
| 16 | |
| 17 | `CROSSTOOL` is a text file containing a |
| 18 | [protocol buffer](https://developers.google.com/protocol-buffers/docs/overview) |
| 19 | that provides the necessary level of granularity for configuring the behavior of |
| 20 | Bazel's C++ rules. By default, Bazel automatically configures `CROSSTOOL` for |
| 21 | your build, but you have the option to configure it manually. You reference the |
| 22 | `CROSSTOOL` file in your `BUILD` file(s) using a `cc_toolchain` target and check |
| 23 | it into source control alongside your project. You can share a single |
| 24 | `CROSSTOOL` file across multiple projects or create separate per-project files. |
| 25 | |
| 26 | When a C++ target enters the analysis phase, Bazel selects the appropriate |
| 27 | `cc_toolchain` target based on the BUILD file, then reads the corresponding |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 28 | toolchain definition from the `CROSSTOOL` file. The `cc_toolchain` target |
| 29 | passes information from the `CROSSTOOL` proto to the C++ target through a |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 30 | `CcToolchainProvider`. |
| 31 | |
| 32 | For example, a compile or link action, instantiated by a rule such as |
| 33 | `cc_binary` or `cc_library`, needs the following information: |
| 34 | |
| 35 | * The compiler or linker to use |
| 36 | * Command-line flags for the compiler/linker |
| 37 | * Configuration flags passed through the `--copt/--linkopt` options |
| 38 | * Environment variables |
| 39 | * Artifacts needed in the sandbox in which the action executes |
| 40 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 41 | All of the above information except the artifacts required in the sandbox is |
| 42 | specified in the `CROSSTOOL` proto. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 43 | |
| 44 | The artifacts to be shipped to the sandbox are declared in the `cc_toolchain` |
| 45 | target. For example, with the `cc_toolchain.linker_files` attribute you can |
| 46 | specify the linker binary and toolchain libraries to ship into the sandbox. |
| 47 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 48 | ## `CROSSTOOL` proto structure |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 49 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 50 | The `CROSSTOOL` proto has the following structure: |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 51 | |
| 52 | * Map from `--cpu` to toolchain (to be used when `--compiler` is not specified |
| 53 | or when `cc_toolchain_suite.toolchains` omits the `cpu` entry) |
| 54 | |
| 55 | * Toolchain for a particular `--cpu` and `--compiler` combination (1) |
| 56 | * Static toolchain: |
| 57 | * `compiler_flags` |
| 58 | * `linker_flags` |
| 59 | * `compilation_mode_flags` |
| 60 | * `linking_mode_flags` |
| 61 | * Dynamic toolchain: |
| 62 | * `features` |
| 63 | |
| 64 | * Toolchain for a particular `--cpu` and `--compiler` combination (2) |
| 65 | |
| 66 | * Toolchain for a particular `--cpu` and `--compiler` combination (3) |
| 67 | |
| 68 | * ... |
| 69 | |
| 70 | |
| 71 | ## Toolchain selection |
| 72 | |
| 73 | The toolchain selection logic operates as follows: |
| 74 | |
| 75 | 1. User specifies a `cc_toolchain_suite` target in the `BUILD` file and points |
| 76 | Bazel to the target using the |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 77 | [`--crosstool_top` option](https://docs.bazel.build/versions/master/user-manual.html#flag--crosstool_top). |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 78 | The `CROSSTOOL` file must reside in the same directory as the |
| 79 | `BUILD` file containing the `cc_toolchain_suite` target. |
| 80 | |
| 81 | 2. The `cc_toolchain_suite` target and the `CROSSTOOL` |
| 82 | file reference multiple toolchains. The values of the `--cpu` and |
| 83 | `--compiler `flags determine which of those toolchains is selected, |
| 84 | either based only on the `--cpu` flag value, or based on a joint |
| 85 | `--cpu | --compiler` value. The selection process is as follows: |
| 86 | |
| 87 | * If the `--compiler` option is specified, Bazel selects the |
| 88 | corresponding entry from the `cc_toolchain_suite.toolchains` |
| 89 | attribute with `--cpu | --compiler`. If Bazel does not find |
| 90 | a corresponding entry, it throws an error. |
| 91 | |
| 92 | * If the `--compiler` option is not specified, Bazel selects |
| 93 | the corresponding entry from the `cc_toolchain_suite.toolchains` |
| 94 | attribute with just `--cpu`. |
| 95 | |
| 96 | However, if Bazel does not find a corresponding entry and the |
| 97 | `--incompatible_disable_cc_toolchain_label_from_crosstool_proto` |
| 98 | option is disabled, Bazel iterates through `default_toolchains` |
| 99 | in the `CROSSTOOL` file until it finds an entry where the |
| 100 | `default_toolchain.cpu` value matches the specified `--cpu` |
| 101 | option value. Bazel then reads the `toolchain_identifier` |
| 102 | value to identify the corresponding toolchain, and selects the appropriate |
| 103 | entry in the `cc_toolchain_suite.toolchains` attribute using |
| 104 | `toolchain.target_cpu | toolchain.compiler`. |
| 105 | |
| 106 | * If no flags are specified, Bazel inspects the host system and selects a |
| 107 | `--cpu` value based on its findings. See the |
| 108 | [inspection mechanism code](https://source.bazel.build/bazel/+/1b73bc37e184e71651eb631223dcce321ba16211:src/main/java/com/google/devtools/build/lib/analysis/config/AutoCpuConverter.java). |
| 109 | |
| 110 | Once a toolchain has been selected, corresponding `feature` and `action_config` |
spomorski | 863bc87 | 2018-10-02 12:20:05 -0700 | [diff] [blame] | 111 | messages in the `CROSSTOOL` file govern the configuration of the build (that is, |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 112 | items described earlier in this document). These messages allow the |
| 113 | implementation of fully fledged C++ features in Bazel without modifying the |
| 114 | Bazel binary. C++ rules support multiple unique actions documented in detail |
| 115 | [in the Bazel source code](https://source.bazel.build/bazel/+/4f547a7ea86df80e4c76145ffdbb0c8b75ba3afa:tools/build_defs/cc/action_names.bzl). |
| 116 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 117 | ## `CROSSTOOL` features |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 118 | |
| 119 | A feature is an entity that requires non-default command-line flags, actions, |
| 120 | constraints on the execution environment, or dependency alterations. A feature |
| 121 | can be something as simple as allowing BUILD files to select configurations of |
| 122 | flags, such as `treat_warnings_as_errors`, or interact with the C++ rules and |
| 123 | include new compile actions and inputs to the compilation, such as |
| 124 | `header_modules` or `thin_lto`. |
| 125 | |
| 126 | Ideally, a toolchain definition consists of a set of features, where each |
| 127 | feature consists of multiple flag groups, each defining a list of flags that |
| 128 | apply to specific Bazel actions. |
| 129 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 130 | A feature is specified by name, which allows full decoupling of the `CROSSTOOL` |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 131 | configuration from Bazel releases. In other words, a Bazel release does not |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 132 | affect the behavior of `CROSSTOOL` configurations as long as those |
| 133 | configurations do not require the use of new features. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 134 | |
| 135 | A feature is enabled only when both Bazel and the CROSSTOOL configuration |
| 136 | support it. |
| 137 | |
| 138 | Features can have interdependencies, depend on command line flags, `BUILD` file |
| 139 | settings, and other variables. |
| 140 | |
| 141 | ### Feature relationships |
| 142 | |
| 143 | Dependencies are typically managed directly with Bazel, which simply enforces |
| 144 | the requirements and manages conflicts intrinsic to the nature of the features |
| 145 | defined in the build. The toolchain specification allows for more granular |
spomorski | 863bc87 | 2018-10-02 12:20:05 -0700 | [diff] [blame] | 146 | constraints for use directly within the `CROSSTOOL` file that govern feature |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 147 | support and expansion. These are: |
| 148 | |
| 149 | <table> |
| 150 | <col width="300"> |
| 151 | <col width="600"> |
| 152 | <tr> |
| 153 | <td><strong>Constraint</strong> |
| 154 | </td> |
| 155 | <td><strong>Description</strong> |
| 156 | </td> |
| 157 | </tr> |
| 158 | <tr> |
| 159 | <td><code>requires: ['feature1', 'feature2']</code> |
| 160 | </td> |
| 161 | <td>Feature-level. The feature is supported only if the specified required |
| 162 | features are enabled. For example, when a feature is only supported in |
| 163 | certain build modes (features <code>opt</code>, <code>dbg</code>, or |
| 164 | <code>fastbuild</code>). Multiple `requires` statements are |
| 165 | satisfied all at once if any one of them is satisfied. |
| 166 | </td> |
| 167 | </tr> |
| 168 | <tr> |
| 169 | <td><code>implies: 'feature'</code> |
| 170 | </td> |
| 171 | <td>Feature-level. This feature implies the specified feature. For example, a |
| 172 | module compile implies the need for module maps, which can be implemented |
| 173 | by a repeated <code>implies</code> string in the feature where each of |
| 174 | the strings names a specific feature. Enabling a feature also implicitly |
| 175 | enables all features implied by it (that is, it functions recursively). |
| 176 | <p> |
| 177 | Also provides the ability to factor common subsets of functionality out of |
| 178 | a set of features, such as the common parts of sanitizers. Implied |
| 179 | features cannot be disabled. |
| 180 | </td> |
| 181 | </tr> |
| 182 | <tr> |
| 183 | <td><code>provides: 'feature'</code> |
| 184 | </td> |
| 185 | <td>Feature-level. Indicates that this feature is one of several mutually |
| 186 | exclusive alternate features. For example, all of the sanitizers could |
| 187 | specify <code>provides: "sanitizer"</code>. |
| 188 | <p> |
| 189 | This improves error handling by listing the alternatives if the user asks |
| 190 | for two or more mutually exclusive features at once. |
| 191 | </td> |
| 192 | </tr> |
| 193 | <tr> |
| 194 | <td><code>with_feature: {feature: 'feature1', not_feature: 'feature2']</code> |
| 195 | </td> |
| 196 | <td>Flag set-level. A feature can specify multiple flag sets with multiple |
| 197 | <code>with_feature</code> statements. When <code>with_feature</code> is |
| 198 | specified, the flag set will only expand to the build command if all of the |
| 199 | feature in the specified <code>feature:</code> set are enabled, and all the |
| 200 | features specified in <code>not_feature:</code> set are disabled. |
| 201 | </td> |
| 202 | </tr> |
| 203 | </table> |
| 204 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 205 | ## `CROSSTOOL` actions |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 206 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 207 | `CROSSTOOL` actions provide the flexibility to modify the circumstances under |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 208 | which an action executes without assuming how the action will be run. An |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 209 | `action_config` specifies the tool binary that an action invokes, while a |
| 210 | `feature` specifies the configuration (flags) that determine how that tool |
| 211 | behaves when the action is invoked. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 212 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 213 | [Features](#crosstool-features) reference `CROSSTOOL` actions to signal which |
| 214 | Bazel actions they affect since `CROSSTOOL` actions can modify the Bazel action |
spomorski | 863bc87 | 2018-10-02 12:20:05 -0700 | [diff] [blame] | 215 | graph. The `CROSSTOOL` file includes actions that have flags and tools |
| 216 | associated with them, such as `c++-compile`. Flags are assigned to each action |
| 217 | by associating them with a feature. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 218 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 219 | Each `CROSSTOOL` action name represents a single type of action performed by |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 220 | Bazel, such as compiling or linking. There is, however, a many-to-one |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 221 | relationship between `CROSSTOOL` actions and Bazel action types, where a Bazel |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 222 | action type refers to a Java class that implements an action (such as |
| 223 | `CppCompileAction`). In particular, the "assembler actions" and "compiler |
| 224 | actions" in the table below are `CppCompileAction`, while the link actions are |
| 225 | `CppLinkAction`. |
| 226 | |
| 227 | ### Assembler actions |
| 228 | |
| 229 | <table> |
| 230 | <col width="300"> |
| 231 | <col width="600"> |
| 232 | <tr> |
| 233 | <td><strong>Action</strong> |
| 234 | </td> |
| 235 | <td><strong>Description</strong> |
| 236 | </td> |
| 237 | </tr> |
| 238 | <tr> |
| 239 | <td><code>preprocess-assemble</code> |
| 240 | </td> |
| 241 | <td>Assemble with preprocessing. Typically for <code>.S</code> files. |
| 242 | </td> |
| 243 | </tr> |
| 244 | <tr> |
| 245 | <td><code>assemble</code> |
| 246 | </td> |
| 247 | <td>Assemble without preprocessing. Typically for <code>.s</code> files. |
| 248 | </td> |
| 249 | </tr> |
| 250 | </table> |
| 251 | |
| 252 | ### Compiler actions |
| 253 | |
| 254 | <table> |
| 255 | <col width="300"> |
| 256 | <col width="600"> |
| 257 | <tr> |
| 258 | <td><strong>Action</strong> |
| 259 | </td> |
| 260 | <td><strong>Description</strong> |
| 261 | </td> |
| 262 | </tr> |
| 263 | <tr> |
| 264 | <td><code>cc-flags-make-variable</code> |
| 265 | </td> |
| 266 | <td>Propagates <code>CC_FLAGS</code> to genrules. |
| 267 | </td> |
| 268 | </tr> |
| 269 | <tr> |
| 270 | <td><code>c-compile</code> |
| 271 | </td> |
| 272 | <td>Compile as C. |
| 273 | </td> |
| 274 | </tr> |
| 275 | <tr> |
| 276 | <td><code>c++-compile</code> |
| 277 | </td> |
| 278 | <td>Compile as C++. |
| 279 | </td> |
| 280 | </tr> |
| 281 | <tr> |
| 282 | <td><code>c++-header-parsing</code> |
| 283 | </td> |
| 284 | <td>Run the compiler's parser on a header file to ensure that the header is |
| 285 | self-contained, as it will otherwise produce compilation errors. Applies |
| 286 | only to toolchains that support modules. |
| 287 | </td> |
| 288 | </tr> |
| 289 | </table> |
| 290 | |
| 291 | ### Link actions |
| 292 | |
| 293 | <table> |
| 294 | <col width="300"> |
| 295 | <col width="600"> |
| 296 | <tr> |
| 297 | <td><strong>Action</strong> |
| 298 | </td> |
| 299 | <td><strong>Description</strong> |
| 300 | </td> |
| 301 | </tr> |
| 302 | <tr> |
| 303 | <td><code>c++-link-dynamic-library</code> |
| 304 | </td> |
| 305 | <td>Link a shared library containing all of its dependencies. |
| 306 | </td> |
| 307 | </tr> |
| 308 | <tr> |
| 309 | <td><code>c++-link-nodeps-dynamic-library</code> |
| 310 | </td> |
| 311 | <td>Link a shared library only containing <code>cc_library</code> sources. |
| 312 | </td> |
| 313 | </tr> |
| 314 | <tr> |
| 315 | <td><code>c++-link-executable</code> |
| 316 | </td> |
| 317 | <td>Link a final ready-to-run library. |
| 318 | </td> |
| 319 | </tr> |
| 320 | </table> |
| 321 | |
| 322 | ### AR actions |
| 323 | |
| 324 | AR actions assemble object files into archive libraries (`.a` files) via `ar` |
| 325 | and encode some semantics into the name. |
| 326 | |
| 327 | <table> |
| 328 | <col width="300"> |
| 329 | <col width="600"> |
| 330 | <tr> |
| 331 | <td><strong>Action</strong> |
| 332 | </td> |
| 333 | <td><strong>Description</strong> |
| 334 | </td> |
| 335 | </tr> |
| 336 | <tr> |
| 337 | <td><code>c++-link-static-library</code> |
| 338 | </td> |
| 339 | <td>Create a static library (archive). |
| 340 | </td> |
| 341 | </tr> |
| 342 | </table> |
| 343 | |
| 344 | ### LTO actions |
| 345 | |
| 346 | <table> |
| 347 | <col width="300"> |
| 348 | <col width="600"> |
| 349 | <tr> |
| 350 | <td><strong>Action</strong> |
| 351 | </td> |
| 352 | <td><strong>Description</strong> |
| 353 | </td> |
| 354 | </tr> |
| 355 | <tr> |
| 356 | <td><code>lto-backend</code> |
| 357 | </td> |
| 358 | <td>ThinLTO action compiling bitcodes into native objects. |
| 359 | </td> |
| 360 | </tr> |
| 361 | <tr> |
| 362 | <td><code>lto-index</code> |
| 363 | </td> |
| 364 | <td>ThinLTO action generating global index. |
| 365 | </td> |
| 366 | </tr> |
| 367 | </table> |
| 368 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 369 | ## `CROSSTOOL` `action_config` |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 370 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 371 | A `CROSSTOOL` `action_config` is a proto message that describes a Bazel action |
| 372 | by specifying the tool (binary) to invoke during the action and sets of flags, |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 373 | defined by features, that apply constraints to the action's execution. A |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 374 | `CROSSTOOL` action takes the following attributes: |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 375 | |
| 376 | <table> |
| 377 | <col width="300"> |
| 378 | <col width="600"> |
| 379 | <tr> |
| 380 | <td><strong>Attribute</strong> |
| 381 | </td> |
| 382 | <td><strong>Description</strong> |
| 383 | </td> |
| 384 | </tr> |
| 385 | <tr> |
| 386 | <td><code>action_name</code> |
| 387 | </td> |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 388 | <td>The Bazel action to which this <code>CROSSTOOL</code> action corresponds. |
| 389 | Bazel uses this attribute to discover per-action tool and execution |
| 390 | requirements. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 391 | </td> |
| 392 | </tr> |
| 393 | <tr> |
| 394 | <td><code>tool</code> |
| 395 | </td> |
| 396 | <td>The executable to invoke. This can depend on a feature. A default must be |
| 397 | provided. |
| 398 | </td> |
| 399 | </tr> |
| 400 | <tr> |
| 401 | <td><code>flag_set</code> |
| 402 | </td> |
| 403 | <td>A set of flags that applies to a group of actions. Same as for a feature. |
| 404 | </td> |
| 405 | </tr> |
| 406 | <tr> |
| 407 | <td><code>env_set</code> |
| 408 | </td> |
| 409 | <td>A set of environment constraints that applies to a group of actions. Same |
| 410 | as for a feature. |
| 411 | </td> |
| 412 | </tr> |
| 413 | </table> |
| 414 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 415 | A `CROSSTOOL` `action_config` can require and imply other features and |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 416 | <code>action_config</code>s as dictated by the |
| 417 | [feature relationships](#feature-relationships) described earlier. This behavior |
| 418 | is similar to that of a feature. |
| 419 | |
| 420 | The last two attributes are redundant against the corresponding attributes on |
| 421 | features and are included because some Bazel actions require certain flags or |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 422 | environment variables and we want to avoid unnecessary `action_config`+`feature` |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 423 | pairs. Typically, sharing a single feature across multiple `action_config`s is |
| 424 | preferred. |
| 425 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 426 | You can not define more than one `CROSSTOOL` `action_config` with the same |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 427 | `action_name` within the same toolchain. This prevents ambiguity in tool paths |
| 428 | and enforces the intention behind `action_config` - that an action's properties |
| 429 | are clearly described in a single place in the toolchain. |
| 430 | |
| 431 | ### `tool` messages |
| 432 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 433 | A `CROSSTOOL` `action_config` can specify a set of tools via `tool` messages. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 434 | A `tool` message consists of the following fields: |
| 435 | |
| 436 | |
| 437 | <table> |
| 438 | <col width="300"> |
| 439 | <col width="600"> |
| 440 | <tr> |
| 441 | <td><strong>Field</strong> |
| 442 | </td> |
| 443 | <td><strong>Description</strong> |
| 444 | </td> |
| 445 | </tr> |
| 446 | <tr> |
| 447 | <td><code>tool_path</code> |
| 448 | </td> |
| 449 | <td>Path to the tool in question (relative to the <code>CROSSTOOL</code> |
| 450 | file). |
| 451 | </td> |
| 452 | </tr> |
| 453 | <tr> |
| 454 | <td><code>with_feature</code> |
| 455 | </td> |
| 456 | <td>A set of features that must be enabled for this tool to apply. |
| 457 | </td> |
| 458 | </tr> |
| 459 | </table> |
| 460 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 461 | For a given `CROSSTOOL` `action_config`, only a single `tool` message applies |
| 462 | its tool path and execution requirements to the Bazel action. A tool is selected |
| 463 | by sequentially parsing `tool` messages on an `action_config` until a tool with |
| 464 | a `with_feature` set matching the feature configuration is found |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 465 | (see [Feature relationships](#feature-relationships) earlier in this document |
| 466 | for more information). We recommend that you end your tool lists with a default |
| 467 | tool that corresponds to an empty feature configuration. |
| 468 | |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 469 | ### Example usage |
| 470 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 471 | Features and `CROSSTOOL` actions can be used together to implement Bazel actions |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 472 | with diverse cross-platform semantics. For example, debug symbol generation on |
| 473 | macOS requires generating symbols in the compile action, then invoking a |
| 474 | specialized tool during the link action to create compressed dsym archive, and |
| 475 | then decompressing that archive to produce the application bundle and `.plist` |
| 476 | files consumable by Xcode. |
| 477 | |
| 478 | With Bazel, this process can instead be implemented as follows, with |
| 479 | `unbundle-debuginfo` being a Bazel action: |
| 480 | |
| 481 | ``` |
| 482 | toolchain { |
| 483 | action_config { |
| 484 | config_name: "c++-link-executable" |
| 485 | action_name: "c++-link-executable" |
| 486 | tool { |
| 487 | with_feature { feature: "generate-debug-symbols" } |
| 488 | tool_path: "toolchain/mac/ld-with-dsym-packaging" |
| 489 | } |
| 490 | tool { |
| 491 | tool_path: "toolchain/mac/ld" |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | feature { |
| 496 | name: "generate-debug-symbols" |
| 497 | flag_set { |
| 498 | action: "c-compile" |
| 499 | action: "c++-compile" |
| 500 | flag_group { |
| 501 | flag: "-g" |
| 502 | } |
| 503 | } |
| 504 | implies: { feature: "unbundle-debuginfo" } |
| 505 | } |
| 506 | } |
| 507 | ``` |
| 508 | |
| 509 | This same feature can be implemented entirely differently for Linux, which uses |
| 510 | `fission`, or for Windows, which produces `.pdb` files. For example, the |
| 511 | implementation for `fission`-based debug symbol generation might look as |
| 512 | follows: |
| 513 | |
| 514 | ``` |
| 515 | toolchain { |
| 516 | action_config { |
| 517 | name: "c++-compile" |
| 518 | |
| 519 | tool { |
| 520 | tool_path: "toolchain/bin/gcc" |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | feature { |
| 525 | name: "generate-debug-symbols" |
| 526 | requires { feature: "dbg" } |
| 527 | flag_set { |
| 528 | action: "c++-compile" |
| 529 | flag_group { |
| 530 | flag: "-gsplit-dwarf" |
| 531 | } |
| 532 | } |
| 533 | flag_set { |
| 534 | action: "c++-link-executable" |
| 535 | flag_group { |
| 536 | flag: "-Wl" |
| 537 | flag: "--gdb-index" |
| 538 | } |
| 539 | } |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | ``` |
| 544 | |
| 545 | ### Flag groups |
| 546 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 547 | `CROSSTOOL` allows you to bundle flags into groups that serve a specific purpose. |
spomorski | 863bc87 | 2018-10-02 12:20:05 -0700 | [diff] [blame] | 548 | You can specify a flag within the `CROSSTOOL` file using pre-defined variables |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 549 | within the flag value, which the compiler expands when adding the flag to the |
| 550 | build command. For example: |
| 551 | |
| 552 | ``` |
| 553 | flag_group { |
| 554 | flag: "%{output_file_path} |
| 555 | } |
| 556 | ``` |
| 557 | |
| 558 | In this case, the contents of the flag will be replaced by the output file path |
| 559 | of the action. |
| 560 | |
| 561 | Flag groups are expanded to the build command in the order in which they appear |
| 562 | in the `CROSSTOOL` file, top-to-bottom, left-to-right. |
| 563 | |
| 564 | For flags that need to repeat with different values when added to the build |
| 565 | command, the flag group can iterate variables of type `list`. For example, the |
| 566 | variable `include_path` of type `list`: |
| 567 | |
| 568 | ``` |
| 569 | flag_group { |
| 570 | iterate_over: "include_paths" |
| 571 | flag: "-I%{include_paths}" |
| 572 | } |
| 573 | ``` |
| 574 | |
| 575 | expands to `-I<path>` for each path element in the `include_paths` list. All |
| 576 | flags (or `flag_group`s) in the body of a flag group declaration are expanded as |
| 577 | a unit. For example: |
| 578 | |
| 579 | ``` |
| 580 | flag_group { |
| 581 | iterate_over: "include_paths" |
| 582 | flag: "-I" |
| 583 | flag: "%{include_paths}" |
| 584 | } |
| 585 | ``` |
| 586 | |
| 587 | expands to `-I <path>` for each path element in the `include_paths` list. |
| 588 | |
| 589 | A variable can repeat multiple times. For example: |
| 590 | |
| 591 | ``` |
| 592 | flag_group { |
| 593 | iterate_over: "include_paths" |
| 594 | flag: "-iprefix=%{include_paths}" |
| 595 | flag: "-isystem=%{include_paths}" |
| 596 | } |
| 597 | ``` |
| 598 | |
| 599 | expands to: |
| 600 | |
| 601 | ``` |
| 602 | -iprefix=<inc0> -isystem=<inc0> -iprefix=<inc1> -isystem=<inc1> |
| 603 | ``` |
| 604 | |
| 605 | Variables can correspond to structures accessible using dot-notation. For |
| 606 | example: |
| 607 | |
| 608 | ``` |
| 609 | flag_group { |
| 610 | flag: "-l%{libraries_to_link.name}" |
| 611 | } |
| 612 | ``` |
| 613 | |
| 614 | Structures can be nested and may also contain sequences. To prevent name clashes |
| 615 | and to be explicit, you must specify the full path through the fields. For |
| 616 | example: |
| 617 | |
| 618 | ``` |
| 619 | flag_group { |
| 620 | iterate_over: "libraries_to_link" |
| 621 | flag_group { |
| 622 | iterate_over: "libraries_to_link.shared_libraries" |
| 623 | flag: "-l%{libraries_to_link.shared_libraries.name}" |
| 624 | } |
| 625 | } |
| 626 | ``` |
| 627 | |
| 628 | ### Conditional expansion |
| 629 | |
| 630 | Flag groups support conditional expansion based on the presence of a particular |
| 631 | variable or its field using the `expand_if_all_available`, `expand_if_none_available`, |
| 632 | `expand_if_true`, `expand_if_false`, or `expand_if_equal` messages. For example: |
| 633 | |
| 634 | ``` |
| 635 | flag_group { |
| 636 | iterate_over: "libraries_to_link" |
| 637 | flag_group { |
| 638 | iterate_over: "libraries_to_link.shared_libraries" |
| 639 | flag_group { |
| 640 | expand_if_all_available: "libraries_to_link.shared_libraries.is_whole_archive" |
| 641 | flag: "--whole_archive" |
| 642 | } |
| 643 | flag_group { |
| 644 | flag: "-l%{libraries_to_link.shared_libraries.name}" |
| 645 | } |
| 646 | flag_group { |
| 647 | expand_if_all_available: "libraries_to_link.shared_libraries.is_whole_archive" |
| 648 | flag: "--no_whole_archive" |
| 649 | } |
| 650 | } |
| 651 | } |
| 652 | ``` |
| 653 | |
| 654 | **Note:** The `--whole_archive` and `--no_whole_archive` options are added to |
| 655 | the build command only when a currently iterated library has an |
| 656 | `is_whole_archive` field. |
| 657 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 658 | ## `CROSSTOOL` reference |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 659 | |
| 660 | This section provides a reference of build variables, features, and other |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 661 | information required to successfully configure `CROSSTOOL`. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 662 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 663 | ### `CROSSTOOL` build variables |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 664 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 665 | The following is a reference of `CROSSTOOL` build variables. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 666 | |
| 667 | **Note:** `[action]` indicates the relevant action type. |
| 668 | |
| 669 | <table> |
| 670 | <col width="300"> |
| 671 | <col width="600"> |
| 672 | <tr> |
| 673 | <td><strong>Variable</strong> |
| 674 | </td> |
| 675 | <td><strong>Description</strong> |
| 676 | </td> |
| 677 | </tr> |
| 678 | <tr> |
| 679 | <td><strong><code>source_file</code></strong> |
| 680 | </td> |
| 681 | <td><code>[compile]</code> Source file to compile. |
| 682 | </td> |
| 683 | </tr> |
| 684 | <tr> |
| 685 | <td><strong><code>input_file</code></strong> |
| 686 | </td> |
| 687 | <td><code>[strip]</code> Artifact to strip. |
| 688 | </td> |
| 689 | </tr> |
| 690 | <tr> |
| 691 | <td><strong><code>output_file</code></strong> |
| 692 | </td> |
| 693 | <td><code>[compile]</code> Compilation output. |
| 694 | </td> |
| 695 | </tr> |
| 696 | <tr> |
| 697 | <td><strong><code>output_assembly_file</code></strong> |
| 698 | </td> |
| 699 | <td><code>[compile]</code> Emitted assembly file. Applies only when the |
| 700 | <code>compile</code> action emits assembly text, typically when using the |
| 701 | <code>--save_temps</code> flag. The contents are the same as for |
| 702 | <code>output_file</code>. |
| 703 | </td> |
| 704 | </tr> |
| 705 | <tr> |
| 706 | <td><strong><code>output_preprocess_file</code></strong> |
| 707 | </td> |
| 708 | <td><code>[compile]</code> Preprocessed output. Applies only to compile |
| 709 | actions that only preprocess the source files, typically when using the |
| 710 | <code>--save_temps</code> flag. The contents are the same as for |
| 711 | <code>output_file</code>. |
| 712 | </td> |
| 713 | </tr> |
| 714 | <tr> |
| 715 | <td><strong><code>includes</code></strong> |
| 716 | </td> |
| 717 | <td><code>[compile]</code> Sequence of files the compiler must |
| 718 | unconditionally include in the compiled source. |
| 719 | </td> |
| 720 | </tr> |
| 721 | <tr> |
| 722 | <td><strong><code>include_paths</code></strong> |
| 723 | </td> |
| 724 | <td><code>[compile]</code> Sequence directories in which the compiler |
| 725 | searches for headers included using <code>#include<foo.h></code> |
| 726 | and <code>#include "foo.h"</code>. |
| 727 | </td> |
| 728 | </tr> |
| 729 | <tr> |
| 730 | <td><strong><code>quote_include_paths</code></strong> |
| 731 | </td> |
| 732 | <td><code>[compile]</code> Sequence of <code>-iquote</code> includes - |
| 733 | directories in which the compiler searches for headers included using |
| 734 | <code>#include<foo.h></code>. |
| 735 | </td> |
| 736 | </tr> |
| 737 | <tr> |
| 738 | <td><strong><code>system_include_paths</code></strong> |
| 739 | </td> |
| 740 | <td><code>[compile]</code> Sequence of <code>-isystem</code> includes - |
| 741 | directories in which the compiler searches for headers included using |
| 742 | <code>#include "foo.h"</code>. |
| 743 | </td> |
| 744 | </tr> |
| 745 | <tr> |
| 746 | <td><strong><code>dependency_file</code></strong> |
| 747 | </td> |
| 748 | <td><code>[compile]</code> The <code>.d</code> dependency file generated by |
| 749 | the compiler. |
| 750 | </td> |
| 751 | </tr> |
| 752 | <tr> |
| 753 | <td><strong><code>preprocessor_defines</code></strong> |
| 754 | </td> |
| 755 | <td><code>[compile]</code> Sequence of <code>defines</code>, such as |
| 756 | <code>--DDEBUG</code>. |
| 757 | </td> |
| 758 | </tr> |
| 759 | <tr> |
| 760 | <td><strong><code>pic</code></strong> |
| 761 | </td> |
| 762 | <td><code>[compile]</code> Compiles the output as position-independent code. |
| 763 | </td> |
| 764 | </tr> |
| 765 | <tr> |
| 766 | <td><strong><code>gcov_gcno_file</code></strong> |
| 767 | </td> |
| 768 | <td><code>[compile]</code> The <code>gcov</code> coverage file. |
| 769 | </td> |
| 770 | </tr> |
| 771 | <tr> |
| 772 | <td><strong><code>per_object_debug_info_file</code></strong> |
| 773 | </td> |
| 774 | <td><code>[compile]</code> The per-object debug info (<code>.dwp</code>) |
| 775 | file. |
| 776 | </td> |
| 777 | </tr> |
| 778 | <tr> |
| 779 | <td><strong><code>stripotps</code></strong> |
| 780 | </td> |
| 781 | <td><code>[strip]</code> Sequence of <code>stripopts</code>. |
| 782 | </td> |
| 783 | </tr> |
| 784 | <tr> |
| 785 | <td><strong><code>legacy_compile_flags</code></strong> |
| 786 | </td> |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 787 | <td><code>[compile]</code> Sequence of flags from legacy |
| 788 | <code>CROSSTOOL</code> fields such as <code>compiler_flag</code>, |
| 789 | <code>optional_compiler_flag</code>, <code>cxx_flag</code>, and |
| 790 | <code>optional_cxx_flag</code>. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 791 | </td> |
| 792 | </tr> |
| 793 | <tr> |
| 794 | <td><strong><code>user_compile_flags</code></strong> |
| 795 | </td> |
| 796 | <td><code>[compile]</code> Sequence of flags from either the |
| 797 | <code>copt</code> rule attribute or the <code>--copt</code>, |
| 798 | <code>--cxxopt</code>, and <code>--conlyopt</code> flags. |
| 799 | </td> |
| 800 | </tr> |
| 801 | <tr> |
| 802 | <td><strong><code>unfiltered_compile_flags</code></strong> |
| 803 | </td> |
| 804 | <td><code>[compile]</code> Sequence of flags from the |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 805 | <code>unfiltered_cxx_flag</code> legacy <code>CROSSTOOL</code> field or the |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 806 | <code>unfiltered _compile_flags</code> feature. These are not filtered by |
| 807 | the <code>nocopts</code> rule attribute. |
| 808 | </td> |
| 809 | </tr> |
| 810 | <tr> |
| 811 | <td><strong><code>sysroot</code></strong> |
| 812 | </td> |
| 813 | <td>The <code>sysroot</code>. |
| 814 | </td> |
| 815 | </tr> |
| 816 | <tr> |
| 817 | <td><strong><code>runtime_library_search_directories</code></strong> |
| 818 | </td> |
| 819 | <td><code>[link]</code> Entries in the linker runtime search path (usually |
| 820 | set with the <code>-rpath</code> flag). |
| 821 | </td> |
| 822 | </tr> |
| 823 | <tr> |
| 824 | <td><strong><code>library_search_directories</code></strong> |
| 825 | </td> |
| 826 | <td><code>[link]</code> Entries in the linker search path (usually set with |
| 827 | the <code>-L</code> flag). |
| 828 | </td> |
| 829 | </tr> |
| 830 | <tr> |
| 831 | <td><strong><code>libraries_to_link</code></strong> |
| 832 | </td> |
| 833 | <td><code>[link]</code> Flags providing files to link as inputs in the linker |
| 834 | invocation. |
| 835 | </td> |
| 836 | </tr> |
| 837 | <tr> |
| 838 | <td><strong><code>def_file_path</code></strong> |
| 839 | </td> |
| 840 | <td><code>[link]</code> Location of def file used on Windows with MSVC. |
| 841 | </td> |
| 842 | </tr> |
| 843 | <tr> |
| 844 | <td><strong><code>linker_param_file</code></strong> |
| 845 | </td> |
| 846 | <td><code>[link]</code> Location of linker param file created by bazel to |
| 847 | overcome command line length limit. |
| 848 | </td> |
| 849 | </tr> |
| 850 | <tr> |
| 851 | <td><strong><code>output_execpath</code></strong> |
| 852 | </td> |
| 853 | <td><code>[link]</code> execpath of the output of the linker. |
| 854 | </td> |
| 855 | </tr> |
| 856 | <tr> |
| 857 | <td><strong><code>generate_interface_library</code></strong> |
| 858 | </td> |
| 859 | <td><code>[link]</code> "yes"|"no" depending on whether interface library |
| 860 | should be generated. |
| 861 | </td> |
| 862 | </tr> |
| 863 | <tr> |
| 864 | <td><strong><code>interface_library_builder_path</code></strong> |
| 865 | </td> |
| 866 | <td><code>[link]</code> Path to the interface library builder tool. |
| 867 | </td> |
| 868 | </tr> |
| 869 | <tr> |
| 870 | <td><strong><code>interface_library_input_path</code></strong> |
| 871 | </td> |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 872 | <td><code>[link]</code> Input for the interface library <code>ifso</code> |
| 873 | builder tool. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 874 | </td> |
| 875 | </tr> |
| 876 | <tr> |
| 877 | <td><strong><code>interface_library_output_path</code></strong> |
| 878 | </td> |
| 879 | <td><code>[link]</code> Path where to generate interface library using the |
| 880 | <code>ifso</code> builder tool. |
| 881 | </td> |
| 882 | </tr> |
| 883 | <tr> |
| 884 | <td><strong><code>legacy_link_flags</code></strong> |
| 885 | </td> |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 886 | <td><code>[link]</code> Linker flags coming from the legacy |
| 887 | <code>CROSSTOOL</code>. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 888 | </td> |
| 889 | </tr> |
| 890 | <tr> |
| 891 | <td><strong><code>user_link_flags</code></strong> |
| 892 | </td> |
| 893 | <td><code>[link]</code> Linker flags coming from the <code>--linkopt</code> |
| 894 | or <code>linkopts</code> attribute. |
| 895 | </td> |
| 896 | </tr> |
| 897 | <tr> |
| 898 | <td><strong><code>symbol_counts_output</code></strong> |
| 899 | </td> |
| 900 | <td><code>[link]</code> Path to which to write symbol counts. |
| 901 | </td> |
| 902 | </tr> |
| 903 | <tr> |
| 904 | <td><strong><code>linkstamp_paths</code></strong> |
| 905 | </td> |
| 906 | <td><code>[link]</code> A build variable giving linkstamp paths. |
| 907 | </td> |
| 908 | </tr> |
| 909 | <tr> |
| 910 | <td><strong><code>force_pic</code></strong> |
| 911 | </td> |
| 912 | <td><code>[link]</code> Presence of this variable indicates that PIC code |
| 913 | should be generated. |
| 914 | </td> |
| 915 | </tr> |
| 916 | <tr> |
| 917 | <td><strong><code>strip_debug_symbols</code></strong> |
| 918 | </td> |
| 919 | <td><code>[link]</code> Presence of this variable indicates that the debug |
| 920 | symbols should be stripped. |
| 921 | </td> |
| 922 | </tr> |
| 923 | <tr> |
| 924 | <td><strong><code>is_cc_test</code></strong> |
| 925 | </td> |
| 926 | <td><code>[link]</code> Truthy when current action is a <code>cc_test</code> |
| 927 | linking action, false otherwise. |
| 928 | </td> |
| 929 | </tr> |
| 930 | <tr> |
| 931 | <td><strong><code>is_using_fission</code></strong> |
| 932 | </td> |
| 933 | <td><code>[link]</code> Presence of this variable indicates that files were |
| 934 | compiled with fission. Debug info is in <code>.dwo</code> files instead |
| 935 | of <code>.o</code> files and the linker needs to know this. |
| 936 | </td> |
| 937 | </tr> |
| 938 | </table> |
| 939 | |
| 940 | |
| 941 | |
| 942 | ### CROSSTOOL features |
| 943 | |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 944 | The following is a reference of `CROSSTOOL` features and their activation |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 945 | conditions. |
| 946 | |
| 947 | <table> |
| 948 | <col width="300"> |
| 949 | <col width="600"> |
| 950 | <tr> |
| 951 | <td><strong>Feature</strong> |
| 952 | </td> |
| 953 | <td><strong>Activation Condition</strong> |
| 954 | </td> |
| 955 | </tr> |
| 956 | <tr> |
| 957 | <td><strong><code>opt | dbg | fastbuild</code></strong> |
| 958 | </td> |
| 959 | <td>Enabled by default based on compilation mode. |
| 960 | </td> |
| 961 | </tr> |
| 962 | <tr> |
| 963 | <td><strong><code>static_linking_mode | dynamic_linking_mode</code></strong> |
| 964 | </td> |
| 965 | <td>Enabled by default based on linking mode. |
| 966 | </td> |
| 967 | </tr> |
| 968 | <tr> |
| 969 | <td><strong><code>random_seed</code></strong> |
| 970 | </td> |
| 971 | <td>Enabled by default. |
| 972 | </td> |
| 973 | </tr> |
| 974 | <tr> |
| 975 | <td><strong><code>dependency_file</code></strong> |
| 976 | </td> |
| 977 | <td>Enabled by default. |
| 978 | </td> |
| 979 | </tr> |
| 980 | <tr> |
| 981 | <td><strong><code>per_object_debug_info</code></strong> |
| 982 | </td> |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 983 | <td>Enabled if the <code>supports_fission</code> attribute is set in the |
| 984 | `CROSSTOOL` file and the current compilation mode is specified in the |
| 985 | <code>--fission</code> flag. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 986 | </td> |
| 987 | </tr> |
| 988 | <tr> |
| 989 | <td><strong><code>pic</code></strong> |
| 990 | </td> |
spomorski | 20ca4e1 | 2018-10-03 07:44:47 -0700 | [diff] [blame] | 991 | <td>Required if the target needs PIC objects for dynamic libraries. Enabled |
| 992 | by default - the `pic` variable is present whenever PIC compilation is |
| 993 | requested. |
spomorski | ab39ffb | 2018-10-02 11:19:32 -0700 | [diff] [blame] | 994 | </td> |
| 995 | </tr> |
| 996 | </table> |