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