blob: 6e0c1583984f409f20c340245a3a5b8b0d805c55 [file] [log] [blame]
Brian Silverman12b3fc52015-10-11 19:38:33 -04001major_version: "local"
2minor_version: ""
3default_target_cpu: "same_as_host"
4
5default_toolchain {
Austin Schuh23da18b2015-10-11 20:52:49 -07006 cpu: "roborio"
7 toolchain_identifier: "roborio_linux"
8}
9
10default_toolchain {
Brian Silverman12b3fc52015-10-11 19:38:33 -040011 cpu: "k8"
Austin Schuh23da18b2015-10-11 20:52:49 -070012 toolchain_identifier: "k8_linux"
Brian Silverman12b3fc52015-10-11 19:38:33 -040013}
14
15default_toolchain {
16 cpu: "armeabi-v7a"
17 toolchain_identifier: "stub_armeabi-v7a"
18}
19
Brian Silverman0d57fc82016-01-24 21:02:53 -050020default_toolchain {
21 cpu: "armhf-debian"
22 toolchain_identifier: "clang_linux_armhf"
23}
Brian Silverman12b3fc52015-10-11 19:38:33 -040024
Brian Silverman8b638692017-06-26 23:10:26 -070025default_toolchain {
26 cpu: "cortex-m4f"
27 toolchain_identifier: "cortex-m4f"
28}
29
Brian Silverman12b3fc52015-10-11 19:38:33 -040030toolchain {
31 abi_version: "armeabi-v7a"
32 abi_libc_version: "armeabi-v7a"
33 builtin_sysroot: ""
34 compiler: "compiler"
35 host_system_name: "armeabi-v7a"
36 needsPic: true
37 supports_gold_linker: false
38 supports_incremental_linker: false
39 supports_fission: false
40 supports_interface_shared_objects: false
41 supports_normalizing_ar: false
42 supports_start_end_lib: false
43 supports_thin_archives: false
44 target_libc: "armeabi-v7a"
45 target_cpu: "armeabi-v7a"
46 target_system_name: "armeabi-v7a"
47 toolchain_identifier: "stub_armeabi-v7a"
48
49 tool_path { name: "ar" path: "/bin/false" }
50 tool_path { name: "compat-ld" path: "/bin/false" }
51 tool_path { name: "cpp" path: "/bin/false" }
52 tool_path { name: "dwp" path: "/bin/false" }
53 tool_path { name: "gcc" path: "/bin/false" }
54 tool_path { name: "gcov" path: "/bin/false" }
55 tool_path { name: "ld" path: "/bin/false" }
56
57 tool_path { name: "nm" path: "/bin/false" }
58 tool_path { name: "objcopy" path: "/bin/false" }
59 tool_path { name: "objdump" path: "/bin/false" }
60 tool_path { name: "strip" path: "/bin/false" }
61}
62
63toolchain {
64 abi_version: "local"
65 abi_libc_version: "local"
66 builtin_sysroot: ""
Austin Schuh23da18b2015-10-11 20:52:49 -070067 compiler: "clang"
Brian Silverman12b3fc52015-10-11 19:38:33 -040068 host_system_name: "local"
69 needsPic: true
70 supports_gold_linker: false
71 supports_incremental_linker: false
72 supports_fission: false
73 supports_interface_shared_objects: false
74 supports_normalizing_ar: false
75 supports_start_end_lib: false
76 supports_thin_archives: false
77 target_libc: "local"
Austin Schuh23da18b2015-10-11 20:52:49 -070078 target_cpu: "k8"
79 target_system_name: "k8"
80 toolchain_identifier: "k8_linux"
Brian Silverman12b3fc52015-10-11 19:38:33 -040081
82 tool_path { name: "ar" path: "/usr/bin/ar" }
83 tool_path { name: "compat-ld" path: "/usr/bin/ld" }
84 tool_path { name: "cpp" path: "/usr/bin/cpp" }
85 tool_path { name: "dwp" path: "/usr/bin/dwp" }
86 tool_path { name: "gcc" path: "/usr/bin/clang-3.6" }
87 tool_path { name: "gcov" path: "/usr/bin/gcov" }
88 # C(++) compiles invoke the compiler (as that is the one knowing where
89 # to find libraries), but we provide LD so other rules can invoke the linker.
90 tool_path { name: "ld" path: "/usr/bin/ld" }
91 tool_path { name: "nm" path: "/usr/bin/nm" }
92 tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
93 objcopy_embed_flag: "-I"
94 objcopy_embed_flag: "binary"
95 tool_path { name: "objdump" path: "/usr/bin/objdump" }
96 tool_path { name: "strip" path: "/usr/bin/strip" }
Brian Silverman6d350402016-03-05 01:15:46 -050097 linking_mode_flags { mode: DYNAMIC }
Brian Silverman12b3fc52015-10-11 19:38:33 -040098
99 # TODO(bazel-team): In theory, the path here ought to exactly match the path
100 # used by gcc. That works because bazel currently doesn't track files at
101 # absolute locations and has no remote execution, yet. However, this will need
102 # to be fixed, maybe with auto-detection?
Austin Schuh7b684d32015-10-21 20:17:09 -0700103 cxx_builtin_include_directory: '/usr/include/c++/4.9'
104 cxx_builtin_include_directory: '/usr/include/x86_64-linux-gnu/c++/4.9'
105 cxx_builtin_include_directory: '/usr/include/c++/4.9/backward'
106 cxx_builtin_include_directory: '/usr/local/include'
107 cxx_builtin_include_directory: '/usr/lib/llvm-3.6/lib/clang/3.6.2/include'
108 cxx_builtin_include_directory: '/usr/include/x86_64-linux-gnu'
109 cxx_builtin_include_directory: '/usr/include'
Brian Silverman0d57fc82016-01-24 21:02:53 -0500110 cxx_builtin_include_directory: '/usr/lib/clang/3.6.2/include'
Brian Silverman12b3fc52015-10-11 19:38:33 -0400111
112 linker_flag: "-lstdc++"
113 linker_flag: "-B/usr/bin/"
114
115 feature {
116 name: "opt"
117 implies: "all_modes"
118 flag_set {
119 action: "preprocess-assemble"
120 action: "c-compile"
121 action: "c++-compile"
122 action: "c++-header-parsing"
123 action: "c++-header-preprocessing"
124 action: "c++-module-compile"
125 flag_group {
126 flag: "-DAOS_DEBUG=0"
127 }
128 }
129 }
130
131 feature {
132 name: "dbg"
133 implies: "all_modes"
134 flag_set {
135 action: "preprocess-assemble"
136 action: "c-compile"
137 action: "c++-compile"
138 action: "c++-header-parsing"
139 action: "c++-header-preprocessing"
140 action: "c++-module-compile"
141 flag_group {
142 flag: "-DAOS_DEBUG=1"
143 }
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500144 flag_group {
145 flag: "-fno-omit-frame-pointer"
146 }
Brian Silverman12b3fc52015-10-11 19:38:33 -0400147 }
148 }
149
150 feature {
151 name: "fastbuild"
152 implies: "all_modes"
153 flag_set {
154 action: "preprocess-assemble"
155 action: "c-compile"
156 action: "c++-compile"
157 action: "c++-header-parsing"
158 action: "c++-header-preprocessing"
159 action: "c++-module-compile"
160 flag_group {
161 flag: "-DAOS_DEBUG=0"
162 }
163 }
164 }
165
166 feature {
167 name: "all_modes"
168 flag_set {
Austin Schuha20ae722015-11-01 12:29:38 -0800169 action: "preprocess-assemble"
170 action: "assemble"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400171 action: "c-compile"
172 flag_group {
173 flag: "-std=gnu99"
174 }
175 }
176 flag_set {
177 action: "c++-compile"
178 action: "c++-header-parsing"
179 action: "c++-header-preprocessing"
180 action: "c++-module-compile"
181 flag_group {
Austin Schuha20ae722015-11-01 12:29:38 -0800182 flag: "-std=gnu++1y"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400183 }
Brian Silverman23a1b342015-10-11 23:44:09 -0400184 }
185 flag_set {
186 action: "preprocess-assemble"
Austin Schuh23da18b2015-10-11 20:52:49 -0700187 action: "assemble"
188 action: "c++-link"
Brian Silverman23a1b342015-10-11 23:44:09 -0400189 action: "c++-compile"
190 action: "c++-header-parsing"
191 action: "c++-header-preprocessing"
192 action: "c++-module-compile"
Austin Schuh23da18b2015-10-11 20:52:49 -0700193 action: "c-compile"
Brian Silverman5dc00072015-10-12 00:38:14 -0400194 flag_group {
Brian Silverman12b3fc52015-10-11 19:38:33 -0400195 # We always want to compile with -pthread semantics.
Brian Silverman5dc00072015-10-12 00:38:14 -0400196 flag: "-pthread"
197 }
Brian Silverman12b3fc52015-10-11 19:38:33 -0400198 }
199 }
200
201 # Anticipated future default.
202 # This makes GCC and Clang do what we want when called through symlinks.
203 unfiltered_cxx_flag: "-no-canonical-prefixes"
204 linker_flag: "-no-canonical-prefixes"
205
206 # Things that the code wants defined.
207 compiler_flag: "-D__STDC_FORMAT_MACROS"
208 compiler_flag: "-D__STDC_CONSTANT_MACROS"
209 compiler_flag: "-D__STDC_LIMIT_MACROS"
210 compiler_flag: "-D_FILE_OFFSET_BITS=64"
211 # TODO(Brian): Rename this or something.
Austin Schuh23da18b2015-10-11 20:52:49 -0700212 compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400213
214 linker_flag: "-fuse-ld=gold"
215
Brian Silverman12b3fc52015-10-11 19:38:33 -0400216 # Make C++ compilation deterministic. Use linkstamping instead of these
217 # compiler symbols.
218 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
219 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
220 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
221 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
222
223 # Security hardening on by default.
224 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
225 # We need to undef it before redefining it as some distributions now have
226 # it enabled by default.
227 compiler_flag: "-U_FORTIFY_SOURCE"
228 compiler_flag: "-D_FORTIFY_SOURCE=1"
229 compiler_flag: "-fstack-protector"
230 compiler_flag: "-fPIE"
231 linker_flag: "-pie"
232 linker_flag: "-Wl,-z,relro,-z,now"
233
234 # Pretty much everything needs this, including parts of the glibc STL...
235 linker_flag: "-lm"
236
237 # Enable coloring even if there's no attached terminal. Bazel removes the
238 # escape sequences if --nocolor is specified.
239 compiler_flag: "-fcolor-diagnostics"
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500240 compiler_flag: "-fmessage-length=80"
241 compiler_flag: "-fmacro-backtrace-limit=0"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400242
243 compiler_flag: "-Wall"
244 compiler_flag: "-Wextra"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400245 compiler_flag: "-Wpointer-arith"
Brian Silverman594be0d2015-10-31 17:56:23 -0400246 compiler_flag: "-Wstrict-aliasing"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400247 compiler_flag: "-Wcast-qual"
248 compiler_flag: "-Wcast-align"
249 compiler_flag: "-Wwrite-strings"
250 compiler_flag: "-Wtype-limits"
251 compiler_flag: "-Wsign-compare"
252 compiler_flag: "-Wformat=2"
253 compiler_flag: "-Werror"
254
255 # Keep stack frames for debugging, even in opt mode.
256 compiler_flag: "-fno-omit-frame-pointer"
257
258 # Don't use temp files while compiling.
259 compiler_flag: "-pipe"
260
Brian Silverman12b3fc52015-10-11 19:38:33 -0400261 # Stamp the binary with a unique identifier.
262 linker_flag: "-Wl,--build-id=md5"
263 linker_flag: "-Wl,--hash-style=gnu"
264 linker_flag: "-Wl,--warn-execstack"
265 linker_flag: "-Wl,--detect-odr-violations"
266
Brian Silvermand2540402015-11-28 18:35:00 -0500267 # Enable debug symbols.
268 compiler_flag: "-ggdb3"
269
Brian Silverman12b3fc52015-10-11 19:38:33 -0400270 compilation_mode_flags {
271 mode: OPT
272
Austin Schuha20ae722015-11-01 12:29:38 -0800273 compiler_flag: "-O2"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400274
275 # Disable assertions
276 compiler_flag: "-DNDEBUG"
277
278 # Removal of unused code and data at link time (can this increase binary size in some cases?).
279 compiler_flag: "-ffunction-sections"
280 compiler_flag: "-fdata-sections"
281 linker_flag: "-Wl,--gc-sections"
282 }
283}
Austin Schuh23da18b2015-10-11 20:52:49 -0700284
285toolchain {
286 abi_version: "roborio"
287 abi_libc_version: "roborio"
288 builtin_sysroot: ""
289 compiler: "gcc"
290 host_system_name: "roborio"
291 needsPic: true
292 supports_gold_linker: false
293 supports_incremental_linker: false
294 supports_fission: false
295 supports_interface_shared_objects: false
296 supports_normalizing_ar: false
297 supports_start_end_lib: false
298 supports_thin_archives: false
299 target_libc: "roborio"
300 target_cpu: "roborio"
301 target_system_name: "roborio"
302 toolchain_identifier: "roborio_linux"
303
Austin Schuh55139fe2015-10-14 23:55:24 -0700304 tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" }
305 tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
306 tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" }
307 tool_path { name: "dwp" path: "/bin/false" }
308 tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" }
309 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
Austin Schuh23da18b2015-10-11 20:52:49 -0700310 # C(++) compiles invoke the compiler (as that is the one knowing where
311 # to find libraries), but we provide LD so other rules can invoke the linker.
Austin Schuh55139fe2015-10-14 23:55:24 -0700312 tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
313 tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" }
314 tool_path { name: "objcopy" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy" }
Austin Schuh23da18b2015-10-11 20:52:49 -0700315 objcopy_embed_flag: "-I"
316 objcopy_embed_flag: "binary"
Austin Schuh55139fe2015-10-14 23:55:24 -0700317 tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" }
318 tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" }
Brian Silverman6d350402016-03-05 01:15:46 -0500319 linking_mode_flags { mode: DYNAMIC }
Austin Schuh23da18b2015-10-11 20:52:49 -0700320
Brian Silverman826e1cd2016-01-31 18:26:00 -0500321 compiler_flag: "--sysroot=external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi"
Austin Schuh044e18b2015-10-21 20:17:09 -0700322 compiler_flag: "-nostdinc"
323 compiler_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500324 compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include",
Austin Schuh044e18b2015-10-21 20:17:09 -0700325 compiler_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500326 compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include-fixed"
Austin Schuh044e18b2015-10-21 20:17:09 -0700327 compiler_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500328 compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/usr/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700329
330 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500331 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3"
Austin Schuh044e18b2015-10-21 20:17:09 -0700332 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500333 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3/arm-frc-linux-gnueabi"
Austin Schuh044e18b2015-10-21 20:17:09 -0700334 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500335 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3/backward"
Austin Schuh044e18b2015-10-21 20:17:09 -0700336 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500337 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700338 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500339 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include-fixed"
Austin Schuh044e18b2015-10-21 20:17:09 -0700340 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500341 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700342 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500343 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/usr/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700344
Austin Schuh23da18b2015-10-11 20:52:49 -0700345 # TODO(bazel-team): In theory, the path here ought to exactly match the path
346 # used by gcc. That works because bazel currently doesn't track files at
347 # absolute locations and has no remote execution, yet. However, this will need
348 # to be fixed, maybe with auto-detection?
Brian Silverman826e1cd2016-01-31 18:26:00 -0500349 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/4.9.3"
350 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/4.9.3/arm-frc-linux-gnueabi"
351 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/4.9.3/backward"
352 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include)%"
353 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include-fixed)%"
354 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%"
355 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/usr/include)%"
Austin Schuh23da18b2015-10-11 20:52:49 -0700356
357 linker_flag: "-lstdc++"
Brian Silvermanb200c172017-01-02 17:35:35 -0800358 linker_flag: "-Ltools/cpp/arm-frc-linux-gnueabi/libs"
Austin Schuh23da18b2015-10-11 20:52:49 -0700359
360 feature {
361 name: "opt"
362 implies: "all_modes"
363 flag_set {
364 action: "preprocess-assemble"
365 action: "c-compile"
366 action: "c++-compile"
367 action: "c++-header-parsing"
368 action: "c++-header-preprocessing"
369 action: "c++-module-compile"
370 flag_group {
371 flag: "-DAOS_DEBUG=0"
372 }
373 }
374 }
375
376 feature {
377 name: "dbg"
378 implies: "all_modes"
379 flag_set {
380 action: "preprocess-assemble"
381 action: "c-compile"
382 action: "c++-compile"
383 action: "c++-header-parsing"
384 action: "c++-header-preprocessing"
385 action: "c++-module-compile"
386 flag_group {
387 flag: "-DAOS_DEBUG=1"
388 }
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500389 flag_group {
390 flag: "-fno-omit-frame-pointer"
391 }
Austin Schuh23da18b2015-10-11 20:52:49 -0700392 }
393 }
394
395 feature {
396 name: "fastbuild"
397 implies: "all_modes"
398 flag_set {
399 action: "preprocess-assemble"
400 action: "c-compile"
401 action: "c++-compile"
402 action: "c++-header-parsing"
403 action: "c++-header-preprocessing"
404 action: "c++-module-compile"
405 flag_group {
406 flag: "-DAOS_DEBUG=0"
407 }
408 }
409 }
410
411 feature {
412 name: "all_modes"
413 flag_set {
Austin Schuh23da18b2015-10-11 20:52:49 -0700414 action: "preprocess-assemble"
415 action: "assemble"
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500416 action: "c-compile"
Austin Schuh23da18b2015-10-11 20:52:49 -0700417 flag_group {
418 flag: "-std=gnu99"
419 }
420 }
421 flag_set {
422 action: "c++-compile"
423 action: "c++-header-parsing"
424 action: "c++-header-preprocessing"
425 action: "c++-module-compile"
426 flag_group {
427 flag: "-std=gnu++1y"
428 }
429 }
430 flag_set {
431 action: "preprocess-assemble"
432 action: "assemble"
433 action: "c++-link"
434 action: "c++-compile"
435 action: "c++-header-parsing"
436 action: "c++-header-preprocessing"
437 action: "c++-module-compile"
438 action: "c-compile"
439 flag_group {
440 # We always want to compile with -pthread semantics.
441 flag: "-pthread"
442 }
443 }
444 }
445
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500446 compiler_flag: "-mfpu=neon"
447 # TODO(brians): See if it will run with this enabled.
448 #compiler_flag: "-mhwdiv=arm,thumb"
449
Austin Schuh23da18b2015-10-11 20:52:49 -0700450 # Anticipated future default.
451 # This makes GCC and Clang do what we want when called through symlinks.
452 unfiltered_cxx_flag: "-no-canonical-prefixes"
453 linker_flag: "-no-canonical-prefixes"
454
455 # Things that the code wants defined.
456 compiler_flag: "-D__STDC_FORMAT_MACROS"
457 compiler_flag: "-D__STDC_CONSTANT_MACROS"
458 compiler_flag: "-D__STDC_LIMIT_MACROS"
459 compiler_flag: "-D_FILE_OFFSET_BITS=64"
460 # TODO(Brian): Rename this or something.
Austin Schuha20ae722015-11-01 12:29:38 -0800461 compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
Austin Schuh23da18b2015-10-11 20:52:49 -0700462
463 #linker_flag: "-fuse-ld=gold"
464
Austin Schuh23da18b2015-10-11 20:52:49 -0700465 # Make C++ compilation deterministic. Use linkstamping instead of these
466 # compiler symbols.
467 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
468 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
469 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
470 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
471
472 # Security hardening on by default.
473 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
474 # We need to undef it before redefining it as some distributions now have
475 # it enabled by default.
476 compiler_flag: "-U_FORTIFY_SOURCE"
477 compiler_flag: "-fstack-protector"
478 compiler_flag: "-fPIE"
479 linker_flag: "-pie"
480 linker_flag: "-Wl,-z,relro,-z,now"
481
482 # Pretty much everything needs this, including parts of the glibc STL...
483 linker_flag: "-lm"
484
485 # Enable coloring even if there's no attached terminal. Bazel removes the
486 # escape sequences if --nocolor is specified.
487 compiler_flag: "-fdiagnostics-color=always"
488
489 compiler_flag: "-Wall"
490 compiler_flag: "-Wextra"
Austin Schuh23da18b2015-10-11 20:52:49 -0700491 compiler_flag: "-Wpointer-arith"
Brian Silverman594be0d2015-10-31 17:56:23 -0400492 compiler_flag: "-Wstrict-aliasing"
Austin Schuh23da18b2015-10-11 20:52:49 -0700493 compiler_flag: "-Wcast-qual"
494 compiler_flag: "-Wcast-align"
495 compiler_flag: "-Wwrite-strings"
496 compiler_flag: "-Wtype-limits"
497 compiler_flag: "-Wsign-compare"
498 compiler_flag: "-Wformat=2"
499 compiler_flag: "-Werror"
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500500 compiler_flag: "-Wunused-local-typedefs"
Austin Schuh23da18b2015-10-11 20:52:49 -0700501
502 # Keep stack frames for debugging, even in opt mode.
503 compiler_flag: "-fno-omit-frame-pointer"
504 compiler_flag: "-D__has_feature(x)=0"
505
506 # Don't use temp files while compiling.
507 compiler_flag: "-pipe"
508
509 # Have GCC return the exit code from ld.
510 linker_flag: "-pass-exit-codes"
511
512 # Stamp the binary with a unique identifier.
513 linker_flag: "-Wl,--build-id=md5"
514 linker_flag: "-Wl,--hash-style=gnu"
515 #linker_flag: "-Wl,--warn-execstack"
516 #linker_flag: "-Wl,--detect-odr-violations"
517
Brian Silvermand2540402015-11-28 18:35:00 -0500518 # Enable debug symbols.
519 compiler_flag: "-ggdb3"
520
Austin Schuh23da18b2015-10-11 20:52:49 -0700521 compilation_mode_flags {
522 mode: OPT
523
Brian Silverman594be0d2015-10-31 17:56:23 -0400524 compiler_flag: "-O2"
Austin Schuh23da18b2015-10-11 20:52:49 -0700525
526 # Disable assertions
527 compiler_flag: "-DNDEBUG"
528 compiler_flag: "-D_FORTIFY_SOURCE=1"
529
530 # Removal of unused code and data at link time (can this increase binary size in some cases?).
531 compiler_flag: "-ffunction-sections"
532 compiler_flag: "-fdata-sections"
533 linker_flag: "-Wl,--gc-sections"
534 }
535}
Brian Silverman0d57fc82016-01-24 21:02:53 -0500536
537toolchain {
538 abi_version: "clang_3.6"
539 abi_libc_version: "glibc_2.19"
540 builtin_sysroot: ""
541 compiler: "clang"
542 host_system_name: "roborio"
543 needsPic: true
544 supports_gold_linker: false
545 supports_incremental_linker: false
546 supports_fission: false
547 supports_interface_shared_objects: false
548 supports_normalizing_ar: true
549 supports_start_end_lib: false
550 supports_thin_archives: true
551 target_libc: "glibc_2.19"
552 target_cpu: "armhf-debian"
553 target_system_name: "arm_a15"
554 toolchain_identifier: "clang_linux_armhf"
555
556 tool_path { name: "ar" path: "linaro_linux_gcc/arm-linux-gnueabihf-ar" }
557 tool_path { name: "compat-ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
558 tool_path { name: "cpp" path: "linaro_linux_gcc/clang_bin/clang" }
559 tool_path { name: "dwp" path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp" }
560 tool_path { name: "gcc" path: "linaro_linux_gcc/clang_bin/clang" }
561 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
562 # C(++) compiles invoke the compiler (as that is the one knowing where
563 # to find libraries), but we provide LD so other rules can invoke the linker.
564 tool_path { name: "ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
565 tool_path { name: "nm" path: "linaro_linux_gcc/arm-linux-gnueabihf-nm" }
566 tool_path { name: "objcopy" path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy" }
567 objcopy_embed_flag: "-I"
568 objcopy_embed_flag: "binary"
569 tool_path { name: "objdump" path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump" }
570 tool_path { name: "strip" path: "linaro_linux_gcc/arm-linux-gnueabihf-strip" }
Brian Silverman6d350402016-03-05 01:15:46 -0500571 linking_mode_flags { mode: DYNAMIC }
Brian Silverman0d57fc82016-01-24 21:02:53 -0500572
573 compiler_flag: "-target"
574 compiler_flag: "armv7a-arm-linux-gnueabif"
Austin Schuh61660832016-03-04 21:56:39 -0800575 compiler_flag: "--sysroot=external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500576 compiler_flag: "-mfloat-abi=hard"
577 compiler_flag: "-mfpu=vfpv3-d16"
578
579 compiler_flag: "-nostdinc"
580 compiler_flag: "-isystem"
581 compiler_flag: "/usr/lib/clang/3.6/include"
582 compiler_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800583 compiler_flag: "external/linaro_linux_gcc_4_9_repo/lib/gcc/arm-linux-gnueabihf/4.9.3/include"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500584 compiler_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800585 compiler_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/usr/include"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500586 compiler_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800587 compiler_flag: "external/linaro_linux_gcc_4_9_repo/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500588 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800589 cxx_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/include/c++/4.9.3/arm-linux-gnueabihf"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500590 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800591 cxx_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/include/c++/4.9.3"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500592 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800593 cxx_flag: "external/linaro_linux_gcc_4_9_repo/include/c++/4.9.3/arm-linux-gnueabihf"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500594 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800595 cxx_flag: "external/linaro_linux_gcc_4_9_repo/include/c++/4.9.3"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500596
Austin Schuh61660832016-03-04 21:56:39 -0800597 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//include)%"
598 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/usr/include)%"
599 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/usr/lib/include)%"
600 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed)%"
601 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//include)%/c++/4.9.3"
602 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/4.9.3/include)%"
603 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed)%"
604 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//lib/gcc/arm-linux-gnueabihf/4.9.3/include)%"
605 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed)%"
606 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/include)%/c++/4.9.3"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500607 cxx_builtin_include_directory: '/usr/lib/clang/3.6/include'
608
609 linker_flag: "-target"
610 linker_flag: "armv7a-arm-linux-gnueabif"
Austin Schuh61660832016-03-04 21:56:39 -0800611 linker_flag: "--sysroot=external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500612 linker_flag: "-lstdc++"
613 linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs"
Austin Schuh61660832016-03-04 21:56:39 -0800614 linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/lib"
615 linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/lib"
616 linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/usr/lib"
617 linker_flag: "-Bexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/bin"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500618 linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3"
619
620 feature {
621 name: "opt"
622 implies: "all_modes"
623 flag_set {
624 action: "preprocess-assemble"
625 action: "c-compile"
626 action: "c++-compile"
627 action: "c++-header-parsing"
628 action: "c++-header-preprocessing"
629 action: "c++-module-compile"
630 flag_group {
631 flag: "-DAOS_DEBUG=0"
632 }
633 }
634 }
635
636 feature {
637 name: "dbg"
638 implies: "all_modes"
639 flag_set {
640 action: "preprocess-assemble"
641 action: "c-compile"
642 action: "c++-compile"
643 action: "c++-header-parsing"
644 action: "c++-header-preprocessing"
645 action: "c++-module-compile"
646 flag_group {
647 flag: "-DAOS_DEBUG=1"
648 }
649 flag_group {
650 flag: "-fno-omit-frame-pointer"
651 }
652 }
653 }
654
655 feature {
656 name: "fastbuild"
657 implies: "all_modes"
658 flag_set {
659 action: "preprocess-assemble"
660 action: "c-compile"
661 action: "c++-compile"
662 action: "c++-header-parsing"
663 action: "c++-header-preprocessing"
664 action: "c++-module-compile"
665 flag_group {
666 flag: "-DAOS_DEBUG=0"
667 }
668 }
669 }
670
671 feature {
672 name: "all_modes"
673 flag_set {
674 action: "preprocess-assemble"
675 action: "assemble"
676 action: "c-compile"
677 flag_group {
678 flag: "-std=gnu99"
679 }
680 }
681 flag_set {
682 action: "c++-compile"
683 action: "c++-header-parsing"
684 action: "c++-header-preprocessing"
685 action: "c++-module-compile"
686 flag_group {
687 flag: "-std=gnu++1y"
688 }
689 }
690 flag_set {
691 action: "preprocess-assemble"
692 action: "assemble"
693 action: "c++-link"
694 action: "c++-compile"
695 action: "c++-header-parsing"
696 action: "c++-header-preprocessing"
697 action: "c++-module-compile"
698 action: "c-compile"
699 flag_group {
700 # We always want to compile with -pthread semantics.
701 flag: "-pthread"
702 }
703 }
704 }
705
706 # Anticipated future default.
707 # This makes GCC and Clang do what we want when called through symlinks.
708 unfiltered_cxx_flag: "-no-canonical-prefixes"
709 linker_flag: "-no-canonical-prefixes"
710
711 # Things that the code wants defined.
712 compiler_flag: "-D__STDC_FORMAT_MACROS"
713 compiler_flag: "-D__STDC_CONSTANT_MACROS"
714 compiler_flag: "-D__STDC_LIMIT_MACROS"
715 compiler_flag: "-D_FILE_OFFSET_BITS=64"
716 # TODO(Brian): Rename this or something.
717 compiler_flag: "-DAOS_ARCHITECTURE_armhf"
718
719 # Make C++ compilation deterministic. Use linkstamping instead of these
720 # compiler symbols.
721 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
722 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
723 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
724 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
725
726 # Security hardening on by default.
727 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
728 # We need to undef it before redefining it as some distributions now have
729 # it enabled by default.
730 compiler_flag: "-U_FORTIFY_SOURCE"
731 compiler_flag: "-fstack-protector"
732 compiler_flag: "-fPIE"
733 linker_flag: "-pie"
734 linker_flag: "-Wl,-z,relro,-z,now"
735
736 # Pretty much everything needs this, including parts of the glibc STL...
737 linker_flag: "-lm"
738
739 # Enable coloring even if there's no attached terminal. Bazel removes the
740 # escape sequences if --nocolor is specified.
741 compiler_flag: "-fdiagnostics-color=always"
742
743 compiler_flag: "-Wall"
744 compiler_flag: "-Wextra"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500745 compiler_flag: "-Wpointer-arith"
746 compiler_flag: "-Wstrict-aliasing"
747 compiler_flag: "-Wcast-qual"
748 compiler_flag: "-Wcast-align"
749 compiler_flag: "-Wwrite-strings"
750 compiler_flag: "-Wtype-limits"
751 compiler_flag: "-Wsign-compare"
752 compiler_flag: "-Wformat=2"
753 compiler_flag: "-Werror"
754 compiler_flag: "-Wunused-local-typedefs"
755
756 # Keep stack frames for debugging, even in opt mode.
757 compiler_flag: "-fno-omit-frame-pointer"
758
759 # Don't use temp files while compiling.
760 compiler_flag: "-pipe"
761
762 # Stamp the binary with a unique identifier.
763 linker_flag: "-Wl,--build-id=md5"
764 linker_flag: "-Wl,--hash-style=gnu"
765 #linker_flag: "-Wl,--warn-execstack"
766 #linker_flag: "-Wl,--detect-odr-violations"
767
768 # Enable debug symbols.
769 compiler_flag: "-ggdb3"
770
771 compilation_mode_flags {
772 mode: OPT
773
774 compiler_flag: "-O2"
775
776 # Disable assertions
777 compiler_flag: "-DNDEBUG"
778 compiler_flag: "-D_FORTIFY_SOURCE=1"
779
780 # Removal of unused code and data at link time (can this increase binary size in some cases?).
781 compiler_flag: "-ffunction-sections"
782 compiler_flag: "-fdata-sections"
783 linker_flag: "-Wl,--gc-sections"
784 }
785}
Brian Silverman8b638692017-06-26 23:10:26 -0700786
787toolchain {
788 abi_version: "cortex-m4f"
789 abi_libc_version: "cortex-m4f"
790 builtin_sysroot: ""
791 compiler: "gcc"
792 host_system_name: "local"
793 needsPic: false
794 supports_gold_linker: false
795 supports_incremental_linker: false
796 supports_fission: false
797 supports_interface_shared_objects: false
798 supports_normalizing_ar: false
799 supports_start_end_lib: false
800 supports_thin_archives: false
801 target_libc: "cortex-m4f"
802 target_cpu: "cortex-m4f"
803 target_system_name: "cortex-m4f"
804 toolchain_identifier: "cortex-m4f"
805
806 tool_path { name: "ar" path: "/usr/bin/arm-none-eabi-ar" }
807 tool_path { name: "compat-ld" path: "/usr/bin/arm-none-eabi-ld" }
808 tool_path { name: "cpp" path: "/usr/bin/arm-none-eabi-cpp" }
809 tool_path { name: "dwp" path: "/usr/bin/arm-none-eabi-dwp" }
810 tool_path { name: "gcc" path: "/usr/bin/arm-none-eabi-gcc" }
811 tool_path { name: "gcov" path: "/usr/bin/arm-none-eabi-gcov" }
812 # C(++) compiles invoke the compiler (as that is the one knowing where
813 # to find libraries), but we provide LD so other rules can invoke the linker.
814 tool_path { name: "ld" path: "/usr/bin/arm-none-eabi-ld" }
815 tool_path { name: "nm" path: "/usr/bin/arm-none-eabi-nm" }
816 tool_path { name: "objcopy" path: "/usr/bin/arm-none-eabi-objcopy" }
817 objcopy_embed_flag: "-I"
818 objcopy_embed_flag: "binary"
819 tool_path { name: "objdump" path: "/usr/bin/arm-none-eabi-objdump" }
820 tool_path { name: "strip" path: "/usr/bin/arm-none-eabi-strip" }
821 linking_mode_flags { mode: FULLY_STATIC }
822
823 # TODO(bazel-team): In theory, the path here ought to exactly match the path
824 # used by gcc. That works because bazel currently doesn't track files at
825 # absolute locations and has no remote execution, yet. However, this will need
826 # to be fixed, maybe with auto-detection?
827 cxx_builtin_include_directory: '/usr/lib/gcc/arm-none-eabi/4.8/include'
828 cxx_builtin_include_directory: '/usr/lib/gcc/arm-none-eabi/4.8/include-fixed'
829 cxx_builtin_include_directory: '/usr/lib/arm-none-eabi/include'
830 cxx_builtin_include_directory: '/usr/include/newlib',
831
832 feature {
833 name: "dbg"
834 implies: "all_modes"
835 flag_set {
836 action: "preprocess-assemble"
837 action: "c-compile"
838 action: "c++-compile"
839 action: "c++-header-parsing"
840 action: "c++-header-preprocessing"
841 action: "c++-module-compile"
842 flag_group {
843 flag: "-fno-omit-frame-pointer"
844 }
845 }
846 }
847
848 feature {
849 name: "opt"
850 implies: "all_modes"
851 }
852 feature {
853 name: "fastbuild"
854 implies: "all_modes"
855 }
856
857 feature {
858 name: "all_modes"
859 flag_set {
860 action: "preprocess-assemble"
861 action: "assemble"
862 action: "c-compile"
863 flag_group {
864 flag: "--std=gnu99"
865 }
866 }
867 flag_set {
868 action: "c++-compile"
869 action: "c++-header-parsing"
870 action: "c++-header-preprocessing"
871 action: "c++-module-compile"
872 flag_group {
873 flag: "--std=gnu++11"
874 flag: "-fno-exceptions"
875 flag: "-fno-rtti"
876 }
877 }
878 }
879
880 # Anticipated future default.
881 # This makes GCC and Clang do what we want when called through symlinks.
882 unfiltered_cxx_flag: "-no-canonical-prefixes"
883 linker_flag: "-no-canonical-prefixes"
884
885 # Things that the code wants defined.
886 compiler_flag: "-D__STDC_FORMAT_MACROS"
887 compiler_flag: "-D__STDC_CONSTANT_MACROS"
888 compiler_flag: "-D__STDC_LIMIT_MACROS"
Brian Silvermanf91524f2017-09-23 13:15:55 -0400889
890 # Some identifiers for what MCU we're using.
Brian Silverman8b638692017-06-26 23:10:26 -0700891 compiler_flag: "-D__MK64FX512__"
892 compiler_flag: "-DF_CPU=120000000"
Brian Silvermanf91524f2017-09-23 13:15:55 -0400893
Brian Silverman8b638692017-06-26 23:10:26 -0700894 compiler_flag: "-Wl,--gc-sections"
895
Brian Silvermanf91524f2017-09-23 13:15:55 -0400896 # Newlib's stdint.h does this, but GCC's freestanding stdint.h doesn't use
897 # newlib's so we have to do it manually...
898 compiler_flag: "-D__have_long32"
899
Brian Silverman8b638692017-06-26 23:10:26 -0700900 # Make C++ compilation deterministic. Use linkstamping instead of these
901 # compiler symbols.
902 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
903 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
904 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
905 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
906
907 # Security hardening on by default.
908 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
909 # We need to undef it before redefining it as some distributions now have
910 # it enabled by default.
911 compiler_flag: "-fstack-protector"
912 compiler_flag: "-mcpu=cortex-m4"
913 compiler_flag: "-mfpu=fpv4-sp-d16"
914 compiler_flag: "-mthumb"
915 compiler_flag: "-mfloat-abi=hard"
916 compiler_flag: "-fno-strict-aliasing"
917 linker_flag: "-mcpu=cortex-m4"
918 linker_flag: "-mfpu=fpv4-sp-d16"
919 linker_flag: "-mthumb"
920 linker_flag: "-mfloat-abi=hard"
921 linker_flag: "-fno-strict-aliasing"
922 linker_flag: "--specs=nano.specs"
923
924 # Pretty much everything needs this, including parts of the glibc STL...
925 linker_flag: "-lgcc"
926 linker_flag: "-lstdc++"
927 linker_flag: "-lm"
928 linker_flag: "-lc"
929 linker_flag: "-Tmotors/core/mk64fx512.ld"
930
931 compiler_flag: "-fmessage-length=80"
Brian Silvermanf91524f2017-09-23 13:15:55 -0400932 compiler_flag: "-fmax-errors=20"
Brian Silverman8b638692017-06-26 23:10:26 -0700933
934 compiler_flag: "-Wall"
935 compiler_flag: "-Wextra"
Brian Silverman8b638692017-06-26 23:10:26 -0700936 compiler_flag: "-Wpointer-arith"
937 compiler_flag: "-Wcast-qual"
938 compiler_flag: "-Wwrite-strings"
939 compiler_flag: "-Wtype-limits"
940 compiler_flag: "-Wsign-compare"
941 compiler_flag: "-Wformat=2"
942 compiler_flag: "-Werror"
943 compiler_flag: "-Wstrict-aliasing=2"
944
945 # Be annoying about using doubles places we probably didn't mean to, because
946 # the FPU only does single-precision.
947 compiler_flag: "-Wdouble-promotion"
948
949 # Don't use temp files while compiling.
950 compiler_flag: "-pipe"
951
952 # Stamp the binary with a unique identifier.
953 # TODO(austin): Put these back in.
954 #linker_flag: "-Wl,--build-id=md5"
955 #linker_flag: "-Wl,--hash-style=gnu"
956
957 # Enable debug symbols.
958 compiler_flag: "-g"
959
Brian Silvermanf91524f2017-09-23 13:15:55 -0400960 # Common symbols are weird and not what we want, so just give multiple
Brian Silverman8b638692017-06-26 23:10:26 -0700961 # declaration errors instead.
962 compiler_flag: "-fno-common"
963
Brian Silvermanf91524f2017-09-23 13:15:55 -0400964 # We're not a hosted environment (no file IO, main is called from our code,
965 # etc).
966 compiler_flag: "-ffreestanding"
967 # However, we still want to optimize things like memcpy.
968 compiler_flag: "-fbuiltin"
969
Brian Silverman8b638692017-06-26 23:10:26 -0700970 compilation_mode_flags {
971 mode: OPT
972
973 # Freescale recommends this combination for reducing cycle count.
974 # http://www.nxp.com/assets/documents/data/en/application-notes/AN4808.pdf
975 compiler_flag: "-O2"
976 compiler_flag: "-finline-functions"
977
978 # This is definitely worth it for us. It makes the FPU a lot more useful,
979 # especially with complex arithmetic, which matters a lot.
980 compiler_flag: "-ffast-math"
981
982 # It seems like this is a good idea, at least for the number crunching code.
983 # Might want to look into moving it to copts on specific rules if the code
984 # size increase becomes a problem.
985 compiler_flag: "-funroll-loops"
986
987 # Disable assertions
988 compiler_flag: "-DNDEBUG"
989
990 # Removal of unused code and data at link time (can this increase binary size in some cases?).
991 compiler_flag: "-ffunction-sections"
992 #compiler_flag: "-fdata-sections"
993 linker_flag: "-Wl,--gc-sections"
994 }
995
996 feature {
997 name: 'include_paths'
998 flag_set {
999 action: 'preprocess-assemble'
1000 action: 'c-compile'
1001 action: 'c++-compile'
1002 action: 'c++-header-parsing'
1003 action: 'c++-header-preprocessing'
1004 action: 'c++-module-compile'
1005 flag_group {
Brian Silvermanf91524f2017-09-23 13:15:55 -04001006 iterate_over: 'quote_include_paths'
Brian Silverman8b638692017-06-26 23:10:26 -07001007 flag: '-iquote'
1008 flag: '%{quote_include_paths}'
1009 }
1010 flag_group {
Brian Silvermanf91524f2017-09-23 13:15:55 -04001011 iterate_over: 'include_paths'
Brian Silverman8b638692017-06-26 23:10:26 -07001012 flag: '-I%{include_paths}'
1013 }
1014 flag_group {
Brian Silvermanf91524f2017-09-23 13:15:55 -04001015 iterate_over: 'system_include_paths'
Brian Silverman8b638692017-06-26 23:10:26 -07001016 flag: '-iquote'
1017 flag: '%{system_include_paths}'
1018 }
1019 }
1020 }
1021}