1*67e74705SXin Li========================= 2*67e74705SXin LiDriver Design & Internals 3*67e74705SXin Li========================= 4*67e74705SXin Li 5*67e74705SXin Li.. contents:: 6*67e74705SXin Li :local: 7*67e74705SXin Li 8*67e74705SXin LiIntroduction 9*67e74705SXin Li============ 10*67e74705SXin Li 11*67e74705SXin LiThis document describes the Clang driver. The purpose of this document 12*67e74705SXin Liis to describe both the motivation and design goals for the driver, as 13*67e74705SXin Liwell as details of the internal implementation. 14*67e74705SXin Li 15*67e74705SXin LiFeatures and Goals 16*67e74705SXin Li================== 17*67e74705SXin Li 18*67e74705SXin LiThe Clang driver is intended to be a production quality compiler driver 19*67e74705SXin Liproviding access to the Clang compiler and tools, with a command line 20*67e74705SXin Liinterface which is compatible with the gcc driver. 21*67e74705SXin Li 22*67e74705SXin LiAlthough the driver is part of and driven by the Clang project, it is 23*67e74705SXin Lilogically a separate tool which shares many of the same goals as Clang: 24*67e74705SXin Li 25*67e74705SXin Li.. contents:: Features 26*67e74705SXin Li :local: 27*67e74705SXin Li 28*67e74705SXin LiGCC Compatibility 29*67e74705SXin Li----------------- 30*67e74705SXin Li 31*67e74705SXin LiThe number one goal of the driver is to ease the adoption of Clang by 32*67e74705SXin Liallowing users to drop Clang into a build system which was designed to 33*67e74705SXin Licall GCC. Although this makes the driver much more complicated than 34*67e74705SXin Limight otherwise be necessary, we decided that being very compatible with 35*67e74705SXin Lithe gcc command line interface was worth it in order to allow users to 36*67e74705SXin Liquickly test clang on their projects. 37*67e74705SXin Li 38*67e74705SXin LiFlexible 39*67e74705SXin Li-------- 40*67e74705SXin Li 41*67e74705SXin LiThe driver was designed to be flexible and easily accommodate new uses 42*67e74705SXin Lias we grow the clang and LLVM infrastructure. As one example, the driver 43*67e74705SXin Lican easily support the introduction of tools which have an integrated 44*67e74705SXin Liassembler; something we hope to add to LLVM in the future. 45*67e74705SXin Li 46*67e74705SXin LiSimilarly, most of the driver functionality is kept in a library which 47*67e74705SXin Lican be used to build other tools which want to implement or accept a gcc 48*67e74705SXin Lilike interface. 49*67e74705SXin Li 50*67e74705SXin LiLow Overhead 51*67e74705SXin Li------------ 52*67e74705SXin Li 53*67e74705SXin LiThe driver should have as little overhead as possible. In practice, we 54*67e74705SXin Lifound that the gcc driver by itself incurred a small but meaningful 55*67e74705SXin Lioverhead when compiling many small files. The driver doesn't do much 56*67e74705SXin Liwork compared to a compilation, but we have tried to keep it as 57*67e74705SXin Liefficient as possible by following a few simple principles: 58*67e74705SXin Li 59*67e74705SXin Li- Avoid memory allocation and string copying when possible. 60*67e74705SXin Li- Don't parse arguments more than once. 61*67e74705SXin Li- Provide a few simple interfaces for efficiently searching arguments. 62*67e74705SXin Li 63*67e74705SXin LiSimple 64*67e74705SXin Li------ 65*67e74705SXin Li 66*67e74705SXin LiFinally, the driver was designed to be "as simple as possible", given 67*67e74705SXin Lithe other goals. Notably, trying to be completely compatible with the 68*67e74705SXin Ligcc driver adds a significant amount of complexity. However, the design 69*67e74705SXin Liof the driver attempts to mitigate this complexity by dividing the 70*67e74705SXin Liprocess into a number of independent stages instead of a single 71*67e74705SXin Limonolithic task. 72*67e74705SXin Li 73*67e74705SXin LiInternal Design and Implementation 74*67e74705SXin Li================================== 75*67e74705SXin Li 76*67e74705SXin Li.. contents:: 77*67e74705SXin Li :local: 78*67e74705SXin Li :depth: 1 79*67e74705SXin Li 80*67e74705SXin LiInternals Introduction 81*67e74705SXin Li---------------------- 82*67e74705SXin Li 83*67e74705SXin LiIn order to satisfy the stated goals, the driver was designed to 84*67e74705SXin Licompletely subsume the functionality of the gcc executable; that is, the 85*67e74705SXin Lidriver should not need to delegate to gcc to perform subtasks. On 86*67e74705SXin LiDarwin, this implies that the Clang driver also subsumes the gcc 87*67e74705SXin Lidriver-driver, which is used to implement support for building universal 88*67e74705SXin Liimages (binaries and object files). This also implies that the driver 89*67e74705SXin Lishould be able to call the language specific compilers (e.g. cc1) 90*67e74705SXin Lidirectly, which means that it must have enough information to forward 91*67e74705SXin Licommand line arguments to child processes correctly. 92*67e74705SXin Li 93*67e74705SXin LiDesign Overview 94*67e74705SXin Li--------------- 95*67e74705SXin Li 96*67e74705SXin LiThe diagram below shows the significant components of the driver 97*67e74705SXin Liarchitecture and how they relate to one another. The orange components 98*67e74705SXin Lirepresent concrete data structures built by the driver, the green 99*67e74705SXin Licomponents indicate conceptually distinct stages which manipulate these 100*67e74705SXin Lidata structures, and the blue components are important helper classes. 101*67e74705SXin Li 102*67e74705SXin Li.. image:: DriverArchitecture.png 103*67e74705SXin Li :align: center 104*67e74705SXin Li :alt: Driver Architecture Diagram 105*67e74705SXin Li 106*67e74705SXin LiDriver Stages 107*67e74705SXin Li------------- 108*67e74705SXin Li 109*67e74705SXin LiThe driver functionality is conceptually divided into five stages: 110*67e74705SXin Li 111*67e74705SXin Li#. **Parse: Option Parsing** 112*67e74705SXin Li 113*67e74705SXin Li The command line argument strings are decomposed into arguments 114*67e74705SXin Li (``Arg`` instances). The driver expects to understand all available 115*67e74705SXin Li options, although there is some facility for just passing certain 116*67e74705SXin Li classes of options through (like ``-Wl,``). 117*67e74705SXin Li 118*67e74705SXin Li Each argument corresponds to exactly one abstract ``Option`` 119*67e74705SXin Li definition, which describes how the option is parsed along with some 120*67e74705SXin Li additional metadata. The Arg instances themselves are lightweight and 121*67e74705SXin Li merely contain enough information for clients to determine which 122*67e74705SXin Li option they correspond to and their values (if they have additional 123*67e74705SXin Li parameters). 124*67e74705SXin Li 125*67e74705SXin Li For example, a command line like "-Ifoo -I foo" would parse to two 126*67e74705SXin Li Arg instances (a JoinedArg and a SeparateArg instance), but each 127*67e74705SXin Li would refer to the same Option. 128*67e74705SXin Li 129*67e74705SXin Li Options are lazily created in order to avoid populating all Option 130*67e74705SXin Li classes when the driver is loaded. Most of the driver code only needs 131*67e74705SXin Li to deal with options by their unique ID (e.g., ``options::OPT_I``), 132*67e74705SXin Li 133*67e74705SXin Li Arg instances themselves do not generally store the values of 134*67e74705SXin Li parameters. In many cases, this would simply result in creating 135*67e74705SXin Li unnecessary string copies. Instead, Arg instances are always embedded 136*67e74705SXin Li inside an ArgList structure, which contains the original vector of 137*67e74705SXin Li argument strings. Each Arg itself only needs to contain an index into 138*67e74705SXin Li this vector instead of storing its values directly. 139*67e74705SXin Li 140*67e74705SXin Li The clang driver can dump the results of this stage using the 141*67e74705SXin Li ``-###`` flag (which must precede any actual command 142*67e74705SXin Li line arguments). For example: 143*67e74705SXin Li 144*67e74705SXin Li .. code-block:: console 145*67e74705SXin Li 146*67e74705SXin Li $ clang -### -Xarch_i386 -fomit-frame-pointer -Wa,-fast -Ifoo -I foo t.c 147*67e74705SXin Li Option 0 - Name: "-Xarch_", Values: {"i386", "-fomit-frame-pointer"} 148*67e74705SXin Li Option 1 - Name: "-Wa,", Values: {"-fast"} 149*67e74705SXin Li Option 2 - Name: "-I", Values: {"foo"} 150*67e74705SXin Li Option 3 - Name: "-I", Values: {"foo"} 151*67e74705SXin Li Option 4 - Name: "<input>", Values: {"t.c"} 152*67e74705SXin Li 153*67e74705SXin Li After this stage is complete the command line should be broken down 154*67e74705SXin Li into well defined option objects with their appropriate parameters. 155*67e74705SXin Li Subsequent stages should rarely, if ever, need to do any string 156*67e74705SXin Li processing. 157*67e74705SXin Li 158*67e74705SXin Li#. **Pipeline: Compilation Action Construction** 159*67e74705SXin Li 160*67e74705SXin Li Once the arguments are parsed, the tree of subprocess jobs needed for 161*67e74705SXin Li the desired compilation sequence are constructed. This involves 162*67e74705SXin Li determining the input files and their types, what work is to be done 163*67e74705SXin Li on them (preprocess, compile, assemble, link, etc.), and constructing 164*67e74705SXin Li a list of Action instances for each task. The result is a list of one 165*67e74705SXin Li or more top-level actions, each of which generally corresponds to a 166*67e74705SXin Li single output (for example, an object or linked executable). 167*67e74705SXin Li 168*67e74705SXin Li The majority of Actions correspond to actual tasks, however there are 169*67e74705SXin Li two special Actions. The first is InputAction, which simply serves to 170*67e74705SXin Li adapt an input argument for use as an input to other Actions. The 171*67e74705SXin Li second is BindArchAction, which conceptually alters the architecture 172*67e74705SXin Li to be used for all of its input Actions. 173*67e74705SXin Li 174*67e74705SXin Li The clang driver can dump the results of this stage using the 175*67e74705SXin Li ``-ccc-print-phases`` flag. For example: 176*67e74705SXin Li 177*67e74705SXin Li .. code-block:: console 178*67e74705SXin Li 179*67e74705SXin Li $ clang -ccc-print-phases -x c t.c -x assembler t.s 180*67e74705SXin Li 0: input, "t.c", c 181*67e74705SXin Li 1: preprocessor, {0}, cpp-output 182*67e74705SXin Li 2: compiler, {1}, assembler 183*67e74705SXin Li 3: assembler, {2}, object 184*67e74705SXin Li 4: input, "t.s", assembler 185*67e74705SXin Li 5: assembler, {4}, object 186*67e74705SXin Li 6: linker, {3, 5}, image 187*67e74705SXin Li 188*67e74705SXin Li Here the driver is constructing seven distinct actions, four to 189*67e74705SXin Li compile the "t.c" input into an object file, two to assemble the 190*67e74705SXin Li "t.s" input, and one to link them together. 191*67e74705SXin Li 192*67e74705SXin Li A rather different compilation pipeline is shown here; in this 193*67e74705SXin Li example there are two top level actions to compile the input files 194*67e74705SXin Li into two separate object files, where each object file is built using 195*67e74705SXin Li ``lipo`` to merge results built for two separate architectures. 196*67e74705SXin Li 197*67e74705SXin Li .. code-block:: console 198*67e74705SXin Li 199*67e74705SXin Li $ clang -ccc-print-phases -c -arch i386 -arch x86_64 t0.c t1.c 200*67e74705SXin Li 0: input, "t0.c", c 201*67e74705SXin Li 1: preprocessor, {0}, cpp-output 202*67e74705SXin Li 2: compiler, {1}, assembler 203*67e74705SXin Li 3: assembler, {2}, object 204*67e74705SXin Li 4: bind-arch, "i386", {3}, object 205*67e74705SXin Li 5: bind-arch, "x86_64", {3}, object 206*67e74705SXin Li 6: lipo, {4, 5}, object 207*67e74705SXin Li 7: input, "t1.c", c 208*67e74705SXin Li 8: preprocessor, {7}, cpp-output 209*67e74705SXin Li 9: compiler, {8}, assembler 210*67e74705SXin Li 10: assembler, {9}, object 211*67e74705SXin Li 11: bind-arch, "i386", {10}, object 212*67e74705SXin Li 12: bind-arch, "x86_64", {10}, object 213*67e74705SXin Li 13: lipo, {11, 12}, object 214*67e74705SXin Li 215*67e74705SXin Li After this stage is complete the compilation process is divided into 216*67e74705SXin Li a simple set of actions which need to be performed to produce 217*67e74705SXin Li intermediate or final outputs (in some cases, like ``-fsyntax-only``, 218*67e74705SXin Li there is no "real" final output). Phases are well known compilation 219*67e74705SXin Li steps, such as "preprocess", "compile", "assemble", "link", etc. 220*67e74705SXin Li 221*67e74705SXin Li#. **Bind: Tool & Filename Selection** 222*67e74705SXin Li 223*67e74705SXin Li This stage (in conjunction with the Translate stage) turns the tree 224*67e74705SXin Li of Actions into a list of actual subprocess to run. Conceptually, the 225*67e74705SXin Li driver performs a top down matching to assign Action(s) to Tools. The 226*67e74705SXin Li ToolChain is responsible for selecting the tool to perform a 227*67e74705SXin Li particular action; once selected the driver interacts with the tool 228*67e74705SXin Li to see if it can match additional actions (for example, by having an 229*67e74705SXin Li integrated preprocessor). 230*67e74705SXin Li 231*67e74705SXin Li Once Tools have been selected for all actions, the driver determines 232*67e74705SXin Li how the tools should be connected (for example, using an inprocess 233*67e74705SXin Li module, pipes, temporary files, or user provided filenames). If an 234*67e74705SXin Li output file is required, the driver also computes the appropriate 235*67e74705SXin Li file name (the suffix and file location depend on the input types and 236*67e74705SXin Li options such as ``-save-temps``). 237*67e74705SXin Li 238*67e74705SXin Li The driver interacts with a ToolChain to perform the Tool bindings. 239*67e74705SXin Li Each ToolChain contains information about all the tools needed for 240*67e74705SXin Li compilation for a particular architecture, platform, and operating 241*67e74705SXin Li system. A single driver invocation may query multiple ToolChains 242*67e74705SXin Li during one compilation in order to interact with tools for separate 243*67e74705SXin Li architectures. 244*67e74705SXin Li 245*67e74705SXin Li The results of this stage are not computed directly, but the driver 246*67e74705SXin Li can print the results via the ``-ccc-print-bindings`` option. For 247*67e74705SXin Li example: 248*67e74705SXin Li 249*67e74705SXin Li .. code-block:: console 250*67e74705SXin Li 251*67e74705SXin Li $ clang -ccc-print-bindings -arch i386 -arch ppc t0.c 252*67e74705SXin Li # "i386-apple-darwin9" - "clang", inputs: ["t0.c"], output: "/tmp/cc-Sn4RKF.s" 253*67e74705SXin Li # "i386-apple-darwin9" - "darwin::Assemble", inputs: ["/tmp/cc-Sn4RKF.s"], output: "/tmp/cc-gvSnbS.o" 254*67e74705SXin Li # "i386-apple-darwin9" - "darwin::Link", inputs: ["/tmp/cc-gvSnbS.o"], output: "/tmp/cc-jgHQxi.out" 255*67e74705SXin Li # "ppc-apple-darwin9" - "gcc::Compile", inputs: ["t0.c"], output: "/tmp/cc-Q0bTox.s" 256*67e74705SXin Li # "ppc-apple-darwin9" - "gcc::Assemble", inputs: ["/tmp/cc-Q0bTox.s"], output: "/tmp/cc-WCdicw.o" 257*67e74705SXin Li # "ppc-apple-darwin9" - "gcc::Link", inputs: ["/tmp/cc-WCdicw.o"], output: "/tmp/cc-HHBEBh.out" 258*67e74705SXin Li # "i386-apple-darwin9" - "darwin::Lipo", inputs: ["/tmp/cc-jgHQxi.out", "/tmp/cc-HHBEBh.out"], output: "a.out" 259*67e74705SXin Li 260*67e74705SXin Li This shows the tool chain, tool, inputs and outputs which have been 261*67e74705SXin Li bound for this compilation sequence. Here clang is being used to 262*67e74705SXin Li compile t0.c on the i386 architecture and darwin specific versions of 263*67e74705SXin Li the tools are being used to assemble and link the result, but generic 264*67e74705SXin Li gcc versions of the tools are being used on PowerPC. 265*67e74705SXin Li 266*67e74705SXin Li#. **Translate: Tool Specific Argument Translation** 267*67e74705SXin Li 268*67e74705SXin Li Once a Tool has been selected to perform a particular Action, the 269*67e74705SXin Li Tool must construct concrete Commands which will be executed during 270*67e74705SXin Li compilation. The main work is in translating from the gcc style 271*67e74705SXin Li command line options to whatever options the subprocess expects. 272*67e74705SXin Li 273*67e74705SXin Li Some tools, such as the assembler, only interact with a handful of 274*67e74705SXin Li arguments and just determine the path of the executable to call and 275*67e74705SXin Li pass on their input and output arguments. Others, like the compiler 276*67e74705SXin Li or the linker, may translate a large number of arguments in addition. 277*67e74705SXin Li 278*67e74705SXin Li The ArgList class provides a number of simple helper methods to 279*67e74705SXin Li assist with translating arguments; for example, to pass on only the 280*67e74705SXin Li last of arguments corresponding to some option, or all arguments for 281*67e74705SXin Li an option. 282*67e74705SXin Li 283*67e74705SXin Li The result of this stage is a list of Commands (executable paths and 284*67e74705SXin Li argument strings) to execute. 285*67e74705SXin Li 286*67e74705SXin Li#. **Execute** 287*67e74705SXin Li 288*67e74705SXin Li Finally, the compilation pipeline is executed. This is mostly 289*67e74705SXin Li straightforward, although there is some interaction with options like 290*67e74705SXin Li ``-pipe``, ``-pass-exit-codes`` and ``-time``. 291*67e74705SXin Li 292*67e74705SXin LiAdditional Notes 293*67e74705SXin Li---------------- 294*67e74705SXin Li 295*67e74705SXin LiThe Compilation Object 296*67e74705SXin Li^^^^^^^^^^^^^^^^^^^^^^ 297*67e74705SXin Li 298*67e74705SXin LiThe driver constructs a Compilation object for each set of command line 299*67e74705SXin Liarguments. The Driver itself is intended to be invariant during 300*67e74705SXin Liconstruction of a Compilation; an IDE should be able to construct a 301*67e74705SXin Lisingle long lived driver instance to use for an entire build, for 302*67e74705SXin Liexample. 303*67e74705SXin Li 304*67e74705SXin LiThe Compilation object holds information that is particular to each 305*67e74705SXin Licompilation sequence. For example, the list of used temporary files 306*67e74705SXin Li(which must be removed once compilation is finished) and result files 307*67e74705SXin Li(which should be removed if compilation fails). 308*67e74705SXin Li 309*67e74705SXin LiUnified Parsing & Pipelining 310*67e74705SXin Li^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 311*67e74705SXin Li 312*67e74705SXin LiParsing and pipelining both occur without reference to a Compilation 313*67e74705SXin Liinstance. This is by design; the driver expects that both of these 314*67e74705SXin Liphases are platform neutral, with a few very well defined exceptions 315*67e74705SXin Lisuch as whether the platform uses a driver driver. 316*67e74705SXin Li 317*67e74705SXin LiToolChain Argument Translation 318*67e74705SXin Li^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 319*67e74705SXin Li 320*67e74705SXin LiIn order to match gcc very closely, the clang driver currently allows 321*67e74705SXin Litool chains to perform their own translation of the argument list (into 322*67e74705SXin Lia new ArgList data structure). Although this allows the clang driver to 323*67e74705SXin Limatch gcc easily, it also makes the driver operation much harder to 324*67e74705SXin Liunderstand (since the Tools stop seeing some arguments the user 325*67e74705SXin Liprovided, and see new ones instead). 326*67e74705SXin Li 327*67e74705SXin LiFor example, on Darwin ``-gfull`` gets translated into two separate 328*67e74705SXin Liarguments, ``-g`` and ``-fno-eliminate-unused-debug-symbols``. Trying to 329*67e74705SXin Liwrite Tool logic to do something with ``-gfull`` will not work, because 330*67e74705SXin LiTool argument translation is done after the arguments have been 331*67e74705SXin Litranslated. 332*67e74705SXin Li 333*67e74705SXin LiA long term goal is to remove this tool chain specific translation, and 334*67e74705SXin Liinstead force each tool to change its own logic to do the right thing on 335*67e74705SXin Lithe untranslated original arguments. 336*67e74705SXin Li 337*67e74705SXin LiUnused Argument Warnings 338*67e74705SXin Li^^^^^^^^^^^^^^^^^^^^^^^^ 339*67e74705SXin Li 340*67e74705SXin LiThe driver operates by parsing all arguments but giving Tools the 341*67e74705SXin Liopportunity to choose which arguments to pass on. One downside of this 342*67e74705SXin Liinfrastructure is that if the user misspells some option, or is confused 343*67e74705SXin Liabout which options to use, some command line arguments the user really 344*67e74705SXin Licared about may go unused. This problem is particularly important when 345*67e74705SXin Liusing clang as a compiler, since the clang compiler does not support 346*67e74705SXin Lianywhere near all the options that gcc does, and we want to make sure 347*67e74705SXin Liusers know which ones are being used. 348*67e74705SXin Li 349*67e74705SXin LiTo support this, the driver maintains a bit associated with each 350*67e74705SXin Liargument of whether it has been used (at all) during the compilation. 351*67e74705SXin LiThis bit usually doesn't need to be set by hand, as the key ArgList 352*67e74705SXin Liaccessors will set it automatically. 353*67e74705SXin Li 354*67e74705SXin LiWhen a compilation is successful (there are no errors), the driver 355*67e74705SXin Lichecks the bit and emits an "unused argument" warning for any arguments 356*67e74705SXin Liwhich were never accessed. This is conservative (the argument may not 357*67e74705SXin Lihave been used to do what the user wanted) but still catches the most 358*67e74705SXin Liobvious cases. 359*67e74705SXin Li 360*67e74705SXin LiRelation to GCC Driver Concepts 361*67e74705SXin Li------------------------------- 362*67e74705SXin Li 363*67e74705SXin LiFor those familiar with the gcc driver, this section provides a brief 364*67e74705SXin Lioverview of how things from the gcc driver map to the clang driver. 365*67e74705SXin Li 366*67e74705SXin Li- **Driver Driver** 367*67e74705SXin Li 368*67e74705SXin Li The driver driver is fully integrated into the clang driver. The 369*67e74705SXin Li driver simply constructs additional Actions to bind the architecture 370*67e74705SXin Li during the *Pipeline* phase. The tool chain specific argument 371*67e74705SXin Li translation is responsible for handling ``-Xarch_``. 372*67e74705SXin Li 373*67e74705SXin Li The one caveat is that this approach requires ``-Xarch_`` not be used 374*67e74705SXin Li to alter the compilation itself (for example, one cannot provide 375*67e74705SXin Li ``-S`` as an ``-Xarch_`` argument). The driver attempts to reject 376*67e74705SXin Li such invocations, and overall there isn't a good reason to abuse 377*67e74705SXin Li ``-Xarch_`` to that end in practice. 378*67e74705SXin Li 379*67e74705SXin Li The upside is that the clang driver is more efficient and does little 380*67e74705SXin Li extra work to support universal builds. It also provides better error 381*67e74705SXin Li reporting and UI consistency. 382*67e74705SXin Li 383*67e74705SXin Li- **Specs** 384*67e74705SXin Li 385*67e74705SXin Li The clang driver has no direct correspondent for "specs". The 386*67e74705SXin Li majority of the functionality that is embedded in specs is in the 387*67e74705SXin Li Tool specific argument translation routines. The parts of specs which 388*67e74705SXin Li control the compilation pipeline are generally part of the *Pipeline* 389*67e74705SXin Li stage. 390*67e74705SXin Li 391*67e74705SXin Li- **Toolchains** 392*67e74705SXin Li 393*67e74705SXin Li The gcc driver has no direct understanding of tool chains. Each gcc 394*67e74705SXin Li binary roughly corresponds to the information which is embedded 395*67e74705SXin Li inside a single ToolChain. 396*67e74705SXin Li 397*67e74705SXin Li The clang driver is intended to be portable and support complex 398*67e74705SXin Li compilation environments. All platform and tool chain specific code 399*67e74705SXin Li should be protected behind either abstract or well defined interfaces 400*67e74705SXin Li (such as whether the platform supports use as a driver driver). 401