/
BUILD
118 lines (114 loc) · 3.37 KB
/
BUILD
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
load("@rules_cc//cc:defs.bzl", "cc_toolchain")
load(":cc_toolchain_config.bzl", "cc_toolchain_config")
toolchain(
name = "cosmo_toolchain",
toolchain = ":cosmo_cc_toolchain",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)
cc_toolchain(
name = "cosmo_cc_toolchain",
all_files = "@cosmocc//:x86_64-full",
ar_files = "@cosmocc//:x86_64-full",
as_files = "@cosmocc//:x86_64-full",
compiler_files = "@cosmocc//:x86_64-full",
dwp_files = ":empty",
linker_files = "@cosmocc//:x86_64-full",
objcopy_files = "@cosmocc//:x86_64-full",
static_runtime_lib = "@cosmocc//:x86_64-libstdc++.a",
strip_files = "@cosmocc//:x86_64-full",
supports_param_files = 0,
toolchain_config = ":cosmo_cc_toolchain_config",
)
cc_toolchain_config(
name = "cosmo_cc_toolchain_config",
abi_libc_version = "unknown",
abi_version = "unknown",
builtin_sysroot = "",
compile_flags = [
# "--strace",
"-isystem",
"external/cosmocc/include",
"-include",
"external/cosmocc/include/libc/integral/normalize.inc",
] + [
"-U_FORTIFY_SOURCE",
"-fstack-protector",
"-Wall",
"-Wunused-but-set-parameter",
"-Wno-free-nonheap-object",
"-pass-exit-codes",
] + [
"-fno-pie",
"-nostdinc",
"-fno-math-errno",
"-fportcosmo",
"-fno-dwarf2-cfi-asm",
"-fno-unwind-tables",
"-fno-asynchronous-unwind-tables",
"-fno-semantic-interposition",
"-fno-optimize-sibling-calls",
"-mno-omit-leaf-frame-pointer",
"-fno-exceptions",
"-mno-red-zone",
"-D__COSMOPOLITAN__",
"-D__COSMOCC__",
"-D__FATCOSMOCC__",
"-mno-tls-direct-seg-refs",
# "-ffixed-x18", # platform-specific
# "-ffixed-x28", # platform-specific
# "-mno-outline-atomics", # platform-specific
"-fno-omit-frame-pointer",
],
compiler = "cosmo_cc-11.2.0",
coverage_compile_flags = ["--coverage"],
coverage_link_flags = ["--coverage"],
cpu = "k8",
cxx_flags = [
# "-std=c++17",
"-fno-rtti",
"-fuse-cxa-atexit",
],
dbg_compile_flags = ["-g"],
host_system_name = "local",
link_flags = [
"-Lexternal/cosmocc/x86_64-linux-cosmo/lib",
"-Texternal/cosmocc/x86_64-linux-cosmo/lib/ape.lds",
"-zcommon-page-size=4096",
"-zmax-page-size=16384",
"-no-as-needed",
"-znorelro",
"-znow",
],
link_libs = [
"-lc",
"-lcosmo",
"-lcxx",
"-ldl",
"-lgcc_s",
"-lm",
"-lresolv",
"-lrt",
"-lstdc++",
# "external/cosmocc/x86_64-linux-cosmo/lib/ape-no-modify-self.o",
"external/cosmocc/x86_64-linux-cosmo/lib/ape.o",
"external/cosmocc/x86_64-linux-cosmo/lib/crt.o",
],
opt_compile_flags = [
"-O2",
"-D_FORTIFY_SOURCE=1",
"-DNDEBUG",
"-ffunction-sections",
"-fdata-sections",
],
opt_link_flags = ["--gc-sections"],
target_libc = "cosmo_cc",
target_system_name = "local",
toolchain_identifier = "cosmo_cc",
unfiltered_compile_flags = [
"-fno-canonical-system-headers",
"-Wno-builtin-macro-redefined",
"-D__DATE__=\"redacted\"",
"-D__TIMESTAMP__=\"redacted\"",
"-D__TIME__=\"redacted\"",
],
)