github.com/distbuild/reclient@v0.0.0-20240401075343-3de72e395564/configs/linux/cc/BUILD (about)

     1  # Copyright 2016 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  # This becomes the BUILD file for @local_config_cc// under non-BSD unixes.
    16  
    17  load(":cc_toolchain_config.bzl", "cc_toolchain_config")
    18  load(":armeabi_cc_toolchain_config.bzl", "armeabi_cc_toolchain_config")
    19  load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite")
    20  
    21  package(default_visibility = ["//visibility:public"])
    22  
    23  licenses(["notice"])  # Apache 2.0
    24  
    25  cc_library(
    26      name = "malloc",
    27  )
    28  
    29  filegroup(
    30      name = "empty",
    31      srcs = [],
    32  )
    33  
    34  filegroup(
    35      name = "cc_wrapper",
    36      srcs = ["cc_wrapper.sh"],
    37  )
    38  
    39  filegroup(
    40      name = "compiler_deps",
    41      srcs = glob(
    42          ["extra_tools/**"],
    43          allow_empty = True,
    44      ) + [":builtin_include_directory_paths"],
    45  )
    46  
    47  # This is the entry point for --crosstool_top.  Toolchains are found
    48  # by lopping off the name of --crosstool_top and searching for
    49  # the "${CPU}" entry in the toolchains attribute.
    50  cc_toolchain_suite(
    51      name = "toolchain",
    52      tags = ["manual"],
    53      toolchains = {
    54          "k8|clang": ":cc-compiler-k8",
    55          "k8": ":cc-compiler-k8",
    56          "armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a",
    57          "armeabi-v7a": ":cc-compiler-armeabi-v7a",
    58      },
    59  )
    60  
    61  cc_toolchain(
    62      name = "cc-compiler-k8",
    63      all_files = ":compiler_deps",
    64      ar_files = ":compiler_deps",
    65      as_files = ":compiler_deps",
    66      compiler_files = ":compiler_deps",
    67      dwp_files = ":empty",
    68      linker_files = ":compiler_deps",
    69      module_map = ":module.modulemap",
    70      objcopy_files = ":empty",
    71      strip_files = ":empty",
    72      supports_param_files = 1,
    73      toolchain_config = ":linux_gnu_x86",
    74      toolchain_identifier = "linux_gnu_x86",
    75  )
    76  
    77  cc_toolchain_config(
    78      name = "linux_gnu_x86",
    79      abi_libc_version = "glibc_2.19",
    80      abi_version = "clang",
    81      compile_flags = [
    82          "-fstack-protector",
    83          "-Wall",
    84          "-Wthread-safety",
    85          "-Wself-assign",
    86          "-fcolor-diagnostics",
    87          "-fno-omit-frame-pointer",
    88      ],
    89      compiler = "clang",
    90      coverage_compile_flags = ["--coverage"],
    91      coverage_link_flags = ["--coverage"],
    92      cpu = "k8",
    93      cxx_builtin_include_directories = [
    94          "/usr/local/include",
    95          "/usr/local/lib/clang/12.0.0/include",
    96          "/usr/include/x86_64-linux-gnu",
    97          "/usr/include",
    98          "/usr/local/lib/clang/12.0.0/share",
    99          "/usr/include/c++/7.5.0",
   100          "/usr/include/x86_64-linux-gnu/c++/7.5.0",
   101          "/usr/include/c++/7.5.0/backward",
   102          "/usr/local/include/c++/v1",
   103      ],
   104      cxx_flags = ["-std=c++0x"],
   105      dbg_compile_flags = ["-g"],
   106      host_system_name = "i686-unknown-linux-gnu",
   107      link_flags = [
   108          "-Wl,-no-as-needed",
   109          "-Wl,-z,relro,-z,now",
   110          "-B/usr/local/bin",
   111          "-B/usr/bin",
   112      ],
   113      link_libs = [
   114          "-lstdc++",
   115          "-lm",
   116      ],
   117      opt_compile_flags = [
   118          "-g0",
   119          "-O2",
   120          "-D_FORTIFY_SOURCE=1",
   121          "-DNDEBUG",
   122          "-ffunction-sections",
   123          "-fdata-sections",
   124      ],
   125      opt_link_flags = ["-Wl,--gc-sections"],
   126      supports_start_end_lib = False,
   127      target_libc = "glibc_2.19",
   128      target_system_name = "x86_64-unknown-linux-gnu",
   129      tool_paths = {
   130          "ar": "/usr/bin/ar",
   131          "ld": "/usr/bin/ld",
   132          "llvm-cov": "/usr/local/bin/llvm-cov",
   133          "llvm-profdata": "/usr/local/bin/llvm-profdata",
   134          "cpp": "/usr/bin/cpp",
   135          "gcc": "/usr/local/bin/clang-12",
   136          "dwp": "/usr/bin/dwp",
   137          "gcov": "/dev/null",
   138          "nm": "/usr/bin/nm",
   139          "objcopy": "/usr/bin/objcopy",
   140          "objdump": "/usr/bin/objdump",
   141          "strip": "/usr/bin/strip",
   142      },
   143      toolchain_identifier = "linux_gnu_x86",
   144      unfiltered_compile_flags = [
   145          "-no-canonical-prefixes",
   146          "-Wno-builtin-macro-redefined",
   147          "-D__DATE__=\"redacted\"",
   148          "-D__TIMESTAMP__=\"redacted\"",
   149          "-D__TIME__=\"redacted\"",
   150      ],
   151  )
   152  
   153  # Android tooling requires a default toolchain for the armeabi-v7a cpu.
   154  cc_toolchain(
   155      name = "cc-compiler-armeabi-v7a",
   156      all_files = ":empty",
   157      ar_files = ":empty",
   158      as_files = ":empty",
   159      compiler_files = ":empty",
   160      dwp_files = ":empty",
   161      linker_files = ":empty",
   162      objcopy_files = ":empty",
   163      strip_files = ":empty",
   164      supports_param_files = 1,
   165      toolchain_config = ":stub_armeabi-v7a",
   166      toolchain_identifier = "stub_armeabi-v7a",
   167  )
   168  
   169  armeabi_cc_toolchain_config(name = "stub_armeabi-v7a")