aboutsummaryrefslogtreecommitdiff
path: root/toolchains/cc/linux_clang/BUILD.bazel
blob: c9a0e51412fb231bb7ba490d86abba950add8468 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
load(":features.bzl", "cc_features")
load(
    "@//build/bazel/toolchains/cc:rules.bzl",
    "cc_toolchain_config",
    "cc_toolchain_dynamic_runtime",
    "cc_toolchain_static_runtime",
)

package(default_visibility = ["//visibility:public"])

_x64_imports = [
    "@clang//:linux_x64_libcxx",
    "@gcc_lib//:start_libs",
]

cc_features(
    name = "x64_features",
    compile_flags = [
        "-m64",
        "-no-canonical-prefixes",
        "-Wno-builtin-macro-redefined",
        "-D__DATE__=\"redacted\"",
        "-D__TIMESTAMP__=\"redacted\"",
        "-D__TIME__=\"redacted\"",
    ],
    link_flags = [
        "-fuse-ld=lld",
        "-Wno-unused-command-line-argument",
    ],
    toolchain_imports = _x64_imports,
)

cc_toolchain_config(
    name = "x64_config",
    cc_features = ":x64_features",
    cc_tools = [
        "@clang//:linux_x64_clang",
        "@clang//:linux_x64_archiver",
        "@clang//:linux_x64_strip",
    ],
    identifier = "linux_clang_x64",
    target_cpu = "k8",
    toolchain_imports = _x64_imports,
)

cc_toolchain_dynamic_runtime(
    name = "x64_dynamic_runtime",
    libs = _x64_imports,
)

cc_toolchain_static_runtime(
    name = "x64_static_runtime",
    libs = _x64_imports,
)

cc_toolchain(
    name = "x64",
    all_files = ":x64_config",
    ar_files = "@clang//:linux_x64_archiver",
    as_files = "@clang//:linux_x64_clang",
    compiler_files = ":x64_config",
    dwp_files = "@//build/bazel/toolchains/cc:empty",
    dynamic_runtime_lib = ":x64_dynamic_runtime",
    linker_files = ":x64_config",
    objcopy_files = "@//build/bazel/toolchains/cc:empty",
    static_runtime_lib = ":x64_static_runtime",
    strip_files = "@clang//:linux_x64_strip",
    supports_param_files = 1,
    toolchain_config = ":x64_config",
)

toolchain(
    name = "x64_toolchain",
    exec_compatible_with = [
        "@platforms//cpu:x86_64",
        "@platforms//os:linux",
        "@bazel_tools//tools/cpp:clang",
    ],
    target_compatible_with = [
        "@platforms//cpu:x86_64",
        "@platforms//os:linux",
    ],
    toolchain = ":x64",
    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)