github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/third_party/toolchains/preconfig/centos6/gcc7/cc_toolchain_config.bzl (about)

     1  # Copyright 2019 The Bazel Authors. All rights reserved.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #    http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  """A Starlark cc_toolchain configuration rule"""
    16  
    17  load(
    18      "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
    19      "action_config",
    20      "artifact_name_pattern",
    21      "env_entry",
    22      "env_set",
    23      "feature",
    24      "feature_set",
    25      "flag_group",
    26      "flag_set",
    27      "make_variable",  # @unused
    28      "tool",
    29      "tool_path",
    30      "variable_with_value",
    31      "with_feature_set",
    32  )
    33  load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
    34  
    35  all_compile_actions = [
    36      ACTION_NAMES.c_compile,
    37      ACTION_NAMES.cpp_compile,
    38      ACTION_NAMES.linkstamp_compile,
    39      ACTION_NAMES.assemble,
    40      ACTION_NAMES.preprocess_assemble,
    41      ACTION_NAMES.cpp_header_parsing,
    42      ACTION_NAMES.cpp_module_compile,
    43      ACTION_NAMES.cpp_module_codegen,
    44      ACTION_NAMES.clif_match,
    45      ACTION_NAMES.lto_backend,
    46  ]
    47  
    48  all_cpp_compile_actions = [
    49      ACTION_NAMES.cpp_compile,
    50      ACTION_NAMES.linkstamp_compile,
    51      ACTION_NAMES.cpp_header_parsing,
    52      ACTION_NAMES.cpp_module_compile,
    53      ACTION_NAMES.cpp_module_codegen,
    54      ACTION_NAMES.clif_match,
    55  ]
    56  
    57  preprocessor_compile_actions = [
    58      ACTION_NAMES.c_compile,
    59      ACTION_NAMES.cpp_compile,
    60      ACTION_NAMES.linkstamp_compile,
    61      ACTION_NAMES.preprocess_assemble,
    62      ACTION_NAMES.cpp_header_parsing,
    63      ACTION_NAMES.cpp_module_compile,
    64      ACTION_NAMES.clif_match,
    65  ]
    66  
    67  codegen_compile_actions = [
    68      ACTION_NAMES.c_compile,
    69      ACTION_NAMES.cpp_compile,
    70      ACTION_NAMES.linkstamp_compile,
    71      ACTION_NAMES.assemble,
    72      ACTION_NAMES.preprocess_assemble,
    73      ACTION_NAMES.cpp_module_codegen,
    74      ACTION_NAMES.lto_backend,
    75  ]
    76  
    77  all_link_actions = [
    78      ACTION_NAMES.cpp_link_executable,
    79      ACTION_NAMES.cpp_link_dynamic_library,
    80      ACTION_NAMES.cpp_link_nodeps_dynamic_library,
    81  ]
    82  
    83  def _windows_msvc_impl(ctx):
    84      toolchain_identifier = "msvc_x64"
    85      host_system_name = "local"
    86      target_system_name = "local"
    87      target_cpu = "x64_windows"
    88      target_libc = "msvcrt"
    89      compiler = "msvc-cl"
    90      abi_version = "local"
    91      abi_libc_version = "local"
    92      cc_target_os = None
    93      builtin_sysroot = None
    94  
    95      cxx_builtin_include_directories = [
    96          "/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include",
    97          "/usr/local/include",
    98          "/opt/rh/devtoolset-7/root/usr/include",
    99          "/usr/include",
   100          "/opt/rh/devtoolset-7/root/usr/include/c++/7",
   101          "/opt/rh/devtoolset-7/root/usr/include/c++/7/x86_64-redhat-linux",
   102          "/opt/rh/devtoolset-7/root/usr/include/c++/7/backward",
   103      ]
   104  
   105      cpp_link_nodeps_dynamic_library_action = action_config(
   106          action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library,
   107          implies = [
   108              "nologo",
   109              "shared_flag",
   110              "linkstamps",
   111              "output_execpath_flags",
   112              "input_param_flags",
   113              "user_link_flags",
   114              "default_link_flags",
   115              "linker_subsystem_flag",
   116              "linker_param_file",
   117              "msvc_env",
   118              "no_stripping",
   119              "has_configured_linker_path",
   120              "def_file",
   121          ],
   122          tools = [tool(path = "")],
   123      )
   124  
   125      cpp_link_static_library_action = action_config(
   126          action_name = ACTION_NAMES.cpp_link_static_library,
   127          implies = [
   128              "nologo",
   129              "archiver_flags",
   130              "input_param_flags",
   131              "linker_param_file",
   132              "msvc_env",
   133          ],
   134          tools = [tool(path = "")],
   135      )
   136  
   137      assemble_action = action_config(
   138          action_name = ACTION_NAMES.assemble,
   139          implies = [
   140              "compiler_input_flags",
   141              "compiler_output_flags",
   142              "nologo",
   143              "msvc_env",
   144              "sysroot",
   145          ],
   146          tools = [tool(path = "")],
   147      )
   148  
   149      preprocess_assemble_action = action_config(
   150          action_name = ACTION_NAMES.preprocess_assemble,
   151          implies = [
   152              "compiler_input_flags",
   153              "compiler_output_flags",
   154              "nologo",
   155              "msvc_env",
   156              "sysroot",
   157          ],
   158          tools = [tool(path = "")],
   159      )
   160  
   161      c_compile_action = action_config(
   162          action_name = ACTION_NAMES.c_compile,
   163          implies = [
   164              "compiler_input_flags",
   165              "compiler_output_flags",
   166              "default_compile_flags",
   167              "nologo",
   168              "msvc_env",
   169              "parse_showincludes",
   170              "user_compile_flags",
   171              "sysroot",
   172              "unfiltered_compile_flags",
   173          ],
   174          tools = [tool(path = "")],
   175      )
   176  
   177      cpp_compile_action = action_config(
   178          action_name = ACTION_NAMES.cpp_compile,
   179          implies = [
   180              "compiler_input_flags",
   181              "compiler_output_flags",
   182              "default_compile_flags",
   183              "nologo",
   184              "msvc_env",
   185              "parse_showincludes",
   186              "user_compile_flags",
   187              "sysroot",
   188              "unfiltered_compile_flags",
   189          ],
   190          tools = [tool(path = "")],
   191      )
   192  
   193      cpp_link_executable_action = action_config(
   194          action_name = ACTION_NAMES.cpp_link_executable,
   195          implies = [
   196              "nologo",
   197              "linkstamps",
   198              "output_execpath_flags",
   199              "input_param_flags",
   200              "user_link_flags",
   201              "default_link_flags",
   202              "linker_subsystem_flag",
   203              "linker_param_file",
   204              "msvc_env",
   205              "no_stripping",
   206          ],
   207          tools = [tool(path = "")],
   208      )
   209  
   210      cpp_link_dynamic_library_action = action_config(
   211          action_name = ACTION_NAMES.cpp_link_dynamic_library,
   212          implies = [
   213              "nologo",
   214              "shared_flag",
   215              "linkstamps",
   216              "output_execpath_flags",
   217              "input_param_flags",
   218              "user_link_flags",
   219              "default_link_flags",
   220              "linker_subsystem_flag",
   221              "linker_param_file",
   222              "msvc_env",
   223              "no_stripping",
   224              "has_configured_linker_path",
   225              "def_file",
   226          ],
   227          tools = [tool(path = "")],
   228      )
   229  
   230      action_configs = [
   231          assemble_action,
   232          preprocess_assemble_action,
   233          c_compile_action,
   234          cpp_compile_action,
   235          cpp_link_executable_action,
   236          cpp_link_dynamic_library_action,
   237          cpp_link_nodeps_dynamic_library_action,
   238          cpp_link_static_library_action,
   239      ]
   240  
   241      msvc_link_env_feature = feature(
   242          name = "msvc_link_env",
   243          env_sets = [
   244              env_set(
   245                  actions = all_link_actions +
   246                            [ACTION_NAMES.cpp_link_static_library],
   247                  env_entries = [env_entry(key = "LIB", value = "")],
   248              ),
   249          ],
   250      )
   251  
   252      shared_flag_feature = feature(
   253          name = "shared_flag",
   254          flag_sets = [
   255              flag_set(
   256                  actions = [
   257                      ACTION_NAMES.cpp_link_dynamic_library,
   258                      ACTION_NAMES.cpp_link_nodeps_dynamic_library,
   259                  ],
   260                  flag_groups = [flag_group(flags = ["/DLL"])],
   261              ),
   262          ],
   263      )
   264  
   265      determinism_feature = feature(
   266          name = "determinism",
   267          enabled = True,
   268          flag_sets = [
   269              flag_set(
   270                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   271                  flag_groups = [
   272                      flag_group(
   273                          flags = [
   274                              "/wd4117",
   275                              "-D__DATE__=\"redacted\"",
   276                              "-D__TIMESTAMP__=\"redacted\"",
   277                              "-D__TIME__=\"redacted\"",
   278                          ],
   279                      ),
   280                  ],
   281              ),
   282          ],
   283      )
   284  
   285      sysroot_feature = feature(
   286          name = "sysroot",
   287          flag_sets = [
   288              flag_set(
   289                  actions = [
   290                      ACTION_NAMES.assemble,
   291                      ACTION_NAMES.preprocess_assemble,
   292                      ACTION_NAMES.c_compile,
   293                      ACTION_NAMES.cpp_compile,
   294                      ACTION_NAMES.cpp_header_parsing,
   295                      ACTION_NAMES.cpp_module_compile,
   296                      ACTION_NAMES.cpp_module_codegen,
   297                      ACTION_NAMES.cpp_link_executable,
   298                      ACTION_NAMES.cpp_link_dynamic_library,
   299                      ACTION_NAMES.cpp_link_nodeps_dynamic_library,
   300                  ],
   301                  flag_groups = [
   302                      flag_group(
   303                          flags = ["--sysroot=%{sysroot}"],
   304                          iterate_over = "sysroot",
   305                          expand_if_available = "sysroot",
   306                      ),
   307                  ],
   308              ),
   309          ],
   310      )
   311  
   312      unfiltered_compile_flags_feature = feature(
   313          name = "unfiltered_compile_flags",
   314          flag_sets = [
   315              flag_set(
   316                  actions = [
   317                      ACTION_NAMES.preprocess_assemble,
   318                      ACTION_NAMES.c_compile,
   319                      ACTION_NAMES.cpp_compile,
   320                      ACTION_NAMES.cpp_header_parsing,
   321                      ACTION_NAMES.cpp_module_compile,
   322                      ACTION_NAMES.cpp_module_codegen,
   323                  ],
   324                  flag_groups = [
   325                      flag_group(
   326                          flags = ["%{unfiltered_compile_flags}"],
   327                          iterate_over = "unfiltered_compile_flags",
   328                          expand_if_available = "unfiltered_compile_flags",
   329                      ),
   330                  ],
   331              ),
   332          ],
   333      )
   334  
   335      copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary")
   336  
   337      input_param_flags_feature = feature(
   338          name = "input_param_flags",
   339          flag_sets = [
   340              flag_set(
   341                  actions = [
   342                      ACTION_NAMES.cpp_link_dynamic_library,
   343                      ACTION_NAMES.cpp_link_nodeps_dynamic_library,
   344                  ],
   345                  flag_groups = [
   346                      flag_group(
   347                          flags = ["/IMPLIB:%{interface_library_output_path}"],
   348                          expand_if_available = "interface_library_output_path",
   349                      ),
   350                  ],
   351              ),
   352              flag_set(
   353                  actions = all_link_actions,
   354                  flag_groups = [
   355                      flag_group(
   356                          flags = ["%{libopts}"],
   357                          iterate_over = "libopts",
   358                          expand_if_available = "libopts",
   359                      ),
   360                  ],
   361              ),
   362              flag_set(
   363                  actions = all_link_actions +
   364                            [ACTION_NAMES.cpp_link_static_library],
   365                  flag_groups = [
   366                      flag_group(
   367                          iterate_over = "libraries_to_link",
   368                          flag_groups = [
   369                              flag_group(
   370                                  iterate_over = "libraries_to_link.object_files",
   371                                  flag_groups = [flag_group(flags = ["%{libraries_to_link.object_files}"])],
   372                                  expand_if_equal = variable_with_value(
   373                                      name = "libraries_to_link.type",
   374                                      value = "object_file_group",
   375                                  ),
   376                              ),
   377                              flag_group(
   378                                  flag_groups = [flag_group(flags = ["%{libraries_to_link.name}"])],
   379                                  expand_if_equal = variable_with_value(
   380                                      name = "libraries_to_link.type",
   381                                      value = "object_file",
   382                                  ),
   383                              ),
   384                              flag_group(
   385                                  flag_groups = [flag_group(flags = ["%{libraries_to_link.name}"])],
   386                                  expand_if_equal = variable_with_value(
   387                                      name = "libraries_to_link.type",
   388                                      value = "interface_library",
   389                                  ),
   390                              ),
   391                              flag_group(
   392                                  flag_groups = [
   393                                      flag_group(
   394                                          flags = ["%{libraries_to_link.name}"],
   395                                          expand_if_false = "libraries_to_link.is_whole_archive",
   396                                      ),
   397                                      flag_group(
   398                                          flags = ["/WHOLEARCHIVE:%{libraries_to_link.name}"],
   399                                          expand_if_true = "libraries_to_link.is_whole_archive",
   400                                      ),
   401                                  ],
   402                                  expand_if_equal = variable_with_value(
   403                                      name = "libraries_to_link.type",
   404                                      value = "static_library",
   405                                  ),
   406                              ),
   407                          ],
   408                          expand_if_available = "libraries_to_link",
   409                      ),
   410                  ],
   411              ),
   412          ],
   413      )
   414  
   415      fastbuild_feature = feature(
   416          name = "fastbuild",
   417          flag_sets = [
   418              flag_set(
   419                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   420                  flag_groups = [flag_group(flags = ["/Od", "/Z7"])],
   421              ),
   422              flag_set(
   423                  actions = all_link_actions,
   424                  flag_groups = [
   425                      flag_group(
   426                          flags = ["", "/INCREMENTAL:NO"],
   427                      ),
   428                  ],
   429              ),
   430          ],
   431          implies = ["generate_pdb_file"],
   432      )
   433  
   434      user_compile_flags_feature = feature(
   435          name = "user_compile_flags",
   436          flag_sets = [
   437              flag_set(
   438                  actions = [
   439                      ACTION_NAMES.preprocess_assemble,
   440                      ACTION_NAMES.c_compile,
   441                      ACTION_NAMES.cpp_compile,
   442                      ACTION_NAMES.cpp_header_parsing,
   443                      ACTION_NAMES.cpp_module_compile,
   444                      ACTION_NAMES.cpp_module_codegen,
   445                  ],
   446                  flag_groups = [
   447                      flag_group(
   448                          flags = ["%{user_compile_flags}"],
   449                          iterate_over = "user_compile_flags",
   450                          expand_if_available = "user_compile_flags",
   451                      ),
   452                  ],
   453              ),
   454          ],
   455      )
   456  
   457      archiver_flags_feature = feature(
   458          name = "archiver_flags",
   459          flag_sets = [
   460              flag_set(
   461                  actions = [ACTION_NAMES.cpp_link_static_library],
   462                  flag_groups = [
   463                      flag_group(
   464                          flags = ["/OUT:%{output_execpath}"],
   465                          expand_if_available = "output_execpath",
   466                      ),
   467                  ],
   468              ),
   469          ],
   470      )
   471  
   472      default_link_flags_feature = feature(
   473          name = "default_link_flags",
   474          enabled = True,
   475          flag_sets = [
   476              flag_set(
   477                  actions = all_link_actions,
   478                  flag_groups = [flag_group(flags = ["/MACHINE:X64"])],
   479              ),
   480          ],
   481      )
   482  
   483      static_link_msvcrt_feature = feature(name = "static_link_msvcrt")
   484  
   485      dynamic_link_msvcrt_debug_feature = feature(
   486          name = "dynamic_link_msvcrt_debug",
   487          flag_sets = [
   488              flag_set(
   489                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   490                  flag_groups = [flag_group(flags = ["/MDd"])],
   491              ),
   492              flag_set(
   493                  actions = all_link_actions,
   494                  flag_groups = [flag_group(flags = ["/DEFAULTLIB:msvcrtd.lib"])],
   495              ),
   496          ],
   497          requires = [feature_set(features = ["dbg"])],
   498      )
   499  
   500      dbg_feature = feature(
   501          name = "dbg",
   502          flag_sets = [
   503              flag_set(
   504                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   505                  flag_groups = [flag_group(flags = ["/Od", "/Z7"])],
   506              ),
   507              flag_set(
   508                  actions = all_link_actions,
   509                  flag_groups = [
   510                      flag_group(
   511                          flags = ["", "/INCREMENTAL:NO"],
   512                      ),
   513                  ],
   514              ),
   515          ],
   516          implies = ["generate_pdb_file"],
   517      )
   518  
   519      opt_feature = feature(
   520          name = "opt",
   521          flag_sets = [
   522              flag_set(
   523                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   524                  flag_groups = [flag_group(flags = ["/O2"])],
   525              ),
   526          ],
   527          implies = ["frame_pointer"],
   528      )
   529  
   530      supports_interface_shared_libraries_feature = feature(
   531          name = "supports_interface_shared_libraries",
   532          enabled = True,
   533      )
   534  
   535      user_link_flags_feature = feature(
   536          name = "user_link_flags",
   537          flag_sets = [
   538              flag_set(
   539                  actions = all_link_actions,
   540                  flag_groups = [
   541                      flag_group(
   542                          flags = ["%{user_link_flags}"],
   543                          iterate_over = "user_link_flags",
   544                          expand_if_available = "user_link_flags",
   545                      ),
   546                  ],
   547              ),
   548          ],
   549      )
   550  
   551      default_compile_flags_feature = feature(
   552          name = "default_compile_flags",
   553          enabled = True,
   554          flag_sets = [
   555              flag_set(
   556                  actions = [
   557                      ACTION_NAMES.assemble,
   558                      ACTION_NAMES.preprocess_assemble,
   559                      ACTION_NAMES.linkstamp_compile,
   560                      ACTION_NAMES.c_compile,
   561                      ACTION_NAMES.cpp_compile,
   562                      ACTION_NAMES.cpp_header_parsing,
   563                      ACTION_NAMES.cpp_module_compile,
   564                      ACTION_NAMES.cpp_module_codegen,
   565                      ACTION_NAMES.lto_backend,
   566                      ACTION_NAMES.clif_match,
   567                  ],
   568                  flag_groups = [
   569                      flag_group(
   570                          flags = [
   571                              "/DCOMPILER_MSVC",
   572                              "/DNOMINMAX",
   573                              "/D_WIN32_WINNT=0x0601",
   574                              "/D_CRT_SECURE_NO_DEPRECATE",
   575                              "/D_CRT_SECURE_NO_WARNINGS",
   576                              "/bigobj",
   577                              "/Zm500",
   578                              "/EHsc",
   579                              "/wd4351",
   580                              "/wd4291",
   581                              "/wd4250",
   582                              "/wd4996",
   583                          ],
   584                      ),
   585                  ],
   586              ),
   587          ],
   588      )
   589  
   590      msvc_compile_env_feature = feature(
   591          name = "msvc_compile_env",
   592          env_sets = [
   593              env_set(
   594                  actions = [
   595                      ACTION_NAMES.c_compile,
   596                      ACTION_NAMES.cpp_compile,
   597                      ACTION_NAMES.cpp_module_compile,
   598                      ACTION_NAMES.cpp_module_codegen,
   599                      ACTION_NAMES.cpp_header_parsing,
   600                      ACTION_NAMES.assemble,
   601                      ACTION_NAMES.preprocess_assemble,
   602                  ],
   603                  env_entries = [env_entry(key = "INCLUDE", value = "")],
   604              ),
   605          ],
   606      )
   607  
   608      preprocessor_defines_feature = feature(
   609          name = "preprocessor_defines",
   610          enabled = True,
   611          flag_sets = [
   612              flag_set(
   613                  actions = [
   614                      ACTION_NAMES.assemble,
   615                      ACTION_NAMES.preprocess_assemble,
   616                      ACTION_NAMES.c_compile,
   617                      ACTION_NAMES.cpp_compile,
   618                      ACTION_NAMES.cpp_header_parsing,
   619                      ACTION_NAMES.cpp_module_compile,
   620                  ],
   621                  flag_groups = [
   622                      flag_group(
   623                          flags = ["/D%{preprocessor_defines}"],
   624                          iterate_over = "preprocessor_defines",
   625                      ),
   626                  ],
   627              ),
   628          ],
   629      )
   630  
   631      generate_pdb_file_feature = feature(
   632          name = "generate_pdb_file",
   633          requires = [
   634              feature_set(features = ["dbg"]),
   635              feature_set(features = ["fastbuild"]),
   636          ],
   637      )
   638  
   639      output_execpath_flags_feature = feature(
   640          name = "output_execpath_flags",
   641          flag_sets = [
   642              flag_set(
   643                  actions = all_link_actions,
   644                  flag_groups = [
   645                      flag_group(
   646                          flags = ["/OUT:%{output_execpath}"],
   647                          expand_if_available = "output_execpath",
   648                      ),
   649                  ],
   650              ),
   651          ],
   652      )
   653  
   654      dynamic_link_msvcrt_no_debug_feature = feature(
   655          name = "dynamic_link_msvcrt_no_debug",
   656          flag_sets = [
   657              flag_set(
   658                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   659                  flag_groups = [flag_group(flags = ["/MD"])],
   660              ),
   661              flag_set(
   662                  actions = all_link_actions,
   663                  flag_groups = [flag_group(flags = ["/DEFAULTLIB:msvcrt.lib"])],
   664              ),
   665          ],
   666          requires = [
   667              feature_set(features = ["fastbuild"]),
   668              feature_set(features = ["opt"]),
   669          ],
   670      )
   671  
   672      disable_assertions_feature = feature(
   673          name = "disable_assertions",
   674          enabled = True,
   675          flag_sets = [
   676              flag_set(
   677                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   678                  flag_groups = [flag_group(flags = ["/DNDEBUG"])],
   679                  with_features = [with_feature_set(features = ["opt"])],
   680              ),
   681          ],
   682      )
   683  
   684      has_configured_linker_path_feature = feature(name = "has_configured_linker_path")
   685  
   686      supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
   687  
   688      no_stripping_feature = feature(name = "no_stripping")
   689  
   690      linker_param_file_feature = feature(
   691          name = "linker_param_file",
   692          flag_sets = [
   693              flag_set(
   694                  actions = all_link_actions +
   695                            [ACTION_NAMES.cpp_link_static_library],
   696                  flag_groups = [
   697                      flag_group(
   698                          flags = ["@%{linker_param_file}"],
   699                          expand_if_available = "linker_param_file",
   700                      ),
   701                  ],
   702              ),
   703          ],
   704      )
   705  
   706      ignore_noisy_warnings_feature = feature(
   707          name = "ignore_noisy_warnings",
   708          enabled = True,
   709          flag_sets = [
   710              flag_set(
   711                  actions = [ACTION_NAMES.cpp_link_static_library],
   712                  flag_groups = [flag_group(flags = ["/ignore:4221"])],
   713              ),
   714          ],
   715      )
   716  
   717      no_legacy_features_feature = feature(name = "no_legacy_features")
   718  
   719      parse_showincludes_feature = feature(
   720          name = "parse_showincludes",
   721          flag_sets = [
   722              flag_set(
   723                  actions = [
   724                      ACTION_NAMES.preprocess_assemble,
   725                      ACTION_NAMES.c_compile,
   726                      ACTION_NAMES.cpp_compile,
   727                      ACTION_NAMES.cpp_module_compile,
   728                      ACTION_NAMES.cpp_header_parsing,
   729                  ],
   730                  flag_groups = [flag_group(flags = ["/showIncludes"])],
   731              ),
   732          ],
   733      )
   734  
   735      static_link_msvcrt_no_debug_feature = feature(
   736          name = "static_link_msvcrt_no_debug",
   737          flag_sets = [
   738              flag_set(
   739                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   740                  flag_groups = [flag_group(flags = ["/MT"])],
   741              ),
   742              flag_set(
   743                  actions = all_link_actions,
   744                  flag_groups = [flag_group(flags = ["/DEFAULTLIB:libcmt.lib"])],
   745              ),
   746          ],
   747          requires = [
   748              feature_set(features = ["fastbuild"]),
   749              feature_set(features = ["opt"]),
   750          ],
   751      )
   752  
   753      treat_warnings_as_errors_feature = feature(
   754          name = "treat_warnings_as_errors",
   755          flag_sets = [
   756              flag_set(
   757                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   758                  flag_groups = [flag_group(flags = ["/WX"])],
   759              ),
   760          ],
   761      )
   762  
   763      windows_export_all_symbols_feature = feature(name = "windows_export_all_symbols")
   764  
   765      no_windows_export_all_symbols_feature = feature(name = "no_windows_export_all_symbols")
   766  
   767      include_paths_feature = feature(
   768          name = "include_paths",
   769          enabled = True,
   770          flag_sets = [
   771              flag_set(
   772                  actions = [
   773                      ACTION_NAMES.assemble,
   774                      ACTION_NAMES.preprocess_assemble,
   775                      ACTION_NAMES.c_compile,
   776                      ACTION_NAMES.cpp_compile,
   777                      ACTION_NAMES.cpp_header_parsing,
   778                      ACTION_NAMES.cpp_module_compile,
   779                  ],
   780                  flag_groups = [
   781                      flag_group(
   782                          flags = ["/I%{quote_include_paths}"],
   783                          iterate_over = "quote_include_paths",
   784                      ),
   785                      flag_group(
   786                          flags = ["/I%{include_paths}"],
   787                          iterate_over = "include_paths",
   788                      ),
   789                      flag_group(
   790                          flags = ["/I%{system_include_paths}"],
   791                          iterate_over = "system_include_paths",
   792                      ),
   793                  ],
   794              ),
   795          ],
   796      )
   797  
   798      linkstamps_feature = feature(
   799          name = "linkstamps",
   800          flag_sets = [
   801              flag_set(
   802                  actions = all_link_actions,
   803                  flag_groups = [
   804                      flag_group(
   805                          flags = ["%{linkstamp_paths}"],
   806                          iterate_over = "linkstamp_paths",
   807                          expand_if_available = "linkstamp_paths",
   808                      ),
   809                  ],
   810              ),
   811          ],
   812      )
   813  
   814      targets_windows_feature = feature(
   815          name = "targets_windows",
   816          enabled = True,
   817          implies = ["copy_dynamic_libraries_to_binary"],
   818      )
   819  
   820      linker_subsystem_flag_feature = feature(
   821          name = "linker_subsystem_flag",
   822          flag_sets = [
   823              flag_set(
   824                  actions = all_link_actions,
   825                  flag_groups = [flag_group(flags = ["/SUBSYSTEM:CONSOLE"])],
   826              ),
   827          ],
   828      )
   829  
   830      static_link_msvcrt_debug_feature = feature(
   831          name = "static_link_msvcrt_debug",
   832          flag_sets = [
   833              flag_set(
   834                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   835                  flag_groups = [flag_group(flags = ["/MTd"])],
   836              ),
   837              flag_set(
   838                  actions = all_link_actions,
   839                  flag_groups = [flag_group(flags = ["/DEFAULTLIB:libcmtd.lib"])],
   840              ),
   841          ],
   842          requires = [feature_set(features = ["dbg"])],
   843      )
   844  
   845      frame_pointer_feature = feature(
   846          name = "frame_pointer",
   847          flag_sets = [
   848              flag_set(
   849                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   850                  flag_groups = [flag_group(flags = ["/Oy-"])],
   851              ),
   852          ],
   853      )
   854  
   855      compiler_output_flags_feature = feature(
   856          name = "compiler_output_flags",
   857          flag_sets = [
   858              flag_set(
   859                  actions = [ACTION_NAMES.assemble],
   860                  flag_groups = [
   861                      flag_group(
   862                          flag_groups = [
   863                              flag_group(
   864                                  flags = ["/Fo%{output_file}", "/Zi"],
   865                                  expand_if_available = "output_file",
   866                                  expand_if_not_available = "output_assembly_file",
   867                              ),
   868                          ],
   869                          expand_if_not_available = "output_preprocess_file",
   870                      ),
   871                  ],
   872              ),
   873              flag_set(
   874                  actions = [
   875                      ACTION_NAMES.preprocess_assemble,
   876                      ACTION_NAMES.c_compile,
   877                      ACTION_NAMES.cpp_compile,
   878                      ACTION_NAMES.cpp_header_parsing,
   879                      ACTION_NAMES.cpp_module_compile,
   880                      ACTION_NAMES.cpp_module_codegen,
   881                  ],
   882                  flag_groups = [
   883                      flag_group(
   884                          flag_groups = [
   885                              flag_group(
   886                                  flags = ["/Fo%{output_file}"],
   887                                  expand_if_not_available = "output_preprocess_file",
   888                              ),
   889                          ],
   890                          expand_if_available = "output_file",
   891                          expand_if_not_available = "output_assembly_file",
   892                      ),
   893                      flag_group(
   894                          flag_groups = [
   895                              flag_group(
   896                                  flags = ["/Fa%{output_file}"],
   897                                  expand_if_available = "output_assembly_file",
   898                              ),
   899                          ],
   900                          expand_if_available = "output_file",
   901                      ),
   902                      flag_group(
   903                          flag_groups = [
   904                              flag_group(
   905                                  flags = ["/P", "/Fi%{output_file}"],
   906                                  expand_if_available = "output_preprocess_file",
   907                              ),
   908                          ],
   909                          expand_if_available = "output_file",
   910                      ),
   911                  ],
   912              ),
   913          ],
   914      )
   915  
   916      nologo_feature = feature(
   917          name = "nologo",
   918          flag_sets = [
   919              flag_set(
   920                  actions = [
   921                      ACTION_NAMES.c_compile,
   922                      ACTION_NAMES.cpp_compile,
   923                      ACTION_NAMES.cpp_module_compile,
   924                      ACTION_NAMES.cpp_module_codegen,
   925                      ACTION_NAMES.cpp_header_parsing,
   926                      ACTION_NAMES.assemble,
   927                      ACTION_NAMES.preprocess_assemble,
   928                      ACTION_NAMES.cpp_link_executable,
   929                      ACTION_NAMES.cpp_link_dynamic_library,
   930                      ACTION_NAMES.cpp_link_nodeps_dynamic_library,
   931                      ACTION_NAMES.cpp_link_static_library,
   932                  ],
   933                  flag_groups = [flag_group(flags = ["/nologo"])],
   934              ),
   935          ],
   936      )
   937  
   938      smaller_binary_feature = feature(
   939          name = "smaller_binary",
   940          enabled = True,
   941          flag_sets = [
   942              flag_set(
   943                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
   944                  flag_groups = [flag_group(flags = ["/Gy", "/Gw"])],
   945                  with_features = [with_feature_set(features = ["opt"])],
   946              ),
   947              flag_set(
   948                  actions = all_link_actions,
   949                  flag_groups = [flag_group(flags = ["/OPT:ICF", "/OPT:REF"])],
   950                  with_features = [with_feature_set(features = ["opt"])],
   951              ),
   952          ],
   953      )
   954  
   955      compiler_input_flags_feature = feature(
   956          name = "compiler_input_flags",
   957          flag_sets = [
   958              flag_set(
   959                  actions = [
   960                      ACTION_NAMES.assemble,
   961                      ACTION_NAMES.preprocess_assemble,
   962                      ACTION_NAMES.c_compile,
   963                      ACTION_NAMES.cpp_compile,
   964                      ACTION_NAMES.cpp_header_parsing,
   965                      ACTION_NAMES.cpp_module_compile,
   966                      ACTION_NAMES.cpp_module_codegen,
   967                  ],
   968                  flag_groups = [
   969                      flag_group(
   970                          flags = ["/c", "%{source_file}"],
   971                          expand_if_available = "source_file",
   972                      ),
   973                  ],
   974              ),
   975          ],
   976      )
   977  
   978      def_file_feature = feature(
   979          name = "def_file",
   980          flag_sets = [
   981              flag_set(
   982                  actions = all_link_actions,
   983                  flag_groups = [
   984                      flag_group(
   985                          flags = ["/DEF:%{def_file_path}", "/ignore:4070"],
   986                          expand_if_available = "def_file_path",
   987                      ),
   988                  ],
   989              ),
   990          ],
   991      )
   992  
   993      msvc_env_feature = feature(
   994          name = "msvc_env",
   995          env_sets = [
   996              env_set(
   997                  actions = [
   998                      ACTION_NAMES.c_compile,
   999                      ACTION_NAMES.cpp_compile,
  1000                      ACTION_NAMES.cpp_module_compile,
  1001                      ACTION_NAMES.cpp_module_codegen,
  1002                      ACTION_NAMES.cpp_header_parsing,
  1003                      ACTION_NAMES.assemble,
  1004                      ACTION_NAMES.preprocess_assemble,
  1005                      ACTION_NAMES.cpp_link_executable,
  1006                      ACTION_NAMES.cpp_link_dynamic_library,
  1007                      ACTION_NAMES.cpp_link_nodeps_dynamic_library,
  1008                      ACTION_NAMES.cpp_link_static_library,
  1009                  ],
  1010                  env_entries = [
  1011                      env_entry(key = "PATH", value = ""),
  1012                      env_entry(key = "TMP", value = ""),
  1013                      env_entry(key = "TEMP", value = ""),
  1014                  ],
  1015              ),
  1016          ],
  1017          implies = ["msvc_compile_env", "msvc_link_env"],
  1018      )
  1019  
  1020      features = [
  1021          no_legacy_features_feature,
  1022          nologo_feature,
  1023          has_configured_linker_path_feature,
  1024          no_stripping_feature,
  1025          targets_windows_feature,
  1026          copy_dynamic_libraries_to_binary_feature,
  1027          default_compile_flags_feature,
  1028          msvc_env_feature,
  1029          msvc_compile_env_feature,
  1030          msvc_link_env_feature,
  1031          include_paths_feature,
  1032          preprocessor_defines_feature,
  1033          parse_showincludes_feature,
  1034          generate_pdb_file_feature,
  1035          shared_flag_feature,
  1036          linkstamps_feature,
  1037          output_execpath_flags_feature,
  1038          archiver_flags_feature,
  1039          input_param_flags_feature,
  1040          linker_subsystem_flag_feature,
  1041          user_link_flags_feature,
  1042          default_link_flags_feature,
  1043          linker_param_file_feature,
  1044          static_link_msvcrt_feature,
  1045          static_link_msvcrt_no_debug_feature,
  1046          dynamic_link_msvcrt_no_debug_feature,
  1047          static_link_msvcrt_debug_feature,
  1048          dynamic_link_msvcrt_debug_feature,
  1049          dbg_feature,
  1050          fastbuild_feature,
  1051          opt_feature,
  1052          frame_pointer_feature,
  1053          disable_assertions_feature,
  1054          determinism_feature,
  1055          treat_warnings_as_errors_feature,
  1056          smaller_binary_feature,
  1057          ignore_noisy_warnings_feature,
  1058          user_compile_flags_feature,
  1059          sysroot_feature,
  1060          unfiltered_compile_flags_feature,
  1061          compiler_output_flags_feature,
  1062          compiler_input_flags_feature,
  1063          def_file_feature,
  1064          windows_export_all_symbols_feature,
  1065          no_windows_export_all_symbols_feature,
  1066          supports_dynamic_linker_feature,
  1067          supports_interface_shared_libraries_feature,
  1068      ]
  1069  
  1070      artifact_name_patterns = [
  1071          artifact_name_pattern(
  1072              category_name = "object_file",
  1073              prefix = "",
  1074              extension = ".obj",
  1075          ),
  1076          artifact_name_pattern(
  1077              category_name = "static_library",
  1078              prefix = "",
  1079              extension = ".lib",
  1080          ),
  1081          artifact_name_pattern(
  1082              category_name = "alwayslink_static_library",
  1083              prefix = "",
  1084              extension = ".lo.lib",
  1085          ),
  1086          artifact_name_pattern(
  1087              category_name = "executable",
  1088              prefix = "",
  1089              extension = ".exe",
  1090          ),
  1091          artifact_name_pattern(
  1092              category_name = "dynamic_library",
  1093              prefix = "",
  1094              extension = ".dll",
  1095          ),
  1096          artifact_name_pattern(
  1097              category_name = "interface_library",
  1098              prefix = "",
  1099              extension = ".if.lib",
  1100          ),
  1101      ]
  1102  
  1103      make_variables = []
  1104  
  1105      tool_paths = [
  1106          tool_path(name = "ar", path = ""),
  1107          tool_path(name = "ml", path = ""),
  1108          tool_path(name = "cpp", path = ""),
  1109          tool_path(name = "gcc", path = ""),
  1110          tool_path(name = "gcov", path = "wrapper/bin/msvc_nop.bat"),
  1111          tool_path(name = "ld", path = ""),
  1112          tool_path(name = "nm", path = "wrapper/bin/msvc_nop.bat"),
  1113          tool_path(
  1114              name = "objcopy",
  1115              path = "wrapper/bin/msvc_nop.bat",
  1116          ),
  1117          tool_path(
  1118              name = "objdump",
  1119              path = "wrapper/bin/msvc_nop.bat",
  1120          ),
  1121          tool_path(
  1122              name = "strip",
  1123              path = "wrapper/bin/msvc_nop.bat",
  1124          ),
  1125      ]
  1126  
  1127      return cc_common.create_cc_toolchain_config_info(
  1128          ctx = ctx,
  1129          features = features,
  1130          action_configs = action_configs,
  1131          artifact_name_patterns = artifact_name_patterns,
  1132          cxx_builtin_include_directories = cxx_builtin_include_directories,
  1133          toolchain_identifier = toolchain_identifier,
  1134          host_system_name = host_system_name,
  1135          target_system_name = target_system_name,
  1136          target_cpu = target_cpu,
  1137          target_libc = target_libc,
  1138          compiler = compiler,
  1139          abi_version = abi_version,
  1140          abi_libc_version = abi_libc_version,
  1141          tool_paths = tool_paths,
  1142          make_variables = make_variables,
  1143          builtin_sysroot = builtin_sysroot,
  1144          cc_target_os = None,
  1145      )
  1146  
  1147  def _windows_msys_mingw_impl(ctx):
  1148      toolchain_identifier = "msys_x64_mingw"
  1149      host_system_name = "local"
  1150      target_system_name = "local"
  1151      target_cpu = "x64_windows"
  1152      target_libc = "mingw"
  1153      compiler = "mingw-gcc"
  1154      abi_version = "local"
  1155      abi_libc_version = "local"
  1156      cc_target_os = None
  1157      builtin_sysroot = None
  1158      action_configs = []
  1159  
  1160      targets_windows_feature = feature(
  1161          name = "targets_windows",
  1162          implies = ["copy_dynamic_libraries_to_binary"],
  1163          enabled = True,
  1164      )
  1165  
  1166      copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary")
  1167  
  1168      gcc_env_feature = feature(
  1169          name = "gcc_env",
  1170          enabled = True,
  1171          env_sets = [
  1172              env_set(
  1173                  actions = [
  1174                      ACTION_NAMES.c_compile,
  1175                      ACTION_NAMES.cpp_compile,
  1176                      ACTION_NAMES.cpp_module_compile,
  1177                      ACTION_NAMES.cpp_module_codegen,
  1178                      ACTION_NAMES.cpp_header_parsing,
  1179                      ACTION_NAMES.assemble,
  1180                      ACTION_NAMES.preprocess_assemble,
  1181                      ACTION_NAMES.cpp_link_executable,
  1182                      ACTION_NAMES.cpp_link_dynamic_library,
  1183                      ACTION_NAMES.cpp_link_nodeps_dynamic_library,
  1184                      ACTION_NAMES.cpp_link_static_library,
  1185                  ],
  1186                  env_entries = [
  1187                      env_entry(key = "PATH", value = "NOT_USED"),
  1188                  ],
  1189              ),
  1190          ],
  1191      )
  1192  
  1193      msys_mingw_flags = [
  1194      ]
  1195      msys_mingw_link_flags = [
  1196      ]
  1197  
  1198      default_compile_flags_feature = feature(
  1199          name = "default_compile_flags",
  1200          enabled = True,
  1201          flag_sets = [
  1202              flag_set(
  1203                  actions = [
  1204                      ACTION_NAMES.assemble,
  1205                      ACTION_NAMES.preprocess_assemble,
  1206                      ACTION_NAMES.linkstamp_compile,
  1207                      ACTION_NAMES.c_compile,
  1208                      ACTION_NAMES.cpp_compile,
  1209                      ACTION_NAMES.cpp_header_parsing,
  1210                      ACTION_NAMES.cpp_module_compile,
  1211                      ACTION_NAMES.cpp_module_codegen,
  1212                      ACTION_NAMES.lto_backend,
  1213                      ACTION_NAMES.clif_match,
  1214                  ],
  1215              ),
  1216              flag_set(
  1217                  actions = [
  1218                      ACTION_NAMES.linkstamp_compile,
  1219                      ACTION_NAMES.cpp_compile,
  1220                      ACTION_NAMES.cpp_header_parsing,
  1221                      ACTION_NAMES.cpp_module_compile,
  1222                      ACTION_NAMES.cpp_module_codegen,
  1223                      ACTION_NAMES.lto_backend,
  1224                      ACTION_NAMES.clif_match,
  1225                  ],
  1226                  flag_groups = ([flag_group(flags = msys_mingw_flags)] if msys_mingw_flags else []),
  1227              ),
  1228          ],
  1229      )
  1230  
  1231      default_link_flags_feature = feature(
  1232          name = "default_link_flags",
  1233          enabled = True,
  1234          flag_sets = [
  1235              flag_set(
  1236                  actions = all_link_actions,
  1237                  flag_groups = ([flag_group(flags = msys_mingw_link_flags)] if msys_mingw_link_flags else []),
  1238              ),
  1239          ],
  1240      )
  1241  
  1242      supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
  1243  
  1244      features = [
  1245          targets_windows_feature,
  1246          copy_dynamic_libraries_to_binary_feature,
  1247          gcc_env_feature,
  1248          default_compile_flags_feature,
  1249          default_link_flags_feature,
  1250          supports_dynamic_linker_feature,
  1251      ]
  1252  
  1253      cxx_builtin_include_directories = [
  1254      ]
  1255  
  1256      artifact_name_patterns = [
  1257          artifact_name_pattern(
  1258              category_name = "executable",
  1259              prefix = "",
  1260              extension = ".exe",
  1261          ),
  1262      ]
  1263  
  1264      make_variables = []
  1265      tool_paths = [
  1266      ]
  1267  
  1268      return cc_common.create_cc_toolchain_config_info(
  1269          ctx = ctx,
  1270          features = features,
  1271          action_configs = action_configs,
  1272          artifact_name_patterns = artifact_name_patterns,
  1273          cxx_builtin_include_directories = cxx_builtin_include_directories,
  1274          toolchain_identifier = toolchain_identifier,
  1275          host_system_name = host_system_name,
  1276          target_system_name = target_system_name,
  1277          target_cpu = target_cpu,
  1278          target_libc = target_libc,
  1279          compiler = compiler,
  1280          abi_version = abi_version,
  1281          abi_libc_version = abi_libc_version,
  1282          tool_paths = tool_paths,
  1283          make_variables = make_variables,
  1284          builtin_sysroot = builtin_sysroot,
  1285          cc_target_os = cc_target_os,
  1286      )
  1287  
  1288  def _armeabi_impl(ctx):
  1289      toolchain_identifier = "stub_armeabi-v7a"
  1290      host_system_name = "armeabi-v7a"
  1291      target_system_name = "armeabi-v7a"
  1292      target_cpu = "armeabi-v7a"
  1293      target_libc = "armeabi-v7a"
  1294      compiler = "compiler"
  1295      abi_version = "armeabi-v7a"
  1296      abi_libc_version = "armeabi-v7a"
  1297      cc_target_os = None
  1298      builtin_sysroot = None
  1299      action_configs = []
  1300  
  1301      supports_pic_feature = feature(name = "supports_pic", enabled = True)
  1302      supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
  1303      features = [supports_dynamic_linker_feature, supports_pic_feature]
  1304  
  1305      cxx_builtin_include_directories = []
  1306      artifact_name_patterns = []
  1307      make_variables = []
  1308  
  1309      tool_paths = [
  1310          tool_path(name = "ar", path = "/bin/false"),
  1311          tool_path(name = "compat-ld", path = "/bin/false"),
  1312          tool_path(name = "cpp", path = "/bin/false"),
  1313          tool_path(name = "dwp", path = "/bin/false"),
  1314          tool_path(name = "gcc", path = "/bin/false"),
  1315          tool_path(name = "gcov", path = "/bin/false"),
  1316          tool_path(name = "ld", path = "/bin/false"),
  1317          tool_path(name = "nm", path = "/bin/false"),
  1318          tool_path(name = "objcopy", path = "/bin/false"),
  1319          tool_path(name = "objdump", path = "/bin/false"),
  1320          tool_path(name = "strip", path = "/bin/false"),
  1321      ]
  1322  
  1323      return cc_common.create_cc_toolchain_config_info(
  1324          ctx = ctx,
  1325          features = features,
  1326          action_configs = action_configs,
  1327          artifact_name_patterns = artifact_name_patterns,
  1328          cxx_builtin_include_directories = cxx_builtin_include_directories,
  1329          toolchain_identifier = toolchain_identifier,
  1330          host_system_name = host_system_name,
  1331          target_system_name = target_system_name,
  1332          target_cpu = target_cpu,
  1333          target_libc = target_libc,
  1334          compiler = compiler,
  1335          abi_version = abi_version,
  1336          abi_libc_version = abi_libc_version,
  1337          tool_paths = tool_paths,
  1338          make_variables = make_variables,
  1339          builtin_sysroot = builtin_sysroot,
  1340          cc_target_os = cc_target_os,
  1341      )
  1342  
  1343  def _impl(ctx):
  1344      if ctx.attr.cpu == "armeabi-v7a":
  1345          return _armeabi_impl(ctx)
  1346      elif ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "msvc-cl":
  1347          return _windows_msvc_impl(ctx)
  1348      elif ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "mingw-gcc":
  1349          return _windows_msys_mingw_impl(ctx)
  1350  
  1351      tool_paths = [
  1352          tool_path(name = "ar", path = "/opt/rh/devtoolset-7/root/usr/bin/ar"),
  1353          tool_path(name = "ld", path = "/opt/rh/devtoolset-7/root/usr/bin/ld"),
  1354          tool_path(name = "cpp", path = "/opt/rh/devtoolset-7/root/usr/bin/cpp"),
  1355          tool_path(name = "gcc", path = "/opt/rh/devtoolset-7/root/usr/bin/gcc"),
  1356          tool_path(name = "dwp", path = "/opt/rh/devtoolset-7/root/usr/bin/dwp"),
  1357          tool_path(name = "gcov", path = "/opt/rh/devtoolset-7/root/usr/bin/gcov"),
  1358          tool_path(name = "nm", path = "/opt/rh/devtoolset-7/root/usr/bin/nm"),
  1359          tool_path(name = "objcopy", path = "/opt/rh/devtoolset-7/root/usr/bin/objcopy"),
  1360          tool_path(name = "objdump", path = "/opt/rh/devtoolset-7/root/usr/bin/objdump"),
  1361          tool_path(name = "strip", path = "/opt/rh/devtoolset-7/root/usr/bin/strip"),
  1362      ]
  1363  
  1364      cxx_builtin_include_directories = [
  1365          "/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include",
  1366          "/usr/local/include",
  1367          "/opt/rh/devtoolset-7/root/usr/include",
  1368          "/usr/include",
  1369          "/opt/rh/devtoolset-7/root/usr/include/c++/7",
  1370          "/opt/rh/devtoolset-7/root/usr/include/c++/7/x86_64-redhat-linux",
  1371          "/opt/rh/devtoolset-7/root/usr/include/c++/7/backward",
  1372      ]
  1373  
  1374      action_configs = []
  1375  
  1376      compile_flags = [
  1377          "-U_FORTIFY_SOURCE",
  1378          "-fstack-protector",
  1379          "-Wall",
  1380          "-Wunused-but-set-parameter",
  1381          "-Wno-free-nonheap-object",
  1382          "-fno-omit-frame-pointer",
  1383      ]
  1384  
  1385      dbg_compile_flags = [
  1386          "-g",
  1387      ]
  1388  
  1389      opt_compile_flags = [
  1390          "-g0",
  1391          "-O2",
  1392          "-D_FORTIFY_SOURCE=1",
  1393          "-DNDEBUG",
  1394          "-ffunction-sections",
  1395          "-fdata-sections",
  1396      ]
  1397  
  1398      cxx_flags = [
  1399          "-std=c++0x",
  1400      ]
  1401  
  1402      link_flags = [
  1403          "-fuse-ld=gold",
  1404          "-Wl,-no-as-needed",
  1405          "-Wl,-z,relro,-z,now",
  1406          "-B/opt/rh/devtoolset-7/root/usr/bin",
  1407          "-pass-exit-codes",
  1408          "-lstdc++",
  1409          "-lm",
  1410      ]
  1411  
  1412      opt_link_flags = [
  1413          "-Wl,--gc-sections",
  1414      ]
  1415  
  1416      unfiltered_compile_flags = [
  1417          "-fno-canonical-system-headers",
  1418          "-Wno-builtin-macro-redefined",
  1419          "-D__DATE__=\"redacted\"",
  1420          "-D__TIMESTAMP__=\"redacted\"",
  1421          "-D__TIME__=\"redacted\"",
  1422      ]
  1423  
  1424      targets_windows_feature = feature(
  1425          name = "targets_windows",
  1426          implies = ["copy_dynamic_libraries_to_binary"],
  1427          enabled = True,
  1428      )
  1429  
  1430      copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary")
  1431  
  1432      gcc_env_feature = feature(
  1433          name = "gcc_env",
  1434          enabled = True,
  1435          env_sets = [
  1436              env_set(
  1437                  actions = [
  1438                      ACTION_NAMES.c_compile,
  1439                      ACTION_NAMES.cpp_compile,
  1440                      ACTION_NAMES.cpp_module_compile,
  1441                      ACTION_NAMES.cpp_module_codegen,
  1442                      ACTION_NAMES.cpp_header_parsing,
  1443                      ACTION_NAMES.assemble,
  1444                      ACTION_NAMES.preprocess_assemble,
  1445                      ACTION_NAMES.cpp_link_executable,
  1446                      ACTION_NAMES.cpp_link_dynamic_library,
  1447                      ACTION_NAMES.cpp_link_nodeps_dynamic_library,
  1448                      ACTION_NAMES.cpp_link_static_library,
  1449                  ],
  1450                  env_entries = [
  1451                      env_entry(key = "PATH", value = "NOT_USED"),
  1452                  ],
  1453              ),
  1454          ],
  1455      )
  1456  
  1457      windows_features = [
  1458          targets_windows_feature,
  1459          copy_dynamic_libraries_to_binary_feature,
  1460          gcc_env_feature,
  1461      ]
  1462  
  1463      coverage_feature = feature(
  1464          name = "coverage",
  1465          provides = ["profile"],
  1466          flag_sets = [
  1467              flag_set(
  1468                  actions = [
  1469                      ACTION_NAMES.preprocess_assemble,
  1470                      ACTION_NAMES.c_compile,
  1471                      ACTION_NAMES.cpp_compile,
  1472                      ACTION_NAMES.cpp_header_parsing,
  1473                      ACTION_NAMES.cpp_module_compile,
  1474                  ],
  1475                  flag_groups = [
  1476                      flag_group(flags = ["--coverage"]),
  1477                  ],
  1478              ),
  1479              flag_set(
  1480                  actions = [
  1481                      ACTION_NAMES.cpp_link_dynamic_library,
  1482                      ACTION_NAMES.cpp_link_nodeps_dynamic_library,
  1483                      ACTION_NAMES.cpp_link_executable,
  1484                  ],
  1485                  flag_groups = [
  1486                      flag_group(flags = ["--coverage"]),
  1487                  ],
  1488              ),
  1489          ],
  1490      )
  1491  
  1492      supports_pic_feature = feature(
  1493          name = "supports_pic",
  1494          enabled = True,
  1495      )
  1496      supports_start_end_lib_feature = feature(
  1497          name = "supports_start_end_lib",
  1498          enabled = True,
  1499      )
  1500  
  1501      default_compile_flags_feature = feature(
  1502          name = "default_compile_flags",
  1503          enabled = True,
  1504          flag_sets = [
  1505              flag_set(
  1506                  actions = [
  1507                      ACTION_NAMES.assemble,
  1508                      ACTION_NAMES.preprocess_assemble,
  1509                      ACTION_NAMES.linkstamp_compile,
  1510                      ACTION_NAMES.c_compile,
  1511                      ACTION_NAMES.cpp_compile,
  1512                      ACTION_NAMES.cpp_header_parsing,
  1513                      ACTION_NAMES.cpp_module_compile,
  1514                      ACTION_NAMES.cpp_module_codegen,
  1515                      ACTION_NAMES.lto_backend,
  1516                      ACTION_NAMES.clif_match,
  1517                  ],
  1518                  flag_groups = ([flag_group(flags = compile_flags)] if compile_flags else []),
  1519              ),
  1520              flag_set(
  1521                  actions = [
  1522                      ACTION_NAMES.assemble,
  1523                      ACTION_NAMES.preprocess_assemble,
  1524                      ACTION_NAMES.linkstamp_compile,
  1525                      ACTION_NAMES.c_compile,
  1526                      ACTION_NAMES.cpp_compile,
  1527                      ACTION_NAMES.cpp_header_parsing,
  1528                      ACTION_NAMES.cpp_module_compile,
  1529                      ACTION_NAMES.cpp_module_codegen,
  1530                      ACTION_NAMES.lto_backend,
  1531                      ACTION_NAMES.clif_match,
  1532                  ],
  1533                  flag_groups = ([flag_group(flags = dbg_compile_flags)] if dbg_compile_flags else []),
  1534                  with_features = [with_feature_set(features = ["dbg"])],
  1535              ),
  1536              flag_set(
  1537                  actions = [
  1538                      ACTION_NAMES.assemble,
  1539                      ACTION_NAMES.preprocess_assemble,
  1540                      ACTION_NAMES.linkstamp_compile,
  1541                      ACTION_NAMES.c_compile,
  1542                      ACTION_NAMES.cpp_compile,
  1543                      ACTION_NAMES.cpp_header_parsing,
  1544                      ACTION_NAMES.cpp_module_compile,
  1545                      ACTION_NAMES.cpp_module_codegen,
  1546                      ACTION_NAMES.lto_backend,
  1547                      ACTION_NAMES.clif_match,
  1548                  ],
  1549                  flag_groups = ([flag_group(flags = opt_compile_flags)] if opt_compile_flags else []),
  1550                  with_features = [with_feature_set(features = ["opt"])],
  1551              ),
  1552              flag_set(
  1553                  actions = [
  1554                      ACTION_NAMES.linkstamp_compile,
  1555                      ACTION_NAMES.cpp_compile,
  1556                      ACTION_NAMES.cpp_header_parsing,
  1557                      ACTION_NAMES.cpp_module_compile,
  1558                      ACTION_NAMES.cpp_module_codegen,
  1559                      ACTION_NAMES.lto_backend,
  1560                      ACTION_NAMES.clif_match,
  1561                  ],
  1562                  flag_groups = ([flag_group(flags = cxx_flags)] if cxx_flags else []),
  1563              ),
  1564          ],
  1565      )
  1566  
  1567      default_link_flags_feature = feature(
  1568          name = "default_link_flags",
  1569          enabled = True,
  1570          flag_sets = [
  1571              flag_set(
  1572                  actions = all_link_actions,
  1573                  flag_groups = ([flag_group(flags = link_flags)] if link_flags else []),
  1574              ),
  1575              flag_set(
  1576                  actions = all_link_actions,
  1577                  flag_groups = ([flag_group(flags = opt_link_flags)] if opt_link_flags else []),
  1578                  with_features = [with_feature_set(features = ["opt"])],
  1579              ),
  1580          ],
  1581      )
  1582  
  1583      dbg_feature = feature(name = "dbg")
  1584  
  1585      opt_feature = feature(name = "opt")
  1586  
  1587      sysroot_feature = feature(
  1588          name = "sysroot",
  1589          enabled = True,
  1590          flag_sets = [
  1591              flag_set(
  1592                  actions = [
  1593                      ACTION_NAMES.preprocess_assemble,
  1594                      ACTION_NAMES.linkstamp_compile,
  1595                      ACTION_NAMES.c_compile,
  1596                      ACTION_NAMES.cpp_compile,
  1597                      ACTION_NAMES.cpp_header_parsing,
  1598                      ACTION_NAMES.cpp_module_compile,
  1599                      ACTION_NAMES.cpp_module_codegen,
  1600                      ACTION_NAMES.lto_backend,
  1601                      ACTION_NAMES.clif_match,
  1602                      ACTION_NAMES.cpp_link_executable,
  1603                      ACTION_NAMES.cpp_link_dynamic_library,
  1604                      ACTION_NAMES.cpp_link_nodeps_dynamic_library,
  1605                  ],
  1606                  flag_groups = [
  1607                      flag_group(
  1608                          flags = ["--sysroot=%{sysroot}"],
  1609                          expand_if_available = "sysroot",
  1610                      ),
  1611                  ],
  1612              ),
  1613          ],
  1614      )
  1615  
  1616      fdo_optimize_feature = feature(
  1617          name = "fdo_optimize",
  1618          flag_sets = [
  1619              flag_set(
  1620                  actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile],
  1621                  flag_groups = [
  1622                      flag_group(
  1623                          flags = [
  1624                              "-fprofile-use=%{fdo_profile_path}",
  1625                              "-fprofile-correction",
  1626                          ],
  1627                          expand_if_available = "fdo_profile_path",
  1628                      ),
  1629                  ],
  1630              ),
  1631          ],
  1632          provides = ["profile"],
  1633      )
  1634  
  1635      supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
  1636  
  1637      user_compile_flags_feature = feature(
  1638          name = "user_compile_flags",
  1639          enabled = True,
  1640          flag_sets = [
  1641              flag_set(
  1642                  actions = [
  1643                      ACTION_NAMES.assemble,
  1644                      ACTION_NAMES.preprocess_assemble,
  1645                      ACTION_NAMES.linkstamp_compile,
  1646                      ACTION_NAMES.c_compile,
  1647                      ACTION_NAMES.cpp_compile,
  1648                      ACTION_NAMES.cpp_header_parsing,
  1649                      ACTION_NAMES.cpp_module_compile,
  1650                      ACTION_NAMES.cpp_module_codegen,
  1651                      ACTION_NAMES.lto_backend,
  1652                      ACTION_NAMES.clif_match,
  1653                  ],
  1654                  flag_groups = [
  1655                      flag_group(
  1656                          flags = ["%{user_compile_flags}"],
  1657                          iterate_over = "user_compile_flags",
  1658                          expand_if_available = "user_compile_flags",
  1659                      ),
  1660                  ],
  1661              ),
  1662          ],
  1663      )
  1664  
  1665      unfiltered_compile_flags_feature = feature(
  1666          name = "unfiltered_compile_flags",
  1667          enabled = True,
  1668          flag_sets = [
  1669              flag_set(
  1670                  actions = [
  1671                      ACTION_NAMES.assemble,
  1672                      ACTION_NAMES.preprocess_assemble,
  1673                      ACTION_NAMES.linkstamp_compile,
  1674                      ACTION_NAMES.c_compile,
  1675                      ACTION_NAMES.cpp_compile,
  1676                      ACTION_NAMES.cpp_header_parsing,
  1677                      ACTION_NAMES.cpp_module_compile,
  1678                      ACTION_NAMES.cpp_module_codegen,
  1679                      ACTION_NAMES.lto_backend,
  1680                      ACTION_NAMES.clif_match,
  1681                  ],
  1682                  flag_groups = ([flag_group(flags = unfiltered_compile_flags)] if unfiltered_compile_flags else []),
  1683              ),
  1684          ],
  1685      )
  1686  
  1687      features = [
  1688          supports_pic_feature,
  1689          supports_start_end_lib_feature,
  1690          coverage_feature,
  1691          default_compile_flags_feature,
  1692          default_link_flags_feature,
  1693          fdo_optimize_feature,
  1694          supports_dynamic_linker_feature,
  1695          dbg_feature,
  1696          opt_feature,
  1697          user_compile_flags_feature,
  1698          sysroot_feature,
  1699          unfiltered_compile_flags_feature,
  1700      ]
  1701  
  1702      artifact_name_patterns = [
  1703      ]
  1704  
  1705      make_variables = []
  1706  
  1707      return cc_common.create_cc_toolchain_config_info(
  1708          ctx = ctx,
  1709          features = features,
  1710          action_configs = action_configs,
  1711          artifact_name_patterns = artifact_name_patterns,
  1712          cxx_builtin_include_directories = cxx_builtin_include_directories,
  1713          toolchain_identifier = "linux_gnu_x86",
  1714          host_system_name = "i686-unknown-linux-gnu",
  1715          target_system_name = "x86_64-unknown-linux-gnu",
  1716          target_cpu = "k8",
  1717          target_libc = "glibc_2.19",
  1718          compiler = "gcc",
  1719          abi_version = "gcc",
  1720          abi_libc_version = "glibc_2.19",
  1721          tool_paths = tool_paths,
  1722          make_variables = make_variables,
  1723          builtin_sysroot = "",
  1724          cc_target_os = None,
  1725      )
  1726  
  1727  cc_toolchain_config = rule(
  1728      implementation = _impl,
  1729      attrs = {
  1730          "cpu": attr.string(mandatory = True),
  1731          "compiler": attr.string(),
  1732      },
  1733      provides = [CcToolchainConfigInfo],
  1734  )