blob: 239000030c07c7dc505c35d8dfa62db97c902488 [file] [log] [blame]
Brian Silverman12b3fc52015-10-11 19:38:33 -04001major_version: "local"
2minor_version: ""
3default_target_cpu: "same_as_host"
4
5default_toolchain {
6 cpu: "k8"
7 toolchain_identifier: "local_linux"
8}
9
10default_toolchain {
11 cpu: "armeabi-v7a"
12 toolchain_identifier: "stub_armeabi-v7a"
13}
14
15
16toolchain {
17 abi_version: "armeabi-v7a"
18 abi_libc_version: "armeabi-v7a"
19 builtin_sysroot: ""
20 compiler: "compiler"
21 host_system_name: "armeabi-v7a"
22 needsPic: true
23 supports_gold_linker: false
24 supports_incremental_linker: false
25 supports_fission: false
26 supports_interface_shared_objects: false
27 supports_normalizing_ar: false
28 supports_start_end_lib: false
29 supports_thin_archives: false
30 target_libc: "armeabi-v7a"
31 target_cpu: "armeabi-v7a"
32 target_system_name: "armeabi-v7a"
33 toolchain_identifier: "stub_armeabi-v7a"
34
35 tool_path { name: "ar" path: "/bin/false" }
36 tool_path { name: "compat-ld" path: "/bin/false" }
37 tool_path { name: "cpp" path: "/bin/false" }
38 tool_path { name: "dwp" path: "/bin/false" }
39 tool_path { name: "gcc" path: "/bin/false" }
40 tool_path { name: "gcov" path: "/bin/false" }
41 tool_path { name: "ld" path: "/bin/false" }
42
43 tool_path { name: "nm" path: "/bin/false" }
44 tool_path { name: "objcopy" path: "/bin/false" }
45 tool_path { name: "objdump" path: "/bin/false" }
46 tool_path { name: "strip" path: "/bin/false" }
47}
48
49toolchain {
50 abi_version: "local"
51 abi_libc_version: "local"
52 builtin_sysroot: ""
53 compiler: "compiler"
54 host_system_name: "local"
55 needsPic: true
56 supports_gold_linker: false
57 supports_incremental_linker: false
58 supports_fission: false
59 supports_interface_shared_objects: false
60 supports_normalizing_ar: false
61 supports_start_end_lib: false
62 supports_thin_archives: false
63 target_libc: "local"
64 target_cpu: "local"
65 target_system_name: "local"
66 toolchain_identifier: "local_linux"
67
68 tool_path { name: "ar" path: "/usr/bin/ar" }
69 tool_path { name: "compat-ld" path: "/usr/bin/ld" }
70 tool_path { name: "cpp" path: "/usr/bin/cpp" }
71 tool_path { name: "dwp" path: "/usr/bin/dwp" }
72 tool_path { name: "gcc" path: "/usr/bin/clang-3.6" }
73 tool_path { name: "gcov" path: "/usr/bin/gcov" }
74 # C(++) compiles invoke the compiler (as that is the one knowing where
75 # to find libraries), but we provide LD so other rules can invoke the linker.
76 tool_path { name: "ld" path: "/usr/bin/ld" }
77 tool_path { name: "nm" path: "/usr/bin/nm" }
78 tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
79 objcopy_embed_flag: "-I"
80 objcopy_embed_flag: "binary"
81 tool_path { name: "objdump" path: "/usr/bin/objdump" }
82 tool_path { name: "strip" path: "/usr/bin/strip" }
83
84 # TODO(bazel-team): In theory, the path here ought to exactly match the path
85 # used by gcc. That works because bazel currently doesn't track files at
86 # absolute locations and has no remote execution, yet. However, this will need
87 # to be fixed, maybe with auto-detection?
88 cxx_builtin_include_directory: "/usr/lib/gcc/"
89 cxx_builtin_include_directory: "/usr/local/include"
90 cxx_builtin_include_directory: "/usr/include"
91
92 linker_flag: "-lstdc++"
93 linker_flag: "-B/usr/bin/"
94
95 feature {
96 name: "opt"
97 implies: "all_modes"
98 flag_set {
99 action: "preprocess-assemble"
100 action: "c-compile"
101 action: "c++-compile"
102 action: "c++-header-parsing"
103 action: "c++-header-preprocessing"
104 action: "c++-module-compile"
105 flag_group {
106 flag: "-DAOS_DEBUG=0"
107 }
108 }
109 }
110
111 feature {
112 name: "dbg"
113 implies: "all_modes"
114 flag_set {
115 action: "preprocess-assemble"
116 action: "c-compile"
117 action: "c++-compile"
118 action: "c++-header-parsing"
119 action: "c++-header-preprocessing"
120 action: "c++-module-compile"
121 flag_group {
122 flag: "-DAOS_DEBUG=1"
123 }
124 }
125 }
126
127 feature {
128 name: "fastbuild"
129 implies: "all_modes"
130 flag_set {
131 action: "preprocess-assemble"
132 action: "c-compile"
133 action: "c++-compile"
134 action: "c++-header-parsing"
135 action: "c++-header-preprocessing"
136 action: "c++-module-compile"
137 flag_group {
138 flag: "-DAOS_DEBUG=0"
139 }
140 }
141 }
142
143 feature {
144 name: "all_modes"
145 flag_set {
146 action: "c-compile"
147 flag_group {
148 flag: "-std=gnu99"
149 }
150 }
151 flag_set {
152 action: "c++-compile"
153 action: "c++-header-parsing"
154 action: "c++-header-preprocessing"
155 action: "c++-module-compile"
156 flag_group {
157 flag: "-std=gnu++11"
158 }
Brian Silverman23a1b342015-10-11 23:44:09 -0400159 }
160 flag_set {
161 action: "preprocess-assemble"
162 action: "c-compile"
163 action: "c++-compile"
164 action: "c++-header-parsing"
165 action: "c++-header-preprocessing"
166 action: "c++-module-compile"
167 flag_group {
Brian Silverman12b3fc52015-10-11 19:38:33 -0400168 flag_group {
169 # We always want to compile with -pthread semantics.
170 flag: "-pthread"
171 }
172 }
173 }
174
175 # Anticipated future default.
176 # This makes GCC and Clang do what we want when called through symlinks.
177 unfiltered_cxx_flag: "-no-canonical-prefixes"
178 linker_flag: "-no-canonical-prefixes"
179
180 # Things that the code wants defined.
181 compiler_flag: "-D__STDC_FORMAT_MACROS"
182 compiler_flag: "-D__STDC_CONSTANT_MACROS"
183 compiler_flag: "-D__STDC_LIMIT_MACROS"
184 compiler_flag: "-D_FILE_OFFSET_BITS=64"
185 # TODO(Brian): Rename this or something.
186 #compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
187
188 linker_flag: "-fuse-ld=gold"
189
190 # Temporary escape hatch for the Gyp->Bazel conversion.
191 # TODO(Brian): Remove this.
192 compiler_flag: "-DAOS_BAZEL"
193
194 # Make C++ compilation deterministic. Use linkstamping instead of these
195 # compiler symbols.
196 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
197 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
198 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
199 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
200
201 # Security hardening on by default.
202 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
203 # We need to undef it before redefining it as some distributions now have
204 # it enabled by default.
205 compiler_flag: "-U_FORTIFY_SOURCE"
206 compiler_flag: "-D_FORTIFY_SOURCE=1"
207 compiler_flag: "-fstack-protector"
208 compiler_flag: "-fPIE"
209 linker_flag: "-pie"
210 linker_flag: "-Wl,-z,relro,-z,now"
211
212 # Pretty much everything needs this, including parts of the glibc STL...
213 linker_flag: "-lm"
214
215 # Enable coloring even if there's no attached terminal. Bazel removes the
216 # escape sequences if --nocolor is specified.
217 compiler_flag: "-fcolor-diagnostics"
218
219 compiler_flag: "-Wall"
220 compiler_flag: "-Wextra"
221 compiler_flag: "-Wswitch-enum"
222 compiler_flag: "-Wpointer-arith"
223 compiler_flag: "-Wstrict-aliasing=2"
224 compiler_flag: "-Wcast-qual"
225 compiler_flag: "-Wcast-align"
226 compiler_flag: "-Wwrite-strings"
227 compiler_flag: "-Wtype-limits"
228 compiler_flag: "-Wsign-compare"
229 compiler_flag: "-Wformat=2"
230 compiler_flag: "-Werror"
231
232 # Keep stack frames for debugging, even in opt mode.
233 compiler_flag: "-fno-omit-frame-pointer"
234
235 # Don't use temp files while compiling.
236 compiler_flag: "-pipe"
237
238 # Have GCC return the exit code from ld.
239 #linker_flag: "-pass-exit-codes"
240
241 # Stamp the binary with a unique identifier.
242 linker_flag: "-Wl,--build-id=md5"
243 linker_flag: "-Wl,--hash-style=gnu"
244 linker_flag: "-Wl,--warn-execstack"
245 linker_flag: "-Wl,--detect-odr-violations"
246
247 compilation_mode_flags {
248 mode: DBG
249 # Enable debug symbols.
250 compiler_flag: "-ggdb3"
251 }
252 compilation_mode_flags {
253 mode: OPT
254
255 # No debug symbols.
256 # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or
257 # even generally? However, that can't happen here, as it requires special
258 # handling in Bazel.
259 compiler_flag: "-g0"
260
261 compiler_flag: "-Oz"
262
263 # Disable assertions
264 compiler_flag: "-DNDEBUG"
265
266 # Removal of unused code and data at link time (can this increase binary size in some cases?).
267 compiler_flag: "-ffunction-sections"
268 compiler_flag: "-fdata-sections"
269 linker_flag: "-Wl,--gc-sections"
270 }
271}