blob: 242485b25e9f58266938d3f5c29153b13558fb67 [file] [log] [blame]
Brian Silverman7b8899e2018-06-30 19:19:24 -07001major_version: "local"
2minor_version: ""
3default_target_cpu: "same_as_host"
4
5default_toolchain {
6 cpu: "roborio"
7 toolchain_identifier: "roborio_linux"
8}
9
10default_toolchain {
11 cpu: "k8"
12 toolchain_identifier: "k8_linux"
13}
14
15default_toolchain {
16 cpu: "armeabi-v7a"
17 toolchain_identifier: "stub_armeabi-v7a"
18}
19
20default_toolchain {
James Kuszmaul27da8142019-07-21 16:13:55 -070021 cpu: "web"
22 toolchain_identifier: "emscripten_toolchain"
23}
24
25default_toolchain {
Brian Silverman7b8899e2018-06-30 19:19:24 -070026 cpu: "armhf-debian"
27 toolchain_identifier: "clang_linux_armhf"
28}
29
30default_toolchain {
31 cpu: "cortex-m4f"
32 toolchain_identifier: "cortex-m4f"
33}
34
Brian Silverman6c8b88b2018-09-03 18:17:02 -070035default_toolchain {
36 cpu: "cortex-m4f-k22"
37 toolchain_identifier: "cortex-m4f-k22"
38}
39
Brian Silverman7b8899e2018-06-30 19:19:24 -070040toolchain {
James Kuszmaul3ae42262019-11-08 12:33:41 -080041 toolchain_identifier: "stub_armeabi-v7a"
Brian Silverman7b8899e2018-06-30 19:19:24 -070042 abi_version: "armeabi-v7a"
43 abi_libc_version: "armeabi-v7a"
44 builtin_sysroot: ""
45 compiler: "compiler"
46 host_system_name: "armeabi-v7a"
47 needsPic: true
48 supports_gold_linker: false
49 supports_incremental_linker: false
50 supports_fission: false
51 supports_interface_shared_objects: false
52 supports_normalizing_ar: false
53 supports_start_end_lib: false
54 supports_thin_archives: false
55 target_libc: "armeabi-v7a"
56 target_cpu: "armeabi-v7a"
57 target_system_name: "armeabi-v7a"
Brian Silverman7b8899e2018-06-30 19:19:24 -070058
59 tool_path { name: "ar" path: "/bin/false" }
60 tool_path { name: "compat-ld" path: "/bin/false" }
61 tool_path { name: "cpp" path: "/bin/false" }
62 tool_path { name: "dwp" path: "/bin/false" }
63 tool_path { name: "gcc" path: "/bin/false" }
64 tool_path { name: "gcov" path: "/bin/false" }
65 tool_path { name: "ld" path: "/bin/false" }
66
67 tool_path { name: "nm" path: "/bin/false" }
68 tool_path { name: "objcopy" path: "/bin/false" }
69 tool_path { name: "objdump" path: "/bin/false" }
70 tool_path { name: "strip" path: "/bin/false" }
71}
72
73toolchain {
74 abi_version: "local"
75 abi_libc_version: "local"
76 builtin_sysroot: ""
77 compiler: "clang"
78 host_system_name: "local"
79 needsPic: true
80 supports_gold_linker: false
81 supports_incremental_linker: false
82 supports_fission: false
83 supports_interface_shared_objects: false
84 supports_normalizing_ar: false
85 supports_start_end_lib: false
86 supports_thin_archives: false
87 target_libc: "local"
88 target_cpu: "k8"
89 target_system_name: "k8"
90 toolchain_identifier: "k8_linux"
91
92 # These paths are relative to //tools/cpp.
James Kuszmaul3ae42262019-11-08 12:33:41 -080093 tool_path { name: "ar" path: "clang_6p0/x86_64-linux-gnu-ar" }
94 tool_path { name: "compat-ld" path: "clang_6p0/x86_64-linux-gnu-ld" }
95 tool_path { name: "cpp" path: "clang_6p0/x86_64-linux-gnu-cpp" }
96 tool_path { name: "dwp" path: "clang_6p0/x86_64-linux-gnu-dwp" }
97 tool_path { name: "gcc" path: "clang_6p0/x86_64-linux-gnu-clang-6.0" }
98 tool_path { name: "gcov" path: "clang_6p0/x86_64-linux-gnu-gcov" }
Brian Silverman7b8899e2018-06-30 19:19:24 -070099 # C(++) compiles invoke the compiler (as that is the one knowing where
100 # to find libraries), but we provide LD so other rules can invoke the linker.
James Kuszmaul3ae42262019-11-08 12:33:41 -0800101 tool_path { name: "ld" path: "clang_6p0/x86_64-linux-gnu-ld" }
102 tool_path { name: "nm" path: "clang_6p0/x86_64-linux-gnu-nm" }
103 tool_path { name: "objcopy" path: "clang_6p0/x86_64-linux-gnu-objcopy" }
Brian Silverman7b8899e2018-06-30 19:19:24 -0700104 objcopy_embed_flag: "-I"
105 objcopy_embed_flag: "binary"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800106 tool_path { name: "objdump" path: "clang_6p0/x86_64-linux-gnu-objdump" }
107 tool_path { name: "strip" path: "clang_6p0/x86_64-linux-gnu-strip" }
Brian Silverman7b8899e2018-06-30 19:19:24 -0700108 linking_mode_flags { mode: DYNAMIC }
109
Brian Silverman60606c92020-01-15 22:45:04 -0800110 compiler_flag: "--sysroot=external/amd64_debian_sysroot"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700111 compiler_flag: "-nostdinc"
112 compiler_flag: "-isystem"
Brian Silverman60606c92020-01-15 22:45:04 -0800113 compiler_flag: "external/amd64_debian_sysroot/usr/include/c++/7"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700114 compiler_flag: "-isystem"
Brian Silverman60606c92020-01-15 22:45:04 -0800115 compiler_flag: "external/amd64_debian_sysroot/usr/include/x86_64-linux-gnu/c++/7"
116 compiler_flag: "-isystem"
117 compiler_flag: "external/amd64_debian_sysroot/usr/include/c++/8/backward"
118 compiler_flag: "-isystem"
119 compiler_flag: "external/amd64_debian_sysroot/usr/lib/gcc/x86_64-linux-gnu/8/include"
120 # We don't have anything in /usr/local/include, so don't include it here where
121 # would normally go on the default search path.
122 compiler_flag: "-isystem"
123 compiler_flag: "external/clang_6p0_repo/usr/lib/llvm-6.0/lib/clang/6.0.0/include"
124 compiler_flag: "-isystem"
125 compiler_flag: "external/amd64_debian_sysroot/usr/include/x86_64-linux-gnu"
126 compiler_flag: "-isystem"
127 compiler_flag: "external/amd64_debian_sysroot/usr/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700128
James Kuszmaul3ae42262019-11-08 12:33:41 -0800129 cxx_builtin_include_directory: "%package(@clang_6p0_repo//usr)%/lib/llvm-6.0/lib/clang/6.0.0/include"
Brian Silverman60606c92020-01-15 22:45:04 -0800130 cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/include"
131 cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/lib/gcc/x86_64-linux-gnu/7/include"
132 cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/lib/gcc/x86_64-linux-gnu/7/include-fixed"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700133
134 linker_flag: "-nodefaultlibs"
Brian Silverman60606c92020-01-15 22:45:04 -0800135 linker_flag: "--sysroot=external/amd64_debian_sysroot"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700136 linker_flag: "-lstdc++"
137 linker_flag: "-lc"
138 linker_flag: "-lgcc"
139 linker_flag: "-lgcc_s"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800140 linker_flag: "-Bexternal/clang_6p0_repo/usr/bin/"
141 linker_flag: "-Ltools/cpp/clang_6p0/clang_more_libs"
Brian Silverman60606c92020-01-15 22:45:04 -0800142 linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/gcc/x86_64-linux-gnu/7/"
143 linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/x86_64-linux-gnu/"
144 linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/"
145 linker_flag: "-Lexternal/amd64_debian_sysroot/lib/x86_64-linux-gnu/"
146 linker_flag: "-Lexternal/amd64_debian_sysroot/lib/"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700147
148 feature {
149 name: "opt"
150 implies: "all_modes"
151 flag_set {
152 action: "preprocess-assemble"
153 action: "c-compile"
154 action: "c++-compile"
155 action: "c++-header-parsing"
156 action: "c++-header-preprocessing"
157 action: "c++-module-compile"
158 flag_group {
159 flag: "-DAOS_DEBUG=0"
160 }
161 }
162 }
163
164 feature {
165 name: "dbg"
166 implies: "all_modes"
167 flag_set {
168 action: "preprocess-assemble"
169 action: "c-compile"
170 action: "c++-compile"
171 action: "c++-header-parsing"
172 action: "c++-header-preprocessing"
173 action: "c++-module-compile"
174 flag_group {
175 flag: "-DAOS_DEBUG=1"
176 }
177 flag_group {
178 flag: "-fno-omit-frame-pointer"
179 }
180 }
181 }
182
183 feature {
184 name: "fastbuild"
185 implies: "all_modes"
186 flag_set {
187 action: "preprocess-assemble"
188 action: "c-compile"
189 action: "c++-compile"
190 action: "c++-header-parsing"
191 action: "c++-header-preprocessing"
192 action: "c++-module-compile"
193 flag_group {
194 flag: "-DAOS_DEBUG=0"
195 }
196 }
197 }
198
199 feature {
200 name: "all_modes"
201 flag_set {
202 action: "preprocess-assemble"
203 action: "assemble"
204 action: "c-compile"
205 flag_group {
206 flag: "-std=gnu99"
207 }
208 }
209 flag_set {
210 action: "c++-compile"
211 action: "c++-header-parsing"
212 action: "c++-header-preprocessing"
213 action: "c++-module-compile"
214 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800215 flag: "-std=gnu++1z"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700216 }
217 }
Brian Silverman7b8899e2018-06-30 19:19:24 -0700218 }
219
220 # Anticipated future default.
221 # This makes GCC and Clang do what we want when called through symlinks.
222 unfiltered_cxx_flag: "-no-canonical-prefixes"
223 linker_flag: "-no-canonical-prefixes"
224
225 # Things that the code wants defined.
226 compiler_flag: "-D__STDC_FORMAT_MACROS"
227 compiler_flag: "-D__STDC_CONSTANT_MACROS"
228 compiler_flag: "-D__STDC_LIMIT_MACROS"
229 compiler_flag: "-D_FILE_OFFSET_BITS=64"
230 # TODO(Brian): Rename this or something.
231 compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
232
233 linker_flag: "-fuse-ld=gold"
234
235 # Make C++ compilation deterministic. Use linkstamping instead of these
236 # compiler symbols.
237 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
238 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
239 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
240 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
241
James Kuszmaul3ae42262019-11-08 12:33:41 -0800242 # C++17 libraries that tend to cause issues in some libraries that we include.
243 unfiltered_cxx_flag: "-Wno-varargs"
244 unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
245 # The mismatched-new-delete seems to be a bit overly strict currently
246 # and errors on:
247 # char *p = new char;
248 # delete p;
249 # p = new char[100];
250 # delete[] p;
251 unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
252
Brian Silverman7b8899e2018-06-30 19:19:24 -0700253 # Security hardening on by default.
254 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
255 # We need to undef it before redefining it as some distributions now have
256 # it enabled by default.
257 compiler_flag: "-U_FORTIFY_SOURCE"
258 compiler_flag: "-D_FORTIFY_SOURCE=1"
259 compiler_flag: "-fstack-protector"
260 compiler_flag: "-fPIE"
261 linker_flag: "-Wl,-z,relro,-z,now"
262
263 # Pretty much everything needs this, including parts of the glibc STL...
264 linker_flag: "-lm"
265
266 # Enable coloring even if there's no attached terminal. Bazel removes the
267 # escape sequences if --nocolor is specified.
268 compiler_flag: "-fcolor-diagnostics"
269 compiler_flag: "-fmessage-length=80"
270 compiler_flag: "-fmacro-backtrace-limit=0"
271
272 compiler_flag: "-Wall"
273 compiler_flag: "-Wextra"
274 compiler_flag: "-Wpointer-arith"
275 compiler_flag: "-Wstrict-aliasing"
276 compiler_flag: "-Wcast-qual"
277 compiler_flag: "-Wcast-align"
278 compiler_flag: "-Wwrite-strings"
279 compiler_flag: "-Wtype-limits"
280 compiler_flag: "-Wsign-compare"
281 compiler_flag: "-Wformat=2"
282 compiler_flag: "-Werror"
283
284 # Keep stack frames for debugging, even in opt mode.
285 compiler_flag: "-fno-omit-frame-pointer"
286
287 # Don't use temp files while compiling.
288 compiler_flag: "-pipe"
289
290 # Stamp the binary with a unique identifier.
291 linker_flag: "-Wl,--build-id=md5"
292 linker_flag: "-Wl,--hash-style=gnu"
293 linker_flag: "-Wl,--warn-execstack"
294 linker_flag: "-Wl,--detect-odr-violations"
295
296 # Enable debug symbols.
297 compiler_flag: "-ggdb3"
298
299 compilation_mode_flags {
300 mode: OPT
301
302 compiler_flag: "-O2"
303
304 # Disable assertions
305 compiler_flag: "-DNDEBUG"
306
307 # Removal of unused code and data at link time (can this increase binary size in some cases?).
308 compiler_flag: "-ffunction-sections"
309 compiler_flag: "-fdata-sections"
310 linker_flag: "-Wl,--gc-sections"
311 }
312 feature {
313 name: "pie_for_linking"
314 enabled: true
315 flag_set {
316 action: "c++-link-executable"
317 flag_group {
318 flag: "-pie"
319 }
320 }
321 }
322}
323
324toolchain {
James Kuszmaul27da8142019-07-21 16:13:55 -0700325 # This toolchain was initially sourced from https://github.com/ribrdb/rules_emscripten
326 toolchain_identifier: "emscripten_toolchain"
327 host_system_name: "web"
328 target_system_name: "emscripten-unknown-emscripten"
329 target_cpu: "web"
330 target_libc: "unknown"
331 compiler: "emscripten"
332 abi_version: "unknown"
333 abi_libc_version: "unknown"
334 tool_path {
335 name: "gcc"
336 path: "emscripten/emcc.sh"
337 }
338 tool_path {
339 name: "ld"
340 path: "emscripten/emcc.sh"
341 }
342 tool_path {
343 name: "ar"
344 path: "emscripten/emar.sh"
345 }
346 tool_path {
347 name: "cpp"
348 path: "/bin/false"
349 }
350 tool_path {
351 name: "gcov"
352 path: "/bin/false"
353 }
354 tool_path {
355 name: "nm"
356 path: "/bin/false"
357 }
358 tool_path {
359 name: "objdump"
360 path: "/bin/false"
361 }
362 tool_path {
363 name: "objcopy"
364 path: "/bin/false"
365 }
366 tool_path {
367 name: "strip"
368 path: "/bin/false"
369 }
370
371 unfiltered_cxx_flag: "-isystem"
372 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/libcxx"
373 unfiltered_cxx_flag: "-isystem"
374 unfiltered_cxx_flag: "external/emscripten_toolchain/system/lib/libcxxabi/include"
375 unfiltered_cxx_flag: "-isystem"
376 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/compat"
377 compiler_flag: "-isystem"
378 compiler_flag: "external/emscripten_toolchain/system/include"
379 unfiltered_cxx_flag: "-isystem"
380 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include"
381 unfiltered_cxx_flag: "-isystem"
382 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/SSE"
383 unfiltered_cxx_flag: "-isystem"
384 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/libc"
385 unfiltered_cxx_flag: "-isystem"
386 unfiltered_cxx_flag: "external/emscripten_toolchain/system/lib/libc/musl/arch/emscripten"
387 unfiltered_cxx_flag: "-isystem"
388 unfiltered_cxx_flag: "external/emscripten_toolchain/system/local/include"
389
390 # Turn off exceptions since emscripten has issues catching them
391 compiler_flag: "-fno-exceptions"
392
393 unfiltered_cxx_flag: "-no-canonical-prefixes"
394 linker_flag: "-no-canonical-prefixes"
395
396 # Make C++ compilation deterministic. Use linkstamping instead of these
397 # compiler symbols.
398 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
399 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
400 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
401 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
402 # Enable coloring even if there's no attached terminal. Bazel removes the
403 # escape sequences if --nocolor is specified.
404 compiler_flag: "-fdiagnostics-color=always"
405 compiler_flag: "-Wall"
406 compiler_flag: "-Werror"
407
408 compiler_flag: "-ffunction-sections"
409 compiler_flag: "-fdata-sections"
410
411 feature {
412 name: "opt"
413 flag_set {
414 action: "preprocess-assemble"
415 action: "c-compile"
416 action: "c++-compile"
417 action: "c++-header-parsing"
418 action: "c++-header-preprocessing"
419 action: "c++-module-compile"
420 flag_group {
421 flag: "-DAOS_DEBUG=0"
422 flag: "-O2"
423 flag: "--closure"
424 flag: "1"
425 }
426 }
427 implies: "all_modes"
428 }
429 feature {
430 name: "dbg"
431 flag_set {
432 action: "preprocess-assemble"
433 action: "c-compile"
434 action: "c++-compile"
435 action: "c++-header-parsing"
436 action: "c++-header-preprocessing"
437 action: "c++-module-compile"
438 flag_group {
439 flag: "-DAOS_DEBUG=1"
440 }
441 flag_group {
442 flag: "-fno-omit-frame-pointer"
443 }
444 }
445 implies: "all_modes"
446 }
447 feature {
448 name: "fastbuild"
449 flag_set {
450 action: "preprocess-assemble"
451 action: "c-compile"
452 action: "c++-compile"
453 action: "c++-header-parsing"
454 action: "c++-header-preprocessing"
455 action: "c++-module-compile"
456 flag_group {
457 flag: "-DAOS_DEBUG=0"
458 }
459 }
460 implies: "all_modes"
461 }
462 feature {
463 name: "all_modes"
464 flag_set {
465 action: "preprocess-assemble"
466 action: "assemble"
467 action: "c-compile"
468 flag_group {
469 flag: "-std=gnu99"
470 }
471 }
472 flag_set {
473 action: "c++-compile"
474 action: "c++-header-parsing"
475 action: "c++-header-preprocessing"
476 action: "c++-module-compile"
477 flag_group {
478 flag: "-std=gnu++1y"
479 }
480 }
481 }
482}
483
484toolchain {
Austin Schuhef147de2018-10-27 21:19:00 -0700485 toolchain_identifier: "roborio_linux"
486 host_system_name: "roborio"
487 target_system_name: "roborio"
488 target_cpu: "roborio"
489 target_libc: "roborio"
490 compiler: "gcc"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700491 abi_version: "roborio"
492 abi_libc_version: "roborio"
Austin Schuhef147de2018-10-27 21:19:00 -0700493
Brian Silverman7b8899e2018-06-30 19:19:24 -0700494 builtin_sysroot: ""
Brian Silverman7b8899e2018-06-30 19:19:24 -0700495 needsPic: true
496 supports_gold_linker: false
497 supports_incremental_linker: false
498 supports_fission: false
499 supports_interface_shared_objects: false
500 supports_normalizing_ar: false
501 supports_start_end_lib: false
502 supports_thin_archives: false
Brian Silverman7b8899e2018-06-30 19:19:24 -0700503
504 tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" }
Austin Schuhf6b94632019-02-02 22:11:27 -0800505 tool_path { name: "as" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as" }
Brian Silverman7b8899e2018-06-30 19:19:24 -0700506 tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
507 tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" }
508 tool_path { name: "dwp" path: "/bin/false" }
509 tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" }
510 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
511 # C(++) compiles invoke the compiler (as that is the one knowing where
512 # to find libraries), but we provide LD so other rules can invoke the linker.
513 tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
514 tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" }
515 tool_path { name: "objcopy" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy" }
516 objcopy_embed_flag: "-I"
517 objcopy_embed_flag: "binary"
518 tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" }
519 tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" }
520 linking_mode_flags { mode: DYNAMIC }
521
Austin Schuhef147de2018-10-27 21:19:00 -0700522 feature {
523 name: "compile_flags1"
524 enabled: true
525 flag_set {
526 action: "assemble"
527 action: "preprocess-assemble"
528 action: "c-compile"
529 action: "c++-compile"
530 action: "c++-header-parsing"
531 action: "c++-module-compile"
532 action: "c++-module-codegen"
533 action: "lto-backend"
534 action: "clif-match"
535 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800536 flag: "--sysroot=external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi"
Austin Schuhef147de2018-10-27 21:19:00 -0700537 flag: "-nostdinc"
538 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800539 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include"
Austin Schuhef147de2018-10-27 21:19:00 -0700540 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800541 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include-fixed"
Austin Schuhf6b94632019-02-02 22:11:27 -0800542 }
543 }
544
545 flag_set {
James Kuszmaulebdeaf52019-05-22 20:31:25 -0700546 action: "assemble"
547 action: "preprocess-assemble"
548 action: "c++-compile"
549 action: "c++-header-parsing"
550 action: "c++-header-preprocessing"
551 flag_group {
552 flag: "-fno-canonical-system-headers"
553 }
554 }
555
556 flag_set {
Austin Schuhf6b94632019-02-02 22:11:27 -0800557 action: "c++-compile"
558 action: "c++-header-parsing"
559 action: "c++-module-compile"
560 action: "c++-module-codegen"
561 flag_group {
Austin Schuhef147de2018-10-27 21:19:00 -0700562 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800563 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0"
Austin Schuhf6b94632019-02-02 22:11:27 -0800564 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800565 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi"
Austin Schuhf6b94632019-02-02 22:11:27 -0800566 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800567 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/backward"
Austin Schuhf6b94632019-02-02 22:11:27 -0800568 }
569 }
570
571 flag_set {
572 action: "assemble"
573 action: "preprocess-assemble"
574 action: "c-compile"
575 action: "c++-compile"
576 action: "c++-header-parsing"
577 action: "c++-module-compile"
578 action: "c++-module-codegen"
579 action: "lto-backend"
580 action: "clif-match"
581 flag_group {
582 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800583 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include"
Austin Schuhf6b94632019-02-02 22:11:27 -0800584
Austin Schuhef147de2018-10-27 21:19:00 -0700585 flag: "-mfpu=neon"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700586
Austin Schuhef147de2018-10-27 21:19:00 -0700587 # Things that the code wants defined.
588 flag: "-D__STDC_FORMAT_MACROS"
589 flag: "-D__STDC_CONSTANT_MACROS"
590 flag: "-D__STDC_LIMIT_MACROS"
591 flag: "-D_FILE_OFFSET_BITS=64"
592
593 # TODO(Brian): Rename this or something.
594 flag: "-DAOS_ARCHITECTURE_arm_frc"
595
596 # Security hardening on by default.
597 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
598 # We need to undef it before redefining it as some distributions now have
599 # it enabled by default.
600 flag: "-U_FORTIFY_SOURCE"
601 flag: "-fstack-protector"
602 flag: "-fPIE"
603
604 # Enable coloring even if there's no attached terminal. Bazel removes the
605 # escape sequences if --nocolor is specified.
606 flag: "-fdiagnostics-color=always"
607
608 flag: "-Wall"
609 flag: "-Wextra"
610 flag: "-Wpointer-arith"
611 flag: "-Wstrict-aliasing"
612 flag: "-Wcast-qual"
Austin Schuhef147de2018-10-27 21:19:00 -0700613 flag: "-Wwrite-strings"
614 flag: "-Wtype-limits"
615 flag: "-Wsign-compare"
616 flag: "-Wformat=2"
617 flag: "-Werror"
618 flag: "-Wunused-local-typedefs"
Brian Silverman21280c72019-12-18 20:26:12 -0800619 # We don't use libraries compiled with the broken version.
620 flag: "-Wno-psabi"
Austin Schuhef147de2018-10-27 21:19:00 -0700621
622 # Keep stack frames for debugging, even in opt mode.
623 flag: "-fno-omit-frame-pointer"
624
625 flag: "-D__has_feature(x)=0"
626
627 # Don't use temp files while compiling.
628 flag: "-pipe"
629
630 # Enable debug symbols.
631 flag: "-ggdb3"
632 }
633 }
634 }
635
636 feature {
637 name: "opt"
638 implies: "opt_post"
639 flag_set {
640 action: "assemble"
641 action: "preprocess-assemble"
642 action: "c-compile"
643 action: "c++-compile"
644 action: "c++-module-compile"
645 action: "objc-compile"
646 action: "objc++-compile"
647 action: "c++-header-parsing"
648 action: "linkstamp-compile"
649 flag_group {
650 flag: "-O2"
651 flag: "-DNDEBUG"
652 flag: "-D_FORTIFY_SOURCE=1"
653 flag: "-ffunction-sections"
654 flag: "-fdata-sections"
655 }
656 }
657 flag_set {
658 action: "c++-link-executable"
659 action: "c++-link-nodeps-dynamic-library"
660 action: "c++-link-dynamic-library"
661 flag_group {
662 flag: "-Wl,--gc-sections"
663 }
664 }
665 }
666
Brian Silverman7b8899e2018-06-30 19:19:24 -0700667 # TODO(bazel-team): In theory, the path here ought to exactly match the path
668 # used by gcc. That works because bazel currently doesn't track files at
669 # absolute locations and has no remote execution, yet. However, this will need
670 # to be fixed, maybe with auto-detection?
Austin Schuhf6b94632019-02-02 22:11:27 -0800671
James Kuszmaul3ae42262019-11-08 12:33:41 -0800672 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include)%"
673 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include-fixed)%"
674 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi)%"
675 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/backward)%"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700676
677 linker_flag: "-lstdc++"
678 linker_flag: "-Ltools/cpp/arm-frc-linux-gnueabi/libs"
679
680 feature {
Austin Schuhef147de2018-10-27 21:19:00 -0700681 name: "dependency_file"
682 flag_set {
683 action: "assemble"
684 action: "preprocess-assemble"
685 action: "c-compile"
686 action: "c++-compile"
687 action: "c++-module-compile"
688 action: "objc-compile"
689 action: "objc++-compile"
690 action: "c++-header-parsing"
691 action: "clif-match"
692 expand_if_all_available: "dependency_file"
693 flag_group {
694 flag: "-MD"
695 flag: "-MF"
696 flag: "%{dependency_file}"
697 }
698 }
699 }
700
701 feature {
702 name: "random_seed"
703 flag_set {
704 # TODO(austin): Should these also have -frandom-seed set? Upstream
705 # doesn't.
706 # action: "linkstamp-compile"
707 # action: "c-compile"
708 action: "c++-compile"
709 action: "c++-module-codegen"
710 action: "c++-module-compile"
711 flag_group {
712 expand_if_all_available: "output_file"
713 flag: "-frandom-seed=%{output_file}"
714 }
715 }
716 }
717
718 feature {
719 name: "pic"
720 flag_set {
721 action: "assemble"
722 action: "preprocess-assemble"
723 action: "linkstamp-compile"
724 action: "c-compile"
725 action: "c++-compile"
726 action: "c++-module-codegen"
727 action: "c++-module-compile"
728 expand_if_all_available: "pic"
729 flag_group {
730 flag: "-fPIC"
731 }
732 }
733 }
734
735 feature {
736 name: "preprocessor_defines"
737 flag_set {
738 action: "preprocess-assemble"
739 action: "linkstamp-compile"
740 action: "c-compile"
741 action: "c++-compile"
742 action: "c++-header-parsing"
743 action: "c++-module-compile"
744 action: "clif-match"
745 flag_group {
746 iterate_over: "preprocessor_defines"
747 flag: "-D%{preprocessor_defines}"
748 }
749 }
750 }
751
752 feature {
753 name: "include_paths"
754 flag_set {
755 action: "preprocess-assemble"
756 action: "c-compile"
757 action: "c++-compile"
758 action: "c++-header-parsing"
759 action: "c++-header-preprocessing"
760 action: "c++-module-compile"
761 flag_group {
762 flag: "-iquote"
763 flag: "%{quote_include_paths}"
764 iterate_over: "quote_include_paths"
765 }
766 flag_group {
767 flag: "-I%{include_paths}"
768 iterate_over: "include_paths"
769 }
770 flag_group {
771 flag: "-isystem"
772 flag: "%{system_include_paths}"
773 iterate_over: "system_include_paths"
774 }
775 }
776 }
777
778 feature {
779 name: "opt_post"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700780 flag_set {
781 action: "preprocess-assemble"
782 action: "c-compile"
783 action: "c++-compile"
784 action: "c++-header-parsing"
785 action: "c++-header-preprocessing"
786 action: "c++-module-compile"
787 flag_group {
788 flag: "-DAOS_DEBUG=0"
789 }
790 }
791 }
792
793 feature {
794 name: "dbg"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700795 flag_set {
796 action: "preprocess-assemble"
797 action: "c-compile"
798 action: "c++-compile"
799 action: "c++-header-parsing"
800 action: "c++-header-preprocessing"
801 action: "c++-module-compile"
802 flag_group {
803 flag: "-DAOS_DEBUG=1"
804 }
805 flag_group {
806 flag: "-fno-omit-frame-pointer"
807 }
808 }
809 }
810
811 feature {
812 name: "fastbuild"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700813 flag_set {
814 action: "preprocess-assemble"
815 action: "c-compile"
816 action: "c++-compile"
817 action: "c++-header-parsing"
818 action: "c++-header-preprocessing"
819 action: "c++-module-compile"
820 flag_group {
821 flag: "-DAOS_DEBUG=0"
822 }
823 }
824 }
825
826 feature {
827 name: "all_modes"
Austin Schuhef147de2018-10-27 21:19:00 -0700828 enabled: true
Brian Silverman7b8899e2018-06-30 19:19:24 -0700829 flag_set {
830 action: "preprocess-assemble"
831 action: "assemble"
832 action: "c-compile"
833 flag_group {
834 flag: "-std=gnu99"
835 }
836 }
837 flag_set {
838 action: "c++-compile"
839 action: "c++-header-parsing"
840 action: "c++-header-preprocessing"
841 action: "c++-module-compile"
842 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800843 flag: "-std=gnu++1z"
Austin Schuhf6b94632019-02-02 22:11:27 -0800844 flag: "-fno-sized-deallocation"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700845 }
846 }
847 flag_set {
848 action: "preprocess-assemble"
849 action: "assemble"
850 action: "c++-link"
851 action: "c++-compile"
852 action: "c++-header-parsing"
853 action: "c++-header-preprocessing"
854 action: "c++-module-compile"
855 action: "c-compile"
856 flag_group {
857 # We always want to compile with -pthread semantics.
858 flag: "-pthread"
859 }
860 }
861 }
862
Brian Silverman7b8899e2018-06-30 19:19:24 -0700863 # Anticipated future default.
864 # This makes GCC and Clang do what we want when called through symlinks.
865 unfiltered_cxx_flag: "-no-canonical-prefixes"
866 linker_flag: "-no-canonical-prefixes"
867
Brian Silverman7b8899e2018-06-30 19:19:24 -0700868 # Make C++ compilation deterministic. Use linkstamping instead of these
869 # compiler symbols.
870 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
871 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
872 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
873 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
874
Brian Silverman7b8899e2018-06-30 19:19:24 -0700875 linker_flag: "-Wl,-z,relro,-z,now"
876
877 # Pretty much everything needs this, including parts of the glibc STL...
878 linker_flag: "-lm"
879
Brian Silverman7b8899e2018-06-30 19:19:24 -0700880 # Have GCC return the exit code from ld.
881 linker_flag: "-pass-exit-codes"
882
883 # Stamp the binary with a unique identifier.
884 linker_flag: "-Wl,--build-id=md5"
885 linker_flag: "-Wl,--hash-style=gnu"
886 #linker_flag: "-Wl,--warn-execstack"
887 #linker_flag: "-Wl,--detect-odr-violations"
888
Brian Silverman7b8899e2018-06-30 19:19:24 -0700889 feature {
890 name: "pie_for_linking"
891 enabled: true
892 flag_set {
893 action: "c++-link-executable"
894 flag_group {
895 flag: "-pie"
896 }
897 }
898 }
899}
900
901toolchain {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800902 abi_version: "clang_6.0"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700903 abi_libc_version: "glibc_2.19"
904 builtin_sysroot: ""
905 compiler: "clang"
906 host_system_name: "linux"
907 needsPic: true
908 supports_gold_linker: false
909 supports_incremental_linker: false
910 supports_fission: false
911 supports_interface_shared_objects: false
912 supports_normalizing_ar: true
913 supports_start_end_lib: false
914 supports_thin_archives: true
915 target_libc: "glibc_2.19"
916 target_cpu: "armhf-debian"
917 target_system_name: "arm_a15"
918 toolchain_identifier: "clang_linux_armhf"
919
920 tool_path { name: "ar" path: "linaro_linux_gcc/arm-linux-gnueabihf-ar" }
921 tool_path { name: "compat-ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
922 tool_path { name: "cpp" path: "linaro_linux_gcc/clang_bin/clang" }
923 tool_path { name: "dwp" path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp" }
924 tool_path { name: "gcc" path: "linaro_linux_gcc/clang_bin/clang" }
925 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
926 # C(++) compiles invoke the compiler (as that is the one knowing where
927 # to find libraries), but we provide LD so other rules can invoke the linker.
928 tool_path { name: "ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
929 tool_path { name: "nm" path: "linaro_linux_gcc/arm-linux-gnueabihf-nm" }
930 tool_path { name: "objcopy" path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy" }
931 objcopy_embed_flag: "-I"
932 objcopy_embed_flag: "binary"
933 tool_path { name: "objdump" path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump" }
934 tool_path { name: "strip" path: "linaro_linux_gcc/arm-linux-gnueabihf-strip" }
935 linking_mode_flags { mode: DYNAMIC }
936
937 compiler_flag: "-target"
938 compiler_flag: "armv7a-arm-linux-gnueabif"
Brian Silvermanbf4c1312020-01-12 11:35:45 -0800939 compiler_flag: "--sysroot=external/armhf_debian_rootfs"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700940 compiler_flag: "-mfloat-abi=hard"
941 compiler_flag: "-mfpu=vfpv3-d16"
942
943 compiler_flag: "-nostdinc"
944 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800945 compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700946 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800947 compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700948 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800949 compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf"
950 compiler_flag: "-isystem"
951 compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1"
952 compiler_flag: "-isystem"
953 compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1/arm-linux-gnueabihf"
954 compiler_flag: "-isystem"
955 compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1"
956 compiler_flag: "-isystem"
Brian Silvermanbf4c1312020-01-12 11:35:45 -0800957 compiler_flag: "external/armhf_debian_rootfs/usr/include"
958 compiler_flag: "-isystem"
959 compiler_flag: "external/armhf_debian_rootfs/usr/include/arm-linux-gnueabihf"
960 compiler_flag: "-isystem"
961 compiler_flag: "external/org_frc971/third_party"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700962
James Kuszmaul3ae42262019-11-08 12:33:41 -0800963 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%"
Brian Silvermanbf4c1312020-01-12 11:35:45 -0800964 cxx_builtin_include_directory: "%package(@armhf_debian_rootfs//usr/include)%"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800965 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%/c++/7.4.1"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800966 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include)%"
967 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%"
968 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/include)%/c++/7.4.1"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700969
970 linker_flag: "-target"
971 linker_flag: "armv7a-arm-linux-gnueabif"
Brian Silvermanbf4c1312020-01-12 11:35:45 -0800972 linker_flag: "--sysroot=external/armhf_debian_rootfs"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700973 linker_flag: "-lstdc++"
974 linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs"
Brian Silvermanbf4c1312020-01-12 11:35:45 -0800975 linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib/gcc/arm-linux-gnueabihf/8"
976 linker_flag: "-Lexternal/armhf_debian_rootfs/lib/arm-linux-gnueabihf"
977 linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib/arm-linux-gnueabihf"
978 linker_flag: "-Lexternal/armhf_debian_rootfs/lib"
979 linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800980 linker_flag: "-Lexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
981 linker_flag: "-Bexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
982 linker_flag: "-Bexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/bin"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700983 linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3"
984
985 feature {
986 name: "opt"
987 implies: "all_modes"
988 flag_set {
989 action: "preprocess-assemble"
990 action: "c-compile"
991 action: "c++-compile"
992 action: "c++-header-parsing"
993 action: "c++-header-preprocessing"
994 action: "c++-module-compile"
995 flag_group {
996 flag: "-DAOS_DEBUG=0"
997 }
998 }
999 }
1000
1001 feature {
1002 name: "dbg"
1003 implies: "all_modes"
1004 flag_set {
1005 action: "preprocess-assemble"
1006 action: "c-compile"
1007 action: "c++-compile"
1008 action: "c++-header-parsing"
1009 action: "c++-header-preprocessing"
1010 action: "c++-module-compile"
1011 flag_group {
1012 flag: "-DAOS_DEBUG=1"
1013 }
1014 flag_group {
1015 flag: "-fno-omit-frame-pointer"
1016 }
1017 }
1018 }
1019
1020 feature {
1021 name: "fastbuild"
1022 implies: "all_modes"
1023 flag_set {
1024 action: "preprocess-assemble"
1025 action: "c-compile"
1026 action: "c++-compile"
1027 action: "c++-header-parsing"
1028 action: "c++-header-preprocessing"
1029 action: "c++-module-compile"
1030 flag_group {
1031 flag: "-DAOS_DEBUG=0"
1032 }
1033 }
1034 }
1035
1036 feature {
1037 name: "all_modes"
1038 flag_set {
1039 action: "preprocess-assemble"
1040 action: "assemble"
1041 action: "c-compile"
1042 flag_group {
1043 flag: "-std=gnu99"
1044 }
1045 }
1046 flag_set {
1047 action: "c++-compile"
1048 action: "c++-header-parsing"
1049 action: "c++-header-preprocessing"
1050 action: "c++-module-compile"
1051 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -08001052 flag: "-std=gnu++1z"
Brian Silverman7b8899e2018-06-30 19:19:24 -07001053 }
1054 }
1055 flag_set {
1056 action: "preprocess-assemble"
1057 action: "assemble"
1058 action: "c++-link"
1059 action: "c++-compile"
1060 action: "c++-header-parsing"
1061 action: "c++-header-preprocessing"
1062 action: "c++-module-compile"
1063 action: "c-compile"
1064 flag_group {
1065 # We always want to compile with -pthread semantics.
1066 flag: "-pthread"
1067 }
1068 }
1069 }
1070
1071 # Anticipated future default.
1072 # This makes GCC and Clang do what we want when called through symlinks.
1073 unfiltered_cxx_flag: "-no-canonical-prefixes"
1074 linker_flag: "-no-canonical-prefixes"
1075
1076 # Things that the code wants defined.
1077 compiler_flag: "-D__STDC_FORMAT_MACROS"
1078 compiler_flag: "-D__STDC_CONSTANT_MACROS"
1079 compiler_flag: "-D__STDC_LIMIT_MACROS"
1080 compiler_flag: "-D_FILE_OFFSET_BITS=64"
1081 # TODO(Brian): Rename this or something.
1082 compiler_flag: "-DAOS_ARCHITECTURE_armhf"
1083
1084 # Make C++ compilation deterministic. Use linkstamping instead of these
1085 # compiler symbols.
1086 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
James Kuszmaul3ae42262019-11-08 12:33:41 -08001087 unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
1088 unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
1089 unfiltered_cxx_flag: "-Wno-varargs"
Brian Silverman7b8899e2018-06-30 19:19:24 -07001090 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
1091 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
1092 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
1093
1094 # Security hardening on by default.
1095 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
1096 # We need to undef it before redefining it as some distributions now have
1097 # it enabled by default.
1098 compiler_flag: "-U_FORTIFY_SOURCE"
1099 compiler_flag: "-fstack-protector"
1100 compiler_flag: "-fPIE"
1101 linker_flag: "-Wl,-z,relro,-z,now"
1102
1103 # Pretty much everything needs this, including parts of the glibc STL...
1104 linker_flag: "-lm"
1105
1106 # Enable coloring even if there's no attached terminal. Bazel removes the
1107 # escape sequences if --nocolor is specified.
1108 compiler_flag: "-fdiagnostics-color=always"
1109
1110 compiler_flag: "-Wall"
1111 compiler_flag: "-Wextra"
1112 compiler_flag: "-Wpointer-arith"
1113 compiler_flag: "-Wstrict-aliasing"
1114 compiler_flag: "-Wcast-qual"
1115 compiler_flag: "-Wcast-align"
1116 compiler_flag: "-Wwrite-strings"
1117 compiler_flag: "-Wtype-limits"
1118 compiler_flag: "-Wsign-compare"
1119 compiler_flag: "-Wformat=2"
1120 compiler_flag: "-Werror"
1121 compiler_flag: "-Wunused-local-typedefs"
1122
1123 # Keep stack frames for debugging, even in opt mode.
1124 compiler_flag: "-fno-omit-frame-pointer"
1125
1126 # Don't use temp files while compiling.
1127 compiler_flag: "-pipe"
1128
1129 # Stamp the binary with a unique identifier.
1130 linker_flag: "-Wl,--build-id=md5"
1131 linker_flag: "-Wl,--hash-style=gnu"
1132 #linker_flag: "-Wl,--warn-execstack"
1133 #linker_flag: "-Wl,--detect-odr-violations"
1134
1135 # Enable debug symbols.
1136 compiler_flag: "-ggdb3"
1137
1138 compilation_mode_flags {
1139 mode: OPT
1140
1141 compiler_flag: "-O2"
1142
1143 # Disable assertions
1144 compiler_flag: "-DNDEBUG"
1145 compiler_flag: "-D_FORTIFY_SOURCE=1"
1146
1147 # Removal of unused code and data at link time (can this increase binary size in some cases?).
1148 compiler_flag: "-ffunction-sections"
1149 compiler_flag: "-fdata-sections"
1150 linker_flag: "-Wl,--gc-sections"
1151 }
1152 feature {
1153 name: "pie_for_linking"
1154 enabled: true
1155 flag_set {
1156 action: "c++-link-executable"
1157 flag_group {
1158 flag: "-pie"
1159 }
1160 }
1161 }
1162}