blob: 3435ece6e0f88ef27cdff40dda5b7aed02ef9588 [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
James Kuszmaul3ae42262019-11-08 12:33:41 -0800110 compiler_flag: "--sysroot=external/clang_6p0_repo/"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700111 compiler_flag: "-nostdinc"
112 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800113 compiler_flag: "external/clang_6p0_repo/usr/include/x86_64-linux-gnu",
Brian Silverman7b8899e2018-06-30 19:19:24 -0700114 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800115 compiler_flag: "external/clang_6p0_repo/usr/lib/llvm-6.0/lib/clang/6.0.0/include",
Brian Silverman7b8899e2018-06-30 19:19:24 -0700116
James Kuszmaul3ae42262019-11-08 12:33:41 -0800117 compiler_flag: "-isystem"
118 compiler_flag: "external/clang_6p0_repo/usr/include/c++/7.4.0"
119 compiler_flag: "-isystem"
120 compiler_flag: "external/clang_6p0_repo/usr/include/x86_64-linux-gnu/c++/7.4.0"
121 compiler_flag: "-isystem"
122 compiler_flag: "external/clang_6p0_repo/usr/include/c++/7.4.0/backward"
123 compiler_flag: "-isystem"
124 compiler_flag: "external/clang_6p0_repo/usr/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700125
126 # TODO(bazel-team): In theory, the path here ought to exactly match the path
127 # used by gcc. That works because bazel currently doesn't track files at
128 # absolute locations and has no remote execution, yet. However, this will need
129 # to be fixed, maybe with auto-detection?
James Kuszmaul3ae42262019-11-08 12:33:41 -0800130 cxx_builtin_include_directory: "%package(@clang_6p0_repo//usr)%/include/c++/7.4.0"
131 cxx_builtin_include_directory: "%package(@clang_6p0_repo//usr)%/include/x86_64-linux-gnu/c++/7.4.0"
132 cxx_builtin_include_directory: "%package(@clang_6p0_repo//usr)%/include/c++/7.4.0/backward"
133 cxx_builtin_include_directory: "%package(@clang_6p0_repo//usr)%/local/include"
134 cxx_builtin_include_directory: "%package(@clang_6p0_repo//usr)%/lib/llvm-6.0/lib/clang/6.0.0/include"
135 cxx_builtin_include_directory: "%package(@clang_6p0_repo//usr)%/include/x86_64-linux-gnu"
136 cxx_flag: "-isystem"
137 cxx_flag: "external/clang_6p0_repo/usr/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700138
139 linker_flag: "-nodefaultlibs"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800140 linker_flag: "--sysroot=external/clang_6p0_repo/"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700141 linker_flag: "-lstdc++"
142 linker_flag: "-lc"
143 linker_flag: "-lgcc"
144 linker_flag: "-lgcc_s"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800145 linker_flag: "-Bexternal/clang_6p0_repo/usr/bin/"
146 linker_flag: "-Ltools/cpp/clang_6p0/clang_more_libs"
147 linker_flag: "-Lexternal/clang_6p0_repo/lib/x86_64-linux-gnu"
148 linker_flag: "-Lexternal/clang_6p0_repo/usr/lib/x86_64-linux-gnu"
149 linker_flag: "-Lexternal/clang_6p0_repo/usr/lib/gcc/x86_64-linux-gnu"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700150
151 feature {
152 name: "opt"
153 implies: "all_modes"
154 flag_set {
155 action: "preprocess-assemble"
156 action: "c-compile"
157 action: "c++-compile"
158 action: "c++-header-parsing"
159 action: "c++-header-preprocessing"
160 action: "c++-module-compile"
161 flag_group {
162 flag: "-DAOS_DEBUG=0"
163 }
164 }
165 }
166
167 feature {
168 name: "dbg"
169 implies: "all_modes"
170 flag_set {
171 action: "preprocess-assemble"
172 action: "c-compile"
173 action: "c++-compile"
174 action: "c++-header-parsing"
175 action: "c++-header-preprocessing"
176 action: "c++-module-compile"
177 flag_group {
178 flag: "-DAOS_DEBUG=1"
179 }
180 flag_group {
181 flag: "-fno-omit-frame-pointer"
182 }
183 }
184 }
185
186 feature {
187 name: "fastbuild"
188 implies: "all_modes"
189 flag_set {
190 action: "preprocess-assemble"
191 action: "c-compile"
192 action: "c++-compile"
193 action: "c++-header-parsing"
194 action: "c++-header-preprocessing"
195 action: "c++-module-compile"
196 flag_group {
197 flag: "-DAOS_DEBUG=0"
198 }
199 }
200 }
201
202 feature {
203 name: "all_modes"
204 flag_set {
205 action: "preprocess-assemble"
206 action: "assemble"
207 action: "c-compile"
208 flag_group {
209 flag: "-std=gnu99"
210 }
211 }
212 flag_set {
213 action: "c++-compile"
214 action: "c++-header-parsing"
215 action: "c++-header-preprocessing"
216 action: "c++-module-compile"
217 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800218 flag: "-std=gnu++1z"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700219 }
220 }
221 flag_set {
222 action: "preprocess-assemble"
223 action: "assemble"
224 action: "c++-link"
225 action: "c++-compile"
226 action: "c++-header-parsing"
227 action: "c++-header-preprocessing"
228 action: "c++-module-compile"
229 action: "c-compile"
230 flag_group {
231 # We always want to compile with -pthread semantics.
232 flag: "-pthread"
233 }
234 }
235 }
236
237 # Anticipated future default.
238 # This makes GCC and Clang do what we want when called through symlinks.
239 unfiltered_cxx_flag: "-no-canonical-prefixes"
240 linker_flag: "-no-canonical-prefixes"
241
242 # Things that the code wants defined.
243 compiler_flag: "-D__STDC_FORMAT_MACROS"
244 compiler_flag: "-D__STDC_CONSTANT_MACROS"
245 compiler_flag: "-D__STDC_LIMIT_MACROS"
246 compiler_flag: "-D_FILE_OFFSET_BITS=64"
247 # TODO(Brian): Rename this or something.
248 compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
249
250 linker_flag: "-fuse-ld=gold"
251
252 # Make C++ compilation deterministic. Use linkstamping instead of these
253 # compiler symbols.
254 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
255 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
256 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
257 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
258
James Kuszmaul3ae42262019-11-08 12:33:41 -0800259 # C++17 libraries that tend to cause issues in some libraries that we include.
260 unfiltered_cxx_flag: "-Wno-varargs"
261 unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
262 # The mismatched-new-delete seems to be a bit overly strict currently
263 # and errors on:
264 # char *p = new char;
265 # delete p;
266 # p = new char[100];
267 # delete[] p;
268 unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
269
Brian Silverman7b8899e2018-06-30 19:19:24 -0700270 # Security hardening on by default.
271 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
272 # We need to undef it before redefining it as some distributions now have
273 # it enabled by default.
274 compiler_flag: "-U_FORTIFY_SOURCE"
275 compiler_flag: "-D_FORTIFY_SOURCE=1"
276 compiler_flag: "-fstack-protector"
277 compiler_flag: "-fPIE"
278 linker_flag: "-Wl,-z,relro,-z,now"
279
280 # Pretty much everything needs this, including parts of the glibc STL...
281 linker_flag: "-lm"
282
283 # Enable coloring even if there's no attached terminal. Bazel removes the
284 # escape sequences if --nocolor is specified.
285 compiler_flag: "-fcolor-diagnostics"
286 compiler_flag: "-fmessage-length=80"
287 compiler_flag: "-fmacro-backtrace-limit=0"
288
289 compiler_flag: "-Wall"
290 compiler_flag: "-Wextra"
291 compiler_flag: "-Wpointer-arith"
292 compiler_flag: "-Wstrict-aliasing"
293 compiler_flag: "-Wcast-qual"
294 compiler_flag: "-Wcast-align"
295 compiler_flag: "-Wwrite-strings"
296 compiler_flag: "-Wtype-limits"
297 compiler_flag: "-Wsign-compare"
298 compiler_flag: "-Wformat=2"
299 compiler_flag: "-Werror"
300
301 # Keep stack frames for debugging, even in opt mode.
302 compiler_flag: "-fno-omit-frame-pointer"
303
304 # Don't use temp files while compiling.
305 compiler_flag: "-pipe"
306
307 # Stamp the binary with a unique identifier.
308 linker_flag: "-Wl,--build-id=md5"
309 linker_flag: "-Wl,--hash-style=gnu"
310 linker_flag: "-Wl,--warn-execstack"
311 linker_flag: "-Wl,--detect-odr-violations"
312
313 # Enable debug symbols.
314 compiler_flag: "-ggdb3"
315
316 compilation_mode_flags {
317 mode: OPT
318
319 compiler_flag: "-O2"
320
321 # Disable assertions
322 compiler_flag: "-DNDEBUG"
323
324 # Removal of unused code and data at link time (can this increase binary size in some cases?).
325 compiler_flag: "-ffunction-sections"
326 compiler_flag: "-fdata-sections"
327 linker_flag: "-Wl,--gc-sections"
328 }
329 feature {
330 name: "pie_for_linking"
331 enabled: true
332 flag_set {
333 action: "c++-link-executable"
334 flag_group {
335 flag: "-pie"
336 }
337 }
338 }
339}
340
341toolchain {
James Kuszmaul27da8142019-07-21 16:13:55 -0700342 # This toolchain was initially sourced from https://github.com/ribrdb/rules_emscripten
343 toolchain_identifier: "emscripten_toolchain"
344 host_system_name: "web"
345 target_system_name: "emscripten-unknown-emscripten"
346 target_cpu: "web"
347 target_libc: "unknown"
348 compiler: "emscripten"
349 abi_version: "unknown"
350 abi_libc_version: "unknown"
351 tool_path {
352 name: "gcc"
353 path: "emscripten/emcc.sh"
354 }
355 tool_path {
356 name: "ld"
357 path: "emscripten/emcc.sh"
358 }
359 tool_path {
360 name: "ar"
361 path: "emscripten/emar.sh"
362 }
363 tool_path {
364 name: "cpp"
365 path: "/bin/false"
366 }
367 tool_path {
368 name: "gcov"
369 path: "/bin/false"
370 }
371 tool_path {
372 name: "nm"
373 path: "/bin/false"
374 }
375 tool_path {
376 name: "objdump"
377 path: "/bin/false"
378 }
379 tool_path {
380 name: "objcopy"
381 path: "/bin/false"
382 }
383 tool_path {
384 name: "strip"
385 path: "/bin/false"
386 }
387
388 unfiltered_cxx_flag: "-isystem"
389 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/libcxx"
390 unfiltered_cxx_flag: "-isystem"
391 unfiltered_cxx_flag: "external/emscripten_toolchain/system/lib/libcxxabi/include"
392 unfiltered_cxx_flag: "-isystem"
393 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/compat"
394 compiler_flag: "-isystem"
395 compiler_flag: "external/emscripten_toolchain/system/include"
396 unfiltered_cxx_flag: "-isystem"
397 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include"
398 unfiltered_cxx_flag: "-isystem"
399 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/SSE"
400 unfiltered_cxx_flag: "-isystem"
401 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/libc"
402 unfiltered_cxx_flag: "-isystem"
403 unfiltered_cxx_flag: "external/emscripten_toolchain/system/lib/libc/musl/arch/emscripten"
404 unfiltered_cxx_flag: "-isystem"
405 unfiltered_cxx_flag: "external/emscripten_toolchain/system/local/include"
406
407 # Turn off exceptions since emscripten has issues catching them
408 compiler_flag: "-fno-exceptions"
409
410 unfiltered_cxx_flag: "-no-canonical-prefixes"
411 linker_flag: "-no-canonical-prefixes"
412
413 # Make C++ compilation deterministic. Use linkstamping instead of these
414 # compiler symbols.
415 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
416 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
417 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
418 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
419 # Enable coloring even if there's no attached terminal. Bazel removes the
420 # escape sequences if --nocolor is specified.
421 compiler_flag: "-fdiagnostics-color=always"
422 compiler_flag: "-Wall"
423 compiler_flag: "-Werror"
424
425 compiler_flag: "-ffunction-sections"
426 compiler_flag: "-fdata-sections"
427
428 feature {
429 name: "opt"
430 flag_set {
431 action: "preprocess-assemble"
432 action: "c-compile"
433 action: "c++-compile"
434 action: "c++-header-parsing"
435 action: "c++-header-preprocessing"
436 action: "c++-module-compile"
437 flag_group {
438 flag: "-DAOS_DEBUG=0"
439 flag: "-O2"
440 flag: "--closure"
441 flag: "1"
442 }
443 }
444 implies: "all_modes"
445 }
446 feature {
447 name: "dbg"
448 flag_set {
449 action: "preprocess-assemble"
450 action: "c-compile"
451 action: "c++-compile"
452 action: "c++-header-parsing"
453 action: "c++-header-preprocessing"
454 action: "c++-module-compile"
455 flag_group {
456 flag: "-DAOS_DEBUG=1"
457 }
458 flag_group {
459 flag: "-fno-omit-frame-pointer"
460 }
461 }
462 implies: "all_modes"
463 }
464 feature {
465 name: "fastbuild"
466 flag_set {
467 action: "preprocess-assemble"
468 action: "c-compile"
469 action: "c++-compile"
470 action: "c++-header-parsing"
471 action: "c++-header-preprocessing"
472 action: "c++-module-compile"
473 flag_group {
474 flag: "-DAOS_DEBUG=0"
475 }
476 }
477 implies: "all_modes"
478 }
479 feature {
480 name: "all_modes"
481 flag_set {
482 action: "preprocess-assemble"
483 action: "assemble"
484 action: "c-compile"
485 flag_group {
486 flag: "-std=gnu99"
487 }
488 }
489 flag_set {
490 action: "c++-compile"
491 action: "c++-header-parsing"
492 action: "c++-header-preprocessing"
493 action: "c++-module-compile"
494 flag_group {
495 flag: "-std=gnu++1y"
496 }
497 }
498 }
499}
500
501toolchain {
Austin Schuhef147de2018-10-27 21:19:00 -0700502 toolchain_identifier: "roborio_linux"
503 host_system_name: "roborio"
504 target_system_name: "roborio"
505 target_cpu: "roborio"
506 target_libc: "roborio"
507 compiler: "gcc"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700508 abi_version: "roborio"
509 abi_libc_version: "roborio"
Austin Schuhef147de2018-10-27 21:19:00 -0700510
Brian Silverman7b8899e2018-06-30 19:19:24 -0700511 builtin_sysroot: ""
Brian Silverman7b8899e2018-06-30 19:19:24 -0700512 needsPic: true
513 supports_gold_linker: false
514 supports_incremental_linker: false
515 supports_fission: false
516 supports_interface_shared_objects: false
517 supports_normalizing_ar: false
518 supports_start_end_lib: false
519 supports_thin_archives: false
Brian Silverman7b8899e2018-06-30 19:19:24 -0700520
521 tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" }
Austin Schuhf6b94632019-02-02 22:11:27 -0800522 tool_path { name: "as" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as" }
Brian Silverman7b8899e2018-06-30 19:19:24 -0700523 tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
524 tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" }
525 tool_path { name: "dwp" path: "/bin/false" }
526 tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" }
527 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
528 # C(++) compiles invoke the compiler (as that is the one knowing where
529 # to find libraries), but we provide LD so other rules can invoke the linker.
530 tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
531 tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" }
532 tool_path { name: "objcopy" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy" }
533 objcopy_embed_flag: "-I"
534 objcopy_embed_flag: "binary"
535 tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" }
536 tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" }
537 linking_mode_flags { mode: DYNAMIC }
538
Austin Schuhef147de2018-10-27 21:19:00 -0700539 feature {
540 name: "compile_flags1"
541 enabled: true
542 flag_set {
543 action: "assemble"
544 action: "preprocess-assemble"
545 action: "c-compile"
546 action: "c++-compile"
547 action: "c++-header-parsing"
548 action: "c++-module-compile"
549 action: "c++-module-codegen"
550 action: "lto-backend"
551 action: "clif-match"
552 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800553 flag: "--sysroot=external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi"
Austin Schuhef147de2018-10-27 21:19:00 -0700554 flag: "-nostdinc"
555 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800556 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 -0700557 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800558 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 -0800559 }
560 }
561
562 flag_set {
James Kuszmaulebdeaf52019-05-22 20:31:25 -0700563 action: "assemble"
564 action: "preprocess-assemble"
565 action: "c++-compile"
566 action: "c++-header-parsing"
567 action: "c++-header-preprocessing"
568 flag_group {
569 flag: "-fno-canonical-system-headers"
570 }
571 }
572
573 flag_set {
Austin Schuhf6b94632019-02-02 22:11:27 -0800574 action: "c++-compile"
575 action: "c++-header-parsing"
576 action: "c++-module-compile"
577 action: "c++-module-codegen"
578 flag_group {
Austin Schuhef147de2018-10-27 21:19:00 -0700579 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800580 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0"
Austin Schuhf6b94632019-02-02 22:11:27 -0800581 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800582 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 -0800583 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800584 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 -0800585 }
586 }
587
588 flag_set {
589 action: "assemble"
590 action: "preprocess-assemble"
591 action: "c-compile"
592 action: "c++-compile"
593 action: "c++-header-parsing"
594 action: "c++-module-compile"
595 action: "c++-module-codegen"
596 action: "lto-backend"
597 action: "clif-match"
598 flag_group {
599 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800600 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include"
Austin Schuhf6b94632019-02-02 22:11:27 -0800601
Austin Schuhef147de2018-10-27 21:19:00 -0700602 flag: "-mfpu=neon"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700603
Austin Schuhef147de2018-10-27 21:19:00 -0700604 # Things that the code wants defined.
605 flag: "-D__STDC_FORMAT_MACROS"
606 flag: "-D__STDC_CONSTANT_MACROS"
607 flag: "-D__STDC_LIMIT_MACROS"
608 flag: "-D_FILE_OFFSET_BITS=64"
609
610 # TODO(Brian): Rename this or something.
611 flag: "-DAOS_ARCHITECTURE_arm_frc"
612
613 # Security hardening on by default.
614 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
615 # We need to undef it before redefining it as some distributions now have
616 # it enabled by default.
617 flag: "-U_FORTIFY_SOURCE"
618 flag: "-fstack-protector"
619 flag: "-fPIE"
620
621 # Enable coloring even if there's no attached terminal. Bazel removes the
622 # escape sequences if --nocolor is specified.
623 flag: "-fdiagnostics-color=always"
624
625 flag: "-Wall"
626 flag: "-Wextra"
627 flag: "-Wpointer-arith"
628 flag: "-Wstrict-aliasing"
629 flag: "-Wcast-qual"
630 flag: "-Wcast-align"
631 flag: "-Wwrite-strings"
632 flag: "-Wtype-limits"
633 flag: "-Wsign-compare"
634 flag: "-Wformat=2"
635 flag: "-Werror"
636 flag: "-Wunused-local-typedefs"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800637 flag: "-Wno-cast-align"
Austin Schuhef147de2018-10-27 21:19:00 -0700638
639 # Keep stack frames for debugging, even in opt mode.
640 flag: "-fno-omit-frame-pointer"
641
642 flag: "-D__has_feature(x)=0"
643
644 # Don't use temp files while compiling.
645 flag: "-pipe"
646
647 # Enable debug symbols.
648 flag: "-ggdb3"
649 }
650 }
651 }
652
653 feature {
654 name: "opt"
655 implies: "opt_post"
656 flag_set {
657 action: "assemble"
658 action: "preprocess-assemble"
659 action: "c-compile"
660 action: "c++-compile"
661 action: "c++-module-compile"
662 action: "objc-compile"
663 action: "objc++-compile"
664 action: "c++-header-parsing"
665 action: "linkstamp-compile"
666 flag_group {
667 flag: "-O2"
668 flag: "-DNDEBUG"
669 flag: "-D_FORTIFY_SOURCE=1"
670 flag: "-ffunction-sections"
671 flag: "-fdata-sections"
672 }
673 }
674 flag_set {
675 action: "c++-link-executable"
676 action: "c++-link-nodeps-dynamic-library"
677 action: "c++-link-dynamic-library"
678 flag_group {
679 flag: "-Wl,--gc-sections"
680 }
681 }
682 }
683
Brian Silverman7b8899e2018-06-30 19:19:24 -0700684 # TODO(bazel-team): In theory, the path here ought to exactly match the path
685 # used by gcc. That works because bazel currently doesn't track files at
686 # absolute locations and has no remote execution, yet. However, this will need
687 # to be fixed, maybe with auto-detection?
Austin Schuhf6b94632019-02-02 22:11:27 -0800688
James Kuszmaul3ae42262019-11-08 12:33:41 -0800689 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)%"
690 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)%"
691 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi)%"
692 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 -0700693
694 linker_flag: "-lstdc++"
695 linker_flag: "-Ltools/cpp/arm-frc-linux-gnueabi/libs"
696
697 feature {
Austin Schuhef147de2018-10-27 21:19:00 -0700698 name: "dependency_file"
699 flag_set {
700 action: "assemble"
701 action: "preprocess-assemble"
702 action: "c-compile"
703 action: "c++-compile"
704 action: "c++-module-compile"
705 action: "objc-compile"
706 action: "objc++-compile"
707 action: "c++-header-parsing"
708 action: "clif-match"
709 expand_if_all_available: "dependency_file"
710 flag_group {
711 flag: "-MD"
712 flag: "-MF"
713 flag: "%{dependency_file}"
714 }
715 }
716 }
717
718 feature {
719 name: "random_seed"
720 flag_set {
721 # TODO(austin): Should these also have -frandom-seed set? Upstream
722 # doesn't.
723 # action: "linkstamp-compile"
724 # action: "c-compile"
725 action: "c++-compile"
726 action: "c++-module-codegen"
727 action: "c++-module-compile"
728 flag_group {
729 expand_if_all_available: "output_file"
730 flag: "-frandom-seed=%{output_file}"
731 }
732 }
733 }
734
735 feature {
736 name: "pic"
737 flag_set {
738 action: "assemble"
739 action: "preprocess-assemble"
740 action: "linkstamp-compile"
741 action: "c-compile"
742 action: "c++-compile"
743 action: "c++-module-codegen"
744 action: "c++-module-compile"
745 expand_if_all_available: "pic"
746 flag_group {
747 flag: "-fPIC"
748 }
749 }
750 }
751
752 feature {
753 name: "preprocessor_defines"
754 flag_set {
755 action: "preprocess-assemble"
756 action: "linkstamp-compile"
757 action: "c-compile"
758 action: "c++-compile"
759 action: "c++-header-parsing"
760 action: "c++-module-compile"
761 action: "clif-match"
762 flag_group {
763 iterate_over: "preprocessor_defines"
764 flag: "-D%{preprocessor_defines}"
765 }
766 }
767 }
768
769 feature {
770 name: "include_paths"
771 flag_set {
772 action: "preprocess-assemble"
773 action: "c-compile"
774 action: "c++-compile"
775 action: "c++-header-parsing"
776 action: "c++-header-preprocessing"
777 action: "c++-module-compile"
778 flag_group {
779 flag: "-iquote"
780 flag: "%{quote_include_paths}"
781 iterate_over: "quote_include_paths"
782 }
783 flag_group {
784 flag: "-I%{include_paths}"
785 iterate_over: "include_paths"
786 }
787 flag_group {
788 flag: "-isystem"
789 flag: "%{system_include_paths}"
790 iterate_over: "system_include_paths"
791 }
792 }
793 }
794
795 feature {
796 name: "opt_post"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700797 flag_set {
798 action: "preprocess-assemble"
799 action: "c-compile"
800 action: "c++-compile"
801 action: "c++-header-parsing"
802 action: "c++-header-preprocessing"
803 action: "c++-module-compile"
804 flag_group {
805 flag: "-DAOS_DEBUG=0"
806 }
807 }
808 }
809
810 feature {
811 name: "dbg"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700812 flag_set {
813 action: "preprocess-assemble"
814 action: "c-compile"
815 action: "c++-compile"
816 action: "c++-header-parsing"
817 action: "c++-header-preprocessing"
818 action: "c++-module-compile"
819 flag_group {
820 flag: "-DAOS_DEBUG=1"
821 }
822 flag_group {
823 flag: "-fno-omit-frame-pointer"
824 }
825 }
826 }
827
828 feature {
829 name: "fastbuild"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700830 flag_set {
831 action: "preprocess-assemble"
832 action: "c-compile"
833 action: "c++-compile"
834 action: "c++-header-parsing"
835 action: "c++-header-preprocessing"
836 action: "c++-module-compile"
837 flag_group {
838 flag: "-DAOS_DEBUG=0"
839 }
840 }
841 }
842
843 feature {
844 name: "all_modes"
Austin Schuhef147de2018-10-27 21:19:00 -0700845 enabled: true
Brian Silverman7b8899e2018-06-30 19:19:24 -0700846 flag_set {
847 action: "preprocess-assemble"
848 action: "assemble"
849 action: "c-compile"
850 flag_group {
851 flag: "-std=gnu99"
852 }
853 }
854 flag_set {
855 action: "c++-compile"
856 action: "c++-header-parsing"
857 action: "c++-header-preprocessing"
858 action: "c++-module-compile"
859 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800860 flag: "-std=gnu++1z"
Austin Schuhf6b94632019-02-02 22:11:27 -0800861 flag: "-fno-sized-deallocation"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700862 }
863 }
864 flag_set {
865 action: "preprocess-assemble"
866 action: "assemble"
867 action: "c++-link"
868 action: "c++-compile"
869 action: "c++-header-parsing"
870 action: "c++-header-preprocessing"
871 action: "c++-module-compile"
872 action: "c-compile"
873 flag_group {
874 # We always want to compile with -pthread semantics.
875 flag: "-pthread"
876 }
877 }
878 }
879
Brian Silverman7b8899e2018-06-30 19:19:24 -0700880 # 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
Brian Silverman7b8899e2018-06-30 19:19:24 -0700885 # Make C++ compilation deterministic. Use linkstamping instead of these
886 # compiler symbols.
887 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
888 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
889 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
890 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
891
Brian Silverman7b8899e2018-06-30 19:19:24 -0700892 linker_flag: "-Wl,-z,relro,-z,now"
893
894 # Pretty much everything needs this, including parts of the glibc STL...
895 linker_flag: "-lm"
896
Brian Silverman7b8899e2018-06-30 19:19:24 -0700897 # Have GCC return the exit code from ld.
898 linker_flag: "-pass-exit-codes"
899
900 # Stamp the binary with a unique identifier.
901 linker_flag: "-Wl,--build-id=md5"
902 linker_flag: "-Wl,--hash-style=gnu"
903 #linker_flag: "-Wl,--warn-execstack"
904 #linker_flag: "-Wl,--detect-odr-violations"
905
Brian Silverman7b8899e2018-06-30 19:19:24 -0700906 feature {
907 name: "pie_for_linking"
908 enabled: true
909 flag_set {
910 action: "c++-link-executable"
911 flag_group {
912 flag: "-pie"
913 }
914 }
915 }
916}
917
918toolchain {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800919 abi_version: "clang_6.0"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700920 abi_libc_version: "glibc_2.19"
921 builtin_sysroot: ""
922 compiler: "clang"
923 host_system_name: "linux"
924 needsPic: true
925 supports_gold_linker: false
926 supports_incremental_linker: false
927 supports_fission: false
928 supports_interface_shared_objects: false
929 supports_normalizing_ar: true
930 supports_start_end_lib: false
931 supports_thin_archives: true
932 target_libc: "glibc_2.19"
933 target_cpu: "armhf-debian"
934 target_system_name: "arm_a15"
935 toolchain_identifier: "clang_linux_armhf"
936
937 tool_path { name: "ar" path: "linaro_linux_gcc/arm-linux-gnueabihf-ar" }
938 tool_path { name: "compat-ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
939 tool_path { name: "cpp" path: "linaro_linux_gcc/clang_bin/clang" }
940 tool_path { name: "dwp" path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp" }
941 tool_path { name: "gcc" path: "linaro_linux_gcc/clang_bin/clang" }
942 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
943 # C(++) compiles invoke the compiler (as that is the one knowing where
944 # to find libraries), but we provide LD so other rules can invoke the linker.
945 tool_path { name: "ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
946 tool_path { name: "nm" path: "linaro_linux_gcc/arm-linux-gnueabihf-nm" }
947 tool_path { name: "objcopy" path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy" }
948 objcopy_embed_flag: "-I"
949 objcopy_embed_flag: "binary"
950 tool_path { name: "objdump" path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump" }
951 tool_path { name: "strip" path: "linaro_linux_gcc/arm-linux-gnueabihf-strip" }
952 linking_mode_flags { mode: DYNAMIC }
953
954 compiler_flag: "-target"
955 compiler_flag: "armv7a-arm-linux-gnueabif"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800956 compiler_flag: "--sysroot=external/linaro_linux_gcc_repo/arm-linux-gnueabihf/libc"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700957 compiler_flag: "-mfloat-abi=hard"
958 compiler_flag: "-mfpu=vfpv3-d16"
959
960 compiler_flag: "-nostdinc"
961 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800962 compiler_flag: "/usr/lib/clang/6.0/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700963 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800964 compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700965 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800966 compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700967 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800968 compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf"
969 compiler_flag: "-isystem"
970 compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1"
971 compiler_flag: "-isystem"
972 compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1/arm-linux-gnueabihf"
973 compiler_flag: "-isystem"
974 compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1"
975 compiler_flag: "-isystem"
976 compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/libc/usr/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700977
James Kuszmaul3ae42262019-11-08 12:33:41 -0800978 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%"
979 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/libc/usr/include)%"
980 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/libc/usr/lib/include)%"
981 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%"
982 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%/c++/7.4.1"
983 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/7.4.1/include)%"
984 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%"
985 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include)%"
986 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%"
987 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/include)%/c++/7.4.1"
988 cxx_builtin_include_directory: '/usr/lib/clang/6.0/include'
Brian Silverman7b8899e2018-06-30 19:19:24 -0700989
990 linker_flag: "-target"
991 linker_flag: "armv7a-arm-linux-gnueabif"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800992 linker_flag: "--sysroot=external/linaro_linux_gcc_repo/arm-linux-gnueabihf/libc"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700993 linker_flag: "-lstdc++"
994 linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800995 linker_flag: "-Lexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/lib"
996 linker_flag: "-Lexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/libc/lib"
997 linker_flag: "-Lexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/libc/usr/lib"
998 linker_flag: "-Lexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
999 linker_flag: "-Bexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
1000 linker_flag: "-Bexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/bin"
Brian Silverman7b8899e2018-06-30 19:19:24 -07001001 linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3"
1002
1003 feature {
1004 name: "opt"
1005 implies: "all_modes"
1006 flag_set {
1007 action: "preprocess-assemble"
1008 action: "c-compile"
1009 action: "c++-compile"
1010 action: "c++-header-parsing"
1011 action: "c++-header-preprocessing"
1012 action: "c++-module-compile"
1013 flag_group {
1014 flag: "-DAOS_DEBUG=0"
1015 }
1016 }
1017 }
1018
1019 feature {
1020 name: "dbg"
1021 implies: "all_modes"
1022 flag_set {
1023 action: "preprocess-assemble"
1024 action: "c-compile"
1025 action: "c++-compile"
1026 action: "c++-header-parsing"
1027 action: "c++-header-preprocessing"
1028 action: "c++-module-compile"
1029 flag_group {
1030 flag: "-DAOS_DEBUG=1"
1031 }
1032 flag_group {
1033 flag: "-fno-omit-frame-pointer"
1034 }
1035 }
1036 }
1037
1038 feature {
1039 name: "fastbuild"
1040 implies: "all_modes"
1041 flag_set {
1042 action: "preprocess-assemble"
1043 action: "c-compile"
1044 action: "c++-compile"
1045 action: "c++-header-parsing"
1046 action: "c++-header-preprocessing"
1047 action: "c++-module-compile"
1048 flag_group {
1049 flag: "-DAOS_DEBUG=0"
1050 }
1051 }
1052 }
1053
1054 feature {
1055 name: "all_modes"
1056 flag_set {
1057 action: "preprocess-assemble"
1058 action: "assemble"
1059 action: "c-compile"
1060 flag_group {
1061 flag: "-std=gnu99"
1062 }
1063 }
1064 flag_set {
1065 action: "c++-compile"
1066 action: "c++-header-parsing"
1067 action: "c++-header-preprocessing"
1068 action: "c++-module-compile"
1069 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -08001070 flag: "-std=gnu++1z"
Brian Silverman7b8899e2018-06-30 19:19:24 -07001071 }
1072 }
1073 flag_set {
1074 action: "preprocess-assemble"
1075 action: "assemble"
1076 action: "c++-link"
1077 action: "c++-compile"
1078 action: "c++-header-parsing"
1079 action: "c++-header-preprocessing"
1080 action: "c++-module-compile"
1081 action: "c-compile"
1082 flag_group {
1083 # We always want to compile with -pthread semantics.
1084 flag: "-pthread"
1085 }
1086 }
1087 }
1088
1089 # Anticipated future default.
1090 # This makes GCC and Clang do what we want when called through symlinks.
1091 unfiltered_cxx_flag: "-no-canonical-prefixes"
1092 linker_flag: "-no-canonical-prefixes"
1093
1094 # Things that the code wants defined.
1095 compiler_flag: "-D__STDC_FORMAT_MACROS"
1096 compiler_flag: "-D__STDC_CONSTANT_MACROS"
1097 compiler_flag: "-D__STDC_LIMIT_MACROS"
1098 compiler_flag: "-D_FILE_OFFSET_BITS=64"
1099 # TODO(Brian): Rename this or something.
1100 compiler_flag: "-DAOS_ARCHITECTURE_armhf"
1101
1102 # Make C++ compilation deterministic. Use linkstamping instead of these
1103 # compiler symbols.
1104 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
James Kuszmaul3ae42262019-11-08 12:33:41 -08001105 unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
1106 unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
1107 unfiltered_cxx_flag: "-Wno-varargs"
Brian Silverman7b8899e2018-06-30 19:19:24 -07001108 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
1109 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
1110 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
1111
1112 # Security hardening on by default.
1113 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
1114 # We need to undef it before redefining it as some distributions now have
1115 # it enabled by default.
1116 compiler_flag: "-U_FORTIFY_SOURCE"
1117 compiler_flag: "-fstack-protector"
1118 compiler_flag: "-fPIE"
1119 linker_flag: "-Wl,-z,relro,-z,now"
1120
1121 # Pretty much everything needs this, including parts of the glibc STL...
1122 linker_flag: "-lm"
1123
1124 # Enable coloring even if there's no attached terminal. Bazel removes the
1125 # escape sequences if --nocolor is specified.
1126 compiler_flag: "-fdiagnostics-color=always"
1127
1128 compiler_flag: "-Wall"
1129 compiler_flag: "-Wextra"
1130 compiler_flag: "-Wpointer-arith"
1131 compiler_flag: "-Wstrict-aliasing"
1132 compiler_flag: "-Wcast-qual"
1133 compiler_flag: "-Wcast-align"
1134 compiler_flag: "-Wwrite-strings"
1135 compiler_flag: "-Wtype-limits"
1136 compiler_flag: "-Wsign-compare"
1137 compiler_flag: "-Wformat=2"
1138 compiler_flag: "-Werror"
1139 compiler_flag: "-Wunused-local-typedefs"
1140
1141 # Keep stack frames for debugging, even in opt mode.
1142 compiler_flag: "-fno-omit-frame-pointer"
1143
1144 # Don't use temp files while compiling.
1145 compiler_flag: "-pipe"
1146
1147 # Stamp the binary with a unique identifier.
1148 linker_flag: "-Wl,--build-id=md5"
1149 linker_flag: "-Wl,--hash-style=gnu"
1150 #linker_flag: "-Wl,--warn-execstack"
1151 #linker_flag: "-Wl,--detect-odr-violations"
1152
1153 # Enable debug symbols.
1154 compiler_flag: "-ggdb3"
1155
1156 compilation_mode_flags {
1157 mode: OPT
1158
1159 compiler_flag: "-O2"
1160
1161 # Disable assertions
1162 compiler_flag: "-DNDEBUG"
1163 compiler_flag: "-D_FORTIFY_SOURCE=1"
1164
1165 # Removal of unused code and data at link time (can this increase binary size in some cases?).
1166 compiler_flag: "-ffunction-sections"
1167 compiler_flag: "-fdata-sections"
1168 linker_flag: "-Wl,--gc-sections"
1169 }
1170 feature {
1171 name: "pie_for_linking"
1172 enabled: true
1173 flag_set {
1174 action: "c++-link-executable"
1175 flag_group {
1176 flag: "-pie"
1177 }
1178 }
1179 }
1180}