blob: 55abdc401324c13105c2d735d6f0ebc99e0fa25c [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"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400231 linker_flag: "-Wl,-z,relro,-z,now"
232
233 # Pretty much everything needs this, including parts of the glibc STL...
234 linker_flag: "-lm"
235
236 # Enable coloring even if there's no attached terminal. Bazel removes the
237 # escape sequences if --nocolor is specified.
238 compiler_flag: "-fcolor-diagnostics"
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500239 compiler_flag: "-fmessage-length=80"
240 compiler_flag: "-fmacro-backtrace-limit=0"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400241
242 compiler_flag: "-Wall"
243 compiler_flag: "-Wextra"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400244 compiler_flag: "-Wpointer-arith"
Brian Silverman594be0d2015-10-31 17:56:23 -0400245 compiler_flag: "-Wstrict-aliasing"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400246 compiler_flag: "-Wcast-qual"
247 compiler_flag: "-Wcast-align"
248 compiler_flag: "-Wwrite-strings"
249 compiler_flag: "-Wtype-limits"
250 compiler_flag: "-Wsign-compare"
251 compiler_flag: "-Wformat=2"
252 compiler_flag: "-Werror"
253
254 # Keep stack frames for debugging, even in opt mode.
255 compiler_flag: "-fno-omit-frame-pointer"
256
257 # Don't use temp files while compiling.
258 compiler_flag: "-pipe"
259
Brian Silverman12b3fc52015-10-11 19:38:33 -0400260 # Stamp the binary with a unique identifier.
261 linker_flag: "-Wl,--build-id=md5"
262 linker_flag: "-Wl,--hash-style=gnu"
263 linker_flag: "-Wl,--warn-execstack"
264 linker_flag: "-Wl,--detect-odr-violations"
265
Brian Silvermand2540402015-11-28 18:35:00 -0500266 # Enable debug symbols.
267 compiler_flag: "-ggdb3"
268
Brian Silverman12b3fc52015-10-11 19:38:33 -0400269 compilation_mode_flags {
270 mode: OPT
271
Austin Schuha20ae722015-11-01 12:29:38 -0800272 compiler_flag: "-O2"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400273
274 # Disable assertions
275 compiler_flag: "-DNDEBUG"
276
277 # Removal of unused code and data at link time (can this increase binary size in some cases?).
278 compiler_flag: "-ffunction-sections"
279 compiler_flag: "-fdata-sections"
280 linker_flag: "-Wl,--gc-sections"
281 }
Austin Schuh137d9452018-07-07 15:42:36 -0700282 feature {
283 name: "pie_for_linking"
284 enabled: true
285 flag_set {
286 action: "c++-link-executable"
287 flag_group {
288 flag: "-pie"
289 }
290 }
291 }
Brian Silverman12b3fc52015-10-11 19:38:33 -0400292}
Austin Schuh23da18b2015-10-11 20:52:49 -0700293
294toolchain {
295 abi_version: "roborio"
296 abi_libc_version: "roborio"
297 builtin_sysroot: ""
298 compiler: "gcc"
299 host_system_name: "roborio"
300 needsPic: true
301 supports_gold_linker: false
302 supports_incremental_linker: false
303 supports_fission: false
304 supports_interface_shared_objects: false
305 supports_normalizing_ar: false
306 supports_start_end_lib: false
307 supports_thin_archives: false
308 target_libc: "roborio"
309 target_cpu: "roborio"
310 target_system_name: "roborio"
311 toolchain_identifier: "roborio_linux"
312
Austin Schuh55139fe2015-10-14 23:55:24 -0700313 tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" }
314 tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
315 tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" }
316 tool_path { name: "dwp" path: "/bin/false" }
317 tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" }
318 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
Austin Schuh23da18b2015-10-11 20:52:49 -0700319 # C(++) compiles invoke the compiler (as that is the one knowing where
320 # to find libraries), but we provide LD so other rules can invoke the linker.
Austin Schuh55139fe2015-10-14 23:55:24 -0700321 tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
322 tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" }
323 tool_path { name: "objcopy" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy" }
Austin Schuh23da18b2015-10-11 20:52:49 -0700324 objcopy_embed_flag: "-I"
325 objcopy_embed_flag: "binary"
Austin Schuh55139fe2015-10-14 23:55:24 -0700326 tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" }
327 tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" }
Brian Silverman6d350402016-03-05 01:15:46 -0500328 linking_mode_flags { mode: DYNAMIC }
Austin Schuh23da18b2015-10-11 20:52:49 -0700329
Brian Silverman826e1cd2016-01-31 18:26:00 -0500330 compiler_flag: "--sysroot=external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi"
Austin Schuh044e18b2015-10-21 20:17:09 -0700331 compiler_flag: "-nostdinc"
332 compiler_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700333 compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include",
Austin Schuh044e18b2015-10-21 20:17:09 -0700334 compiler_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700335 compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include-fixed"
Austin Schuh044e18b2015-10-21 20:17:09 -0700336 compiler_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500337 compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/usr/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700338
339 cxx_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700340 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/5.4.0"
Austin Schuh044e18b2015-10-21 20:17:09 -0700341 cxx_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700342 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/5.4.0/arm-frc-linux-gnueabi"
Austin Schuh044e18b2015-10-21 20:17:09 -0700343 cxx_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700344 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/5.4.0/backward"
Austin Schuh044e18b2015-10-21 20:17:09 -0700345 cxx_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700346 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700347 cxx_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700348 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include-fixed"
Austin Schuh044e18b2015-10-21 20:17:09 -0700349 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500350 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700351 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500352 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/usr/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700353
Austin Schuh23da18b2015-10-11 20:52:49 -0700354 # TODO(bazel-team): In theory, the path here ought to exactly match the path
355 # used by gcc. That works because bazel currently doesn't track files at
356 # absolute locations and has no remote execution, yet. However, this will need
357 # to be fixed, maybe with auto-detection?
Austin Schuh94f51e92017-10-30 19:25:32 -0700358 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/5.4.0"
359 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/5.4.0/arm-frc-linux-gnueabi"
360 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/5.4.0/backward"
361 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include)%"
362 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include-fixed)%"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500363 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%"
364 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/usr/include)%"
Austin Schuh23da18b2015-10-11 20:52:49 -0700365
366 linker_flag: "-lstdc++"
Brian Silvermanb200c172017-01-02 17:35:35 -0800367 linker_flag: "-Ltools/cpp/arm-frc-linux-gnueabi/libs"
Austin Schuh23da18b2015-10-11 20:52:49 -0700368
369 feature {
370 name: "opt"
371 implies: "all_modes"
372 flag_set {
373 action: "preprocess-assemble"
374 action: "c-compile"
375 action: "c++-compile"
376 action: "c++-header-parsing"
377 action: "c++-header-preprocessing"
378 action: "c++-module-compile"
379 flag_group {
380 flag: "-DAOS_DEBUG=0"
381 }
382 }
383 }
384
385 feature {
386 name: "dbg"
387 implies: "all_modes"
388 flag_set {
389 action: "preprocess-assemble"
390 action: "c-compile"
391 action: "c++-compile"
392 action: "c++-header-parsing"
393 action: "c++-header-preprocessing"
394 action: "c++-module-compile"
395 flag_group {
396 flag: "-DAOS_DEBUG=1"
397 }
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500398 flag_group {
399 flag: "-fno-omit-frame-pointer"
400 }
Austin Schuh23da18b2015-10-11 20:52:49 -0700401 }
402 }
403
404 feature {
405 name: "fastbuild"
406 implies: "all_modes"
407 flag_set {
408 action: "preprocess-assemble"
409 action: "c-compile"
410 action: "c++-compile"
411 action: "c++-header-parsing"
412 action: "c++-header-preprocessing"
413 action: "c++-module-compile"
414 flag_group {
415 flag: "-DAOS_DEBUG=0"
416 }
417 }
418 }
419
420 feature {
421 name: "all_modes"
422 flag_set {
Austin Schuh23da18b2015-10-11 20:52:49 -0700423 action: "preprocess-assemble"
424 action: "assemble"
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500425 action: "c-compile"
Austin Schuh23da18b2015-10-11 20:52:49 -0700426 flag_group {
427 flag: "-std=gnu99"
428 }
429 }
430 flag_set {
431 action: "c++-compile"
432 action: "c++-header-parsing"
433 action: "c++-header-preprocessing"
434 action: "c++-module-compile"
435 flag_group {
436 flag: "-std=gnu++1y"
437 }
438 }
439 flag_set {
440 action: "preprocess-assemble"
441 action: "assemble"
442 action: "c++-link"
443 action: "c++-compile"
444 action: "c++-header-parsing"
445 action: "c++-header-preprocessing"
446 action: "c++-module-compile"
447 action: "c-compile"
448 flag_group {
449 # We always want to compile with -pthread semantics.
450 flag: "-pthread"
451 }
452 }
453 }
454
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500455 compiler_flag: "-mfpu=neon"
456 # TODO(brians): See if it will run with this enabled.
457 #compiler_flag: "-mhwdiv=arm,thumb"
458
Austin Schuh23da18b2015-10-11 20:52:49 -0700459 # Anticipated future default.
460 # This makes GCC and Clang do what we want when called through symlinks.
461 unfiltered_cxx_flag: "-no-canonical-prefixes"
462 linker_flag: "-no-canonical-prefixes"
463
464 # Things that the code wants defined.
465 compiler_flag: "-D__STDC_FORMAT_MACROS"
466 compiler_flag: "-D__STDC_CONSTANT_MACROS"
467 compiler_flag: "-D__STDC_LIMIT_MACROS"
468 compiler_flag: "-D_FILE_OFFSET_BITS=64"
469 # TODO(Brian): Rename this or something.
Austin Schuha20ae722015-11-01 12:29:38 -0800470 compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
Austin Schuh23da18b2015-10-11 20:52:49 -0700471
472 #linker_flag: "-fuse-ld=gold"
473
Austin Schuh23da18b2015-10-11 20:52:49 -0700474 # Make C++ compilation deterministic. Use linkstamping instead of these
475 # compiler symbols.
476 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
477 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
478 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
479 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
480
481 # Security hardening on by default.
482 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
483 # We need to undef it before redefining it as some distributions now have
484 # it enabled by default.
485 compiler_flag: "-U_FORTIFY_SOURCE"
486 compiler_flag: "-fstack-protector"
487 compiler_flag: "-fPIE"
Austin Schuh23da18b2015-10-11 20:52:49 -0700488 linker_flag: "-Wl,-z,relro,-z,now"
489
490 # Pretty much everything needs this, including parts of the glibc STL...
491 linker_flag: "-lm"
492
493 # Enable coloring even if there's no attached terminal. Bazel removes the
494 # escape sequences if --nocolor is specified.
495 compiler_flag: "-fdiagnostics-color=always"
496
497 compiler_flag: "-Wall"
498 compiler_flag: "-Wextra"
Austin Schuh23da18b2015-10-11 20:52:49 -0700499 compiler_flag: "-Wpointer-arith"
Brian Silverman594be0d2015-10-31 17:56:23 -0400500 compiler_flag: "-Wstrict-aliasing"
Austin Schuh23da18b2015-10-11 20:52:49 -0700501 compiler_flag: "-Wcast-qual"
502 compiler_flag: "-Wcast-align"
503 compiler_flag: "-Wwrite-strings"
504 compiler_flag: "-Wtype-limits"
505 compiler_flag: "-Wsign-compare"
506 compiler_flag: "-Wformat=2"
507 compiler_flag: "-Werror"
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500508 compiler_flag: "-Wunused-local-typedefs"
Austin Schuh23da18b2015-10-11 20:52:49 -0700509
510 # Keep stack frames for debugging, even in opt mode.
511 compiler_flag: "-fno-omit-frame-pointer"
512 compiler_flag: "-D__has_feature(x)=0"
513
514 # Don't use temp files while compiling.
515 compiler_flag: "-pipe"
516
517 # Have GCC return the exit code from ld.
518 linker_flag: "-pass-exit-codes"
519
520 # Stamp the binary with a unique identifier.
521 linker_flag: "-Wl,--build-id=md5"
522 linker_flag: "-Wl,--hash-style=gnu"
523 #linker_flag: "-Wl,--warn-execstack"
524 #linker_flag: "-Wl,--detect-odr-violations"
525
Brian Silvermand2540402015-11-28 18:35:00 -0500526 # Enable debug symbols.
527 compiler_flag: "-ggdb3"
528
Austin Schuh23da18b2015-10-11 20:52:49 -0700529 compilation_mode_flags {
530 mode: OPT
531
Brian Silverman594be0d2015-10-31 17:56:23 -0400532 compiler_flag: "-O2"
Austin Schuh23da18b2015-10-11 20:52:49 -0700533
534 # Disable assertions
535 compiler_flag: "-DNDEBUG"
536 compiler_flag: "-D_FORTIFY_SOURCE=1"
537
538 # Removal of unused code and data at link time (can this increase binary size in some cases?).
539 compiler_flag: "-ffunction-sections"
540 compiler_flag: "-fdata-sections"
541 linker_flag: "-Wl,--gc-sections"
542 }
Austin Schuh137d9452018-07-07 15:42:36 -0700543 feature {
544 name: "pie_for_linking"
545 enabled: true
546 flag_set {
547 action: "c++-link-executable"
548 flag_group {
549 flag: "-pie"
550 }
551 }
552 }
Austin Schuh23da18b2015-10-11 20:52:49 -0700553}
Brian Silverman0d57fc82016-01-24 21:02:53 -0500554
555toolchain {
556 abi_version: "clang_3.6"
557 abi_libc_version: "glibc_2.19"
558 builtin_sysroot: ""
559 compiler: "clang"
Brian Silverman4bde3e52018-02-17 23:57:09 -0500560 host_system_name: "linux"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500561 needsPic: true
562 supports_gold_linker: false
563 supports_incremental_linker: false
564 supports_fission: false
565 supports_interface_shared_objects: false
566 supports_normalizing_ar: true
567 supports_start_end_lib: false
568 supports_thin_archives: true
569 target_libc: "glibc_2.19"
570 target_cpu: "armhf-debian"
571 target_system_name: "arm_a15"
572 toolchain_identifier: "clang_linux_armhf"
573
574 tool_path { name: "ar" path: "linaro_linux_gcc/arm-linux-gnueabihf-ar" }
575 tool_path { name: "compat-ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
576 tool_path { name: "cpp" path: "linaro_linux_gcc/clang_bin/clang" }
577 tool_path { name: "dwp" path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp" }
578 tool_path { name: "gcc" path: "linaro_linux_gcc/clang_bin/clang" }
579 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
580 # C(++) compiles invoke the compiler (as that is the one knowing where
581 # to find libraries), but we provide LD so other rules can invoke the linker.
582 tool_path { name: "ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
583 tool_path { name: "nm" path: "linaro_linux_gcc/arm-linux-gnueabihf-nm" }
584 tool_path { name: "objcopy" path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy" }
585 objcopy_embed_flag: "-I"
586 objcopy_embed_flag: "binary"
587 tool_path { name: "objdump" path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump" }
588 tool_path { name: "strip" path: "linaro_linux_gcc/arm-linux-gnueabihf-strip" }
Brian Silverman6d350402016-03-05 01:15:46 -0500589 linking_mode_flags { mode: DYNAMIC }
Brian Silverman0d57fc82016-01-24 21:02:53 -0500590
591 compiler_flag: "-target"
592 compiler_flag: "armv7a-arm-linux-gnueabif"
Austin Schuh61660832016-03-04 21:56:39 -0800593 compiler_flag: "--sysroot=external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500594 compiler_flag: "-mfloat-abi=hard"
595 compiler_flag: "-mfpu=vfpv3-d16"
596
597 compiler_flag: "-nostdinc"
598 compiler_flag: "-isystem"
599 compiler_flag: "/usr/lib/clang/3.6/include"
600 compiler_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800601 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 -0500602 compiler_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800603 compiler_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/usr/include"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500604 compiler_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800605 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 -0500606 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800607 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 -0500608 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800609 cxx_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/include/c++/4.9.3"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500610 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800611 cxx_flag: "external/linaro_linux_gcc_4_9_repo/include/c++/4.9.3/arm-linux-gnueabihf"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500612 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800613 cxx_flag: "external/linaro_linux_gcc_4_9_repo/include/c++/4.9.3"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500614
Austin Schuh61660832016-03-04 21:56:39 -0800615 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//include)%"
616 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/usr/include)%"
617 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/usr/lib/include)%"
618 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)%"
619 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//include)%/c++/4.9.3"
620 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/4.9.3/include)%"
621 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)%"
622 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//lib/gcc/arm-linux-gnueabihf/4.9.3/include)%"
623 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed)%"
624 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 -0500625 cxx_builtin_include_directory: '/usr/lib/clang/3.6/include'
626
627 linker_flag: "-target"
628 linker_flag: "armv7a-arm-linux-gnueabif"
Austin Schuh61660832016-03-04 21:56:39 -0800629 linker_flag: "--sysroot=external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500630 linker_flag: "-lstdc++"
631 linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs"
Austin Schuh61660832016-03-04 21:56:39 -0800632 linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/lib"
633 linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/lib"
634 linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/usr/lib"
635 linker_flag: "-Bexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/bin"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500636 linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3"
637
638 feature {
639 name: "opt"
640 implies: "all_modes"
641 flag_set {
642 action: "preprocess-assemble"
643 action: "c-compile"
644 action: "c++-compile"
645 action: "c++-header-parsing"
646 action: "c++-header-preprocessing"
647 action: "c++-module-compile"
648 flag_group {
649 flag: "-DAOS_DEBUG=0"
650 }
651 }
652 }
653
654 feature {
655 name: "dbg"
656 implies: "all_modes"
657 flag_set {
658 action: "preprocess-assemble"
659 action: "c-compile"
660 action: "c++-compile"
661 action: "c++-header-parsing"
662 action: "c++-header-preprocessing"
663 action: "c++-module-compile"
664 flag_group {
665 flag: "-DAOS_DEBUG=1"
666 }
667 flag_group {
668 flag: "-fno-omit-frame-pointer"
669 }
670 }
671 }
672
673 feature {
674 name: "fastbuild"
675 implies: "all_modes"
676 flag_set {
677 action: "preprocess-assemble"
678 action: "c-compile"
679 action: "c++-compile"
680 action: "c++-header-parsing"
681 action: "c++-header-preprocessing"
682 action: "c++-module-compile"
683 flag_group {
684 flag: "-DAOS_DEBUG=0"
685 }
686 }
687 }
688
689 feature {
690 name: "all_modes"
691 flag_set {
692 action: "preprocess-assemble"
693 action: "assemble"
694 action: "c-compile"
695 flag_group {
696 flag: "-std=gnu99"
697 }
698 }
699 flag_set {
700 action: "c++-compile"
701 action: "c++-header-parsing"
702 action: "c++-header-preprocessing"
703 action: "c++-module-compile"
704 flag_group {
705 flag: "-std=gnu++1y"
706 }
707 }
708 flag_set {
709 action: "preprocess-assemble"
710 action: "assemble"
711 action: "c++-link"
712 action: "c++-compile"
713 action: "c++-header-parsing"
714 action: "c++-header-preprocessing"
715 action: "c++-module-compile"
716 action: "c-compile"
717 flag_group {
718 # We always want to compile with -pthread semantics.
719 flag: "-pthread"
720 }
721 }
722 }
723
724 # Anticipated future default.
725 # This makes GCC and Clang do what we want when called through symlinks.
726 unfiltered_cxx_flag: "-no-canonical-prefixes"
727 linker_flag: "-no-canonical-prefixes"
728
729 # Things that the code wants defined.
730 compiler_flag: "-D__STDC_FORMAT_MACROS"
731 compiler_flag: "-D__STDC_CONSTANT_MACROS"
732 compiler_flag: "-D__STDC_LIMIT_MACROS"
733 compiler_flag: "-D_FILE_OFFSET_BITS=64"
734 # TODO(Brian): Rename this or something.
735 compiler_flag: "-DAOS_ARCHITECTURE_armhf"
736
737 # Make C++ compilation deterministic. Use linkstamping instead of these
738 # compiler symbols.
739 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
740 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
741 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
742 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
743
744 # Security hardening on by default.
745 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
746 # We need to undef it before redefining it as some distributions now have
747 # it enabled by default.
748 compiler_flag: "-U_FORTIFY_SOURCE"
749 compiler_flag: "-fstack-protector"
750 compiler_flag: "-fPIE"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500751 linker_flag: "-Wl,-z,relro,-z,now"
752
753 # Pretty much everything needs this, including parts of the glibc STL...
754 linker_flag: "-lm"
755
756 # Enable coloring even if there's no attached terminal. Bazel removes the
757 # escape sequences if --nocolor is specified.
758 compiler_flag: "-fdiagnostics-color=always"
759
760 compiler_flag: "-Wall"
761 compiler_flag: "-Wextra"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500762 compiler_flag: "-Wpointer-arith"
763 compiler_flag: "-Wstrict-aliasing"
764 compiler_flag: "-Wcast-qual"
765 compiler_flag: "-Wcast-align"
766 compiler_flag: "-Wwrite-strings"
767 compiler_flag: "-Wtype-limits"
768 compiler_flag: "-Wsign-compare"
769 compiler_flag: "-Wformat=2"
770 compiler_flag: "-Werror"
771 compiler_flag: "-Wunused-local-typedefs"
772
773 # Keep stack frames for debugging, even in opt mode.
774 compiler_flag: "-fno-omit-frame-pointer"
775
776 # Don't use temp files while compiling.
777 compiler_flag: "-pipe"
778
779 # Stamp the binary with a unique identifier.
780 linker_flag: "-Wl,--build-id=md5"
781 linker_flag: "-Wl,--hash-style=gnu"
782 #linker_flag: "-Wl,--warn-execstack"
783 #linker_flag: "-Wl,--detect-odr-violations"
784
785 # Enable debug symbols.
786 compiler_flag: "-ggdb3"
787
788 compilation_mode_flags {
789 mode: OPT
790
791 compiler_flag: "-O2"
792
793 # Disable assertions
794 compiler_flag: "-DNDEBUG"
795 compiler_flag: "-D_FORTIFY_SOURCE=1"
796
797 # Removal of unused code and data at link time (can this increase binary size in some cases?).
798 compiler_flag: "-ffunction-sections"
799 compiler_flag: "-fdata-sections"
800 linker_flag: "-Wl,--gc-sections"
801 }
Austin Schuh137d9452018-07-07 15:42:36 -0700802 feature {
803 name: "pie_for_linking"
804 enabled: true
805 flag_set {
806 action: "c++-link-executable"
807 flag_group {
808 flag: "-pie"
809 }
810 }
811 }
Brian Silverman0d57fc82016-01-24 21:02:53 -0500812}
Brian Silverman8b638692017-06-26 23:10:26 -0700813
814toolchain {
815 abi_version: "cortex-m4f"
816 abi_libc_version: "cortex-m4f"
817 builtin_sysroot: ""
818 compiler: "gcc"
819 host_system_name: "local"
820 needsPic: false
821 supports_gold_linker: false
822 supports_incremental_linker: false
823 supports_fission: false
824 supports_interface_shared_objects: false
825 supports_normalizing_ar: false
826 supports_start_end_lib: false
827 supports_thin_archives: false
828 target_libc: "cortex-m4f"
829 target_cpu: "cortex-m4f"
830 target_system_name: "cortex-m4f"
831 toolchain_identifier: "cortex-m4f"
832
833 tool_path { name: "ar" path: "/usr/bin/arm-none-eabi-ar" }
834 tool_path { name: "compat-ld" path: "/usr/bin/arm-none-eabi-ld" }
835 tool_path { name: "cpp" path: "/usr/bin/arm-none-eabi-cpp" }
836 tool_path { name: "dwp" path: "/usr/bin/arm-none-eabi-dwp" }
837 tool_path { name: "gcc" path: "/usr/bin/arm-none-eabi-gcc" }
838 tool_path { name: "gcov" path: "/usr/bin/arm-none-eabi-gcov" }
839 # C(++) compiles invoke the compiler (as that is the one knowing where
840 # to find libraries), but we provide LD so other rules can invoke the linker.
841 tool_path { name: "ld" path: "/usr/bin/arm-none-eabi-ld" }
842 tool_path { name: "nm" path: "/usr/bin/arm-none-eabi-nm" }
843 tool_path { name: "objcopy" path: "/usr/bin/arm-none-eabi-objcopy" }
844 objcopy_embed_flag: "-I"
845 objcopy_embed_flag: "binary"
846 tool_path { name: "objdump" path: "/usr/bin/arm-none-eabi-objdump" }
847 tool_path { name: "strip" path: "/usr/bin/arm-none-eabi-strip" }
848 linking_mode_flags { mode: FULLY_STATIC }
849
850 # TODO(bazel-team): In theory, the path here ought to exactly match the path
851 # used by gcc. That works because bazel currently doesn't track files at
852 # absolute locations and has no remote execution, yet. However, this will need
853 # to be fixed, maybe with auto-detection?
854 cxx_builtin_include_directory: '/usr/lib/gcc/arm-none-eabi/4.8/include'
855 cxx_builtin_include_directory: '/usr/lib/gcc/arm-none-eabi/4.8/include-fixed'
856 cxx_builtin_include_directory: '/usr/lib/arm-none-eabi/include'
857 cxx_builtin_include_directory: '/usr/include/newlib',
858
859 feature {
860 name: "dbg"
861 implies: "all_modes"
862 flag_set {
863 action: "preprocess-assemble"
864 action: "c-compile"
865 action: "c++-compile"
866 action: "c++-header-parsing"
867 action: "c++-header-preprocessing"
868 action: "c++-module-compile"
869 flag_group {
870 flag: "-fno-omit-frame-pointer"
871 }
872 }
873 }
874
875 feature {
876 name: "opt"
877 implies: "all_modes"
878 }
879 feature {
880 name: "fastbuild"
881 implies: "all_modes"
882 }
883
884 feature {
885 name: "all_modes"
886 flag_set {
887 action: "preprocess-assemble"
888 action: "assemble"
889 action: "c-compile"
890 flag_group {
891 flag: "--std=gnu99"
892 }
893 }
894 flag_set {
895 action: "c++-compile"
896 action: "c++-header-parsing"
897 action: "c++-header-preprocessing"
898 action: "c++-module-compile"
899 flag_group {
900 flag: "--std=gnu++11"
901 flag: "-fno-exceptions"
902 flag: "-fno-rtti"
903 }
904 }
905 }
906
907 # Anticipated future default.
908 # This makes GCC and Clang do what we want when called through symlinks.
909 unfiltered_cxx_flag: "-no-canonical-prefixes"
910 linker_flag: "-no-canonical-prefixes"
911
912 # Things that the code wants defined.
913 compiler_flag: "-D__STDC_FORMAT_MACROS"
914 compiler_flag: "-D__STDC_CONSTANT_MACROS"
915 compiler_flag: "-D__STDC_LIMIT_MACROS"
Brian Silvermanf91524f2017-09-23 13:15:55 -0400916
917 # Some identifiers for what MCU we're using.
Brian Silverman8b638692017-06-26 23:10:26 -0700918 compiler_flag: "-D__MK64FX512__"
919 compiler_flag: "-DF_CPU=120000000"
Brian Silvermanf91524f2017-09-23 13:15:55 -0400920
Brian Silverman8b638692017-06-26 23:10:26 -0700921 compiler_flag: "-Wl,--gc-sections"
922
Brian Silvermanf91524f2017-09-23 13:15:55 -0400923 # Newlib's stdint.h does this, but GCC's freestanding stdint.h doesn't use
924 # newlib's so we have to do it manually...
925 compiler_flag: "-D__have_long32"
926
Brian Silverman8b638692017-06-26 23:10:26 -0700927 # Make C++ compilation deterministic. Use linkstamping instead of these
928 # compiler symbols.
929 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
930 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
931 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
932 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
933
934 # Security hardening on by default.
935 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
936 # We need to undef it before redefining it as some distributions now have
937 # it enabled by default.
938 compiler_flag: "-fstack-protector"
939 compiler_flag: "-mcpu=cortex-m4"
940 compiler_flag: "-mfpu=fpv4-sp-d16"
941 compiler_flag: "-mthumb"
942 compiler_flag: "-mfloat-abi=hard"
943 compiler_flag: "-fno-strict-aliasing"
944 linker_flag: "-mcpu=cortex-m4"
945 linker_flag: "-mfpu=fpv4-sp-d16"
946 linker_flag: "-mthumb"
947 linker_flag: "-mfloat-abi=hard"
948 linker_flag: "-fno-strict-aliasing"
949 linker_flag: "--specs=nano.specs"
950
951 # Pretty much everything needs this, including parts of the glibc STL...
952 linker_flag: "-lgcc"
953 linker_flag: "-lstdc++"
954 linker_flag: "-lm"
955 linker_flag: "-lc"
956 linker_flag: "-Tmotors/core/mk64fx512.ld"
957
958 compiler_flag: "-fmessage-length=80"
Brian Silvermanf91524f2017-09-23 13:15:55 -0400959 compiler_flag: "-fmax-errors=20"
Brian Silverman8b638692017-06-26 23:10:26 -0700960
961 compiler_flag: "-Wall"
962 compiler_flag: "-Wextra"
Brian Silverman8b638692017-06-26 23:10:26 -0700963 compiler_flag: "-Wpointer-arith"
964 compiler_flag: "-Wcast-qual"
965 compiler_flag: "-Wwrite-strings"
966 compiler_flag: "-Wtype-limits"
967 compiler_flag: "-Wsign-compare"
968 compiler_flag: "-Wformat=2"
969 compiler_flag: "-Werror"
970 compiler_flag: "-Wstrict-aliasing=2"
971
972 # Be annoying about using doubles places we probably didn't mean to, because
973 # the FPU only does single-precision.
974 compiler_flag: "-Wdouble-promotion"
975
976 # Don't use temp files while compiling.
977 compiler_flag: "-pipe"
978
979 # Stamp the binary with a unique identifier.
980 # TODO(austin): Put these back in.
981 #linker_flag: "-Wl,--build-id=md5"
982 #linker_flag: "-Wl,--hash-style=gnu"
983
984 # Enable debug symbols.
985 compiler_flag: "-g"
986
Brian Silvermanf91524f2017-09-23 13:15:55 -0400987 # Common symbols are weird and not what we want, so just give multiple
Brian Silverman8b638692017-06-26 23:10:26 -0700988 # declaration errors instead.
989 compiler_flag: "-fno-common"
990
Brian Silvermanf91524f2017-09-23 13:15:55 -0400991 # We're not a hosted environment (no file IO, main is called from our code,
992 # etc).
993 compiler_flag: "-ffreestanding"
994 # However, we still want to optimize things like memcpy.
995 compiler_flag: "-fbuiltin"
996
Brian Silverman8b638692017-06-26 23:10:26 -0700997 compilation_mode_flags {
998 mode: OPT
999
1000 # Freescale recommends this combination for reducing cycle count.
1001 # http://www.nxp.com/assets/documents/data/en/application-notes/AN4808.pdf
1002 compiler_flag: "-O2"
1003 compiler_flag: "-finline-functions"
1004
1005 # This is definitely worth it for us. It makes the FPU a lot more useful,
1006 # especially with complex arithmetic, which matters a lot.
1007 compiler_flag: "-ffast-math"
1008
1009 # It seems like this is a good idea, at least for the number crunching code.
1010 # Might want to look into moving it to copts on specific rules if the code
1011 # size increase becomes a problem.
1012 compiler_flag: "-funroll-loops"
1013
1014 # Disable assertions
1015 compiler_flag: "-DNDEBUG"
1016
1017 # Removal of unused code and data at link time (can this increase binary size in some cases?).
1018 compiler_flag: "-ffunction-sections"
1019 #compiler_flag: "-fdata-sections"
1020 linker_flag: "-Wl,--gc-sections"
1021 }
1022
1023 feature {
1024 name: 'include_paths'
1025 flag_set {
1026 action: 'preprocess-assemble'
1027 action: 'c-compile'
1028 action: 'c++-compile'
1029 action: 'c++-header-parsing'
1030 action: 'c++-header-preprocessing'
1031 action: 'c++-module-compile'
1032 flag_group {
Brian Silvermanf91524f2017-09-23 13:15:55 -04001033 iterate_over: 'quote_include_paths'
Brian Silverman8b638692017-06-26 23:10:26 -07001034 flag: '-iquote'
1035 flag: '%{quote_include_paths}'
1036 }
1037 flag_group {
Brian Silvermanf91524f2017-09-23 13:15:55 -04001038 iterate_over: 'include_paths'
Brian Silverman8b638692017-06-26 23:10:26 -07001039 flag: '-I%{include_paths}'
1040 }
1041 flag_group {
Brian Silvermanf91524f2017-09-23 13:15:55 -04001042 iterate_over: 'system_include_paths'
Brian Silverman6260c092018-01-14 15:21:36 -08001043 flag: '-I'
Brian Silverman8b638692017-06-26 23:10:26 -07001044 flag: '%{system_include_paths}'
1045 }
1046 }
1047 }
1048}