blob: 8552dff4a121b4712d5d2a9b28e84f62d22dce61 [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 }
Brian Silverman7b8899e2018-06-30 19:19:24 -0700221 }
222
223 # Anticipated future default.
224 # This makes GCC and Clang do what we want when called through symlinks.
225 unfiltered_cxx_flag: "-no-canonical-prefixes"
226 linker_flag: "-no-canonical-prefixes"
227
228 # Things that the code wants defined.
229 compiler_flag: "-D__STDC_FORMAT_MACROS"
230 compiler_flag: "-D__STDC_CONSTANT_MACROS"
231 compiler_flag: "-D__STDC_LIMIT_MACROS"
232 compiler_flag: "-D_FILE_OFFSET_BITS=64"
233 # TODO(Brian): Rename this or something.
234 compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
235
236 linker_flag: "-fuse-ld=gold"
237
238 # Make C++ compilation deterministic. Use linkstamping instead of these
239 # compiler symbols.
240 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
241 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
242 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
243 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
244
James Kuszmaul3ae42262019-11-08 12:33:41 -0800245 # C++17 libraries that tend to cause issues in some libraries that we include.
246 unfiltered_cxx_flag: "-Wno-varargs"
247 unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
248 # The mismatched-new-delete seems to be a bit overly strict currently
249 # and errors on:
250 # char *p = new char;
251 # delete p;
252 # p = new char[100];
253 # delete[] p;
254 unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
255
Brian Silverman7b8899e2018-06-30 19:19:24 -0700256 # Security hardening on by default.
257 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
258 # We need to undef it before redefining it as some distributions now have
259 # it enabled by default.
260 compiler_flag: "-U_FORTIFY_SOURCE"
261 compiler_flag: "-D_FORTIFY_SOURCE=1"
262 compiler_flag: "-fstack-protector"
263 compiler_flag: "-fPIE"
264 linker_flag: "-Wl,-z,relro,-z,now"
265
266 # Pretty much everything needs this, including parts of the glibc STL...
267 linker_flag: "-lm"
268
269 # Enable coloring even if there's no attached terminal. Bazel removes the
270 # escape sequences if --nocolor is specified.
271 compiler_flag: "-fcolor-diagnostics"
272 compiler_flag: "-fmessage-length=80"
273 compiler_flag: "-fmacro-backtrace-limit=0"
274
275 compiler_flag: "-Wall"
276 compiler_flag: "-Wextra"
277 compiler_flag: "-Wpointer-arith"
278 compiler_flag: "-Wstrict-aliasing"
279 compiler_flag: "-Wcast-qual"
280 compiler_flag: "-Wcast-align"
281 compiler_flag: "-Wwrite-strings"
282 compiler_flag: "-Wtype-limits"
283 compiler_flag: "-Wsign-compare"
284 compiler_flag: "-Wformat=2"
285 compiler_flag: "-Werror"
286
287 # Keep stack frames for debugging, even in opt mode.
288 compiler_flag: "-fno-omit-frame-pointer"
289
290 # Don't use temp files while compiling.
291 compiler_flag: "-pipe"
292
293 # Stamp the binary with a unique identifier.
294 linker_flag: "-Wl,--build-id=md5"
295 linker_flag: "-Wl,--hash-style=gnu"
296 linker_flag: "-Wl,--warn-execstack"
297 linker_flag: "-Wl,--detect-odr-violations"
298
299 # Enable debug symbols.
300 compiler_flag: "-ggdb3"
301
302 compilation_mode_flags {
303 mode: OPT
304
305 compiler_flag: "-O2"
306
307 # Disable assertions
308 compiler_flag: "-DNDEBUG"
309
310 # Removal of unused code and data at link time (can this increase binary size in some cases?).
311 compiler_flag: "-ffunction-sections"
312 compiler_flag: "-fdata-sections"
313 linker_flag: "-Wl,--gc-sections"
314 }
315 feature {
316 name: "pie_for_linking"
317 enabled: true
318 flag_set {
319 action: "c++-link-executable"
320 flag_group {
321 flag: "-pie"
322 }
323 }
324 }
325}
326
327toolchain {
James Kuszmaul27da8142019-07-21 16:13:55 -0700328 # This toolchain was initially sourced from https://github.com/ribrdb/rules_emscripten
329 toolchain_identifier: "emscripten_toolchain"
330 host_system_name: "web"
331 target_system_name: "emscripten-unknown-emscripten"
332 target_cpu: "web"
333 target_libc: "unknown"
334 compiler: "emscripten"
335 abi_version: "unknown"
336 abi_libc_version: "unknown"
337 tool_path {
338 name: "gcc"
339 path: "emscripten/emcc.sh"
340 }
341 tool_path {
342 name: "ld"
343 path: "emscripten/emcc.sh"
344 }
345 tool_path {
346 name: "ar"
347 path: "emscripten/emar.sh"
348 }
349 tool_path {
350 name: "cpp"
351 path: "/bin/false"
352 }
353 tool_path {
354 name: "gcov"
355 path: "/bin/false"
356 }
357 tool_path {
358 name: "nm"
359 path: "/bin/false"
360 }
361 tool_path {
362 name: "objdump"
363 path: "/bin/false"
364 }
365 tool_path {
366 name: "objcopy"
367 path: "/bin/false"
368 }
369 tool_path {
370 name: "strip"
371 path: "/bin/false"
372 }
373
374 unfiltered_cxx_flag: "-isystem"
375 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/libcxx"
376 unfiltered_cxx_flag: "-isystem"
377 unfiltered_cxx_flag: "external/emscripten_toolchain/system/lib/libcxxabi/include"
378 unfiltered_cxx_flag: "-isystem"
379 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/compat"
380 compiler_flag: "-isystem"
381 compiler_flag: "external/emscripten_toolchain/system/include"
382 unfiltered_cxx_flag: "-isystem"
383 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include"
384 unfiltered_cxx_flag: "-isystem"
385 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/SSE"
386 unfiltered_cxx_flag: "-isystem"
387 unfiltered_cxx_flag: "external/emscripten_toolchain/system/include/libc"
388 unfiltered_cxx_flag: "-isystem"
389 unfiltered_cxx_flag: "external/emscripten_toolchain/system/lib/libc/musl/arch/emscripten"
390 unfiltered_cxx_flag: "-isystem"
391 unfiltered_cxx_flag: "external/emscripten_toolchain/system/local/include"
392
393 # Turn off exceptions since emscripten has issues catching them
394 compiler_flag: "-fno-exceptions"
395
396 unfiltered_cxx_flag: "-no-canonical-prefixes"
397 linker_flag: "-no-canonical-prefixes"
398
399 # Make C++ compilation deterministic. Use linkstamping instead of these
400 # compiler symbols.
401 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
402 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
403 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
404 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
405 # Enable coloring even if there's no attached terminal. Bazel removes the
406 # escape sequences if --nocolor is specified.
407 compiler_flag: "-fdiagnostics-color=always"
408 compiler_flag: "-Wall"
409 compiler_flag: "-Werror"
410
411 compiler_flag: "-ffunction-sections"
412 compiler_flag: "-fdata-sections"
413
414 feature {
415 name: "opt"
416 flag_set {
417 action: "preprocess-assemble"
418 action: "c-compile"
419 action: "c++-compile"
420 action: "c++-header-parsing"
421 action: "c++-header-preprocessing"
422 action: "c++-module-compile"
423 flag_group {
424 flag: "-DAOS_DEBUG=0"
425 flag: "-O2"
426 flag: "--closure"
427 flag: "1"
428 }
429 }
430 implies: "all_modes"
431 }
432 feature {
433 name: "dbg"
434 flag_set {
435 action: "preprocess-assemble"
436 action: "c-compile"
437 action: "c++-compile"
438 action: "c++-header-parsing"
439 action: "c++-header-preprocessing"
440 action: "c++-module-compile"
441 flag_group {
442 flag: "-DAOS_DEBUG=1"
443 }
444 flag_group {
445 flag: "-fno-omit-frame-pointer"
446 }
447 }
448 implies: "all_modes"
449 }
450 feature {
451 name: "fastbuild"
452 flag_set {
453 action: "preprocess-assemble"
454 action: "c-compile"
455 action: "c++-compile"
456 action: "c++-header-parsing"
457 action: "c++-header-preprocessing"
458 action: "c++-module-compile"
459 flag_group {
460 flag: "-DAOS_DEBUG=0"
461 }
462 }
463 implies: "all_modes"
464 }
465 feature {
466 name: "all_modes"
467 flag_set {
468 action: "preprocess-assemble"
469 action: "assemble"
470 action: "c-compile"
471 flag_group {
472 flag: "-std=gnu99"
473 }
474 }
475 flag_set {
476 action: "c++-compile"
477 action: "c++-header-parsing"
478 action: "c++-header-preprocessing"
479 action: "c++-module-compile"
480 flag_group {
481 flag: "-std=gnu++1y"
482 }
483 }
484 }
485}
486
487toolchain {
Austin Schuhef147de2018-10-27 21:19:00 -0700488 toolchain_identifier: "roborio_linux"
489 host_system_name: "roborio"
490 target_system_name: "roborio"
491 target_cpu: "roborio"
492 target_libc: "roborio"
493 compiler: "gcc"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700494 abi_version: "roborio"
495 abi_libc_version: "roborio"
Austin Schuhef147de2018-10-27 21:19:00 -0700496
Brian Silverman7b8899e2018-06-30 19:19:24 -0700497 builtin_sysroot: ""
Brian Silverman7b8899e2018-06-30 19:19:24 -0700498 needsPic: true
499 supports_gold_linker: false
500 supports_incremental_linker: false
501 supports_fission: false
502 supports_interface_shared_objects: false
503 supports_normalizing_ar: false
504 supports_start_end_lib: false
505 supports_thin_archives: false
Brian Silverman7b8899e2018-06-30 19:19:24 -0700506
507 tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" }
Austin Schuhf6b94632019-02-02 22:11:27 -0800508 tool_path { name: "as" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as" }
Brian Silverman7b8899e2018-06-30 19:19:24 -0700509 tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
510 tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" }
511 tool_path { name: "dwp" path: "/bin/false" }
512 tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" }
513 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
514 # C(++) compiles invoke the compiler (as that is the one knowing where
515 # to find libraries), but we provide LD so other rules can invoke the linker.
516 tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
517 tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" }
518 tool_path { name: "objcopy" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy" }
519 objcopy_embed_flag: "-I"
520 objcopy_embed_flag: "binary"
521 tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" }
522 tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" }
523 linking_mode_flags { mode: DYNAMIC }
524
Austin Schuhef147de2018-10-27 21:19:00 -0700525 feature {
526 name: "compile_flags1"
527 enabled: true
528 flag_set {
529 action: "assemble"
530 action: "preprocess-assemble"
531 action: "c-compile"
532 action: "c++-compile"
533 action: "c++-header-parsing"
534 action: "c++-module-compile"
535 action: "c++-module-codegen"
536 action: "lto-backend"
537 action: "clif-match"
538 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800539 flag: "--sysroot=external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi"
Austin Schuhef147de2018-10-27 21:19:00 -0700540 flag: "-nostdinc"
541 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800542 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 -0700543 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800544 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 -0800545 }
546 }
547
548 flag_set {
James Kuszmaulebdeaf52019-05-22 20:31:25 -0700549 action: "assemble"
550 action: "preprocess-assemble"
551 action: "c++-compile"
552 action: "c++-header-parsing"
553 action: "c++-header-preprocessing"
554 flag_group {
555 flag: "-fno-canonical-system-headers"
556 }
557 }
558
559 flag_set {
Austin Schuhf6b94632019-02-02 22:11:27 -0800560 action: "c++-compile"
561 action: "c++-header-parsing"
562 action: "c++-module-compile"
563 action: "c++-module-codegen"
564 flag_group {
Austin Schuhef147de2018-10-27 21:19:00 -0700565 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800566 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0"
Austin Schuhf6b94632019-02-02 22:11:27 -0800567 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800568 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 -0800569 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800570 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 -0800571 }
572 }
573
574 flag_set {
575 action: "assemble"
576 action: "preprocess-assemble"
577 action: "c-compile"
578 action: "c++-compile"
579 action: "c++-header-parsing"
580 action: "c++-module-compile"
581 action: "c++-module-codegen"
582 action: "lto-backend"
583 action: "clif-match"
584 flag_group {
585 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800586 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include"
Austin Schuhf6b94632019-02-02 22:11:27 -0800587
Austin Schuhef147de2018-10-27 21:19:00 -0700588 flag: "-mfpu=neon"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700589
Austin Schuhef147de2018-10-27 21:19:00 -0700590 # Things that the code wants defined.
591 flag: "-D__STDC_FORMAT_MACROS"
592 flag: "-D__STDC_CONSTANT_MACROS"
593 flag: "-D__STDC_LIMIT_MACROS"
594 flag: "-D_FILE_OFFSET_BITS=64"
595
596 # TODO(Brian): Rename this or something.
597 flag: "-DAOS_ARCHITECTURE_arm_frc"
598
599 # Security hardening on by default.
600 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
601 # We need to undef it before redefining it as some distributions now have
602 # it enabled by default.
603 flag: "-U_FORTIFY_SOURCE"
604 flag: "-fstack-protector"
605 flag: "-fPIE"
606
607 # Enable coloring even if there's no attached terminal. Bazel removes the
608 # escape sequences if --nocolor is specified.
609 flag: "-fdiagnostics-color=always"
610
611 flag: "-Wall"
612 flag: "-Wextra"
613 flag: "-Wpointer-arith"
614 flag: "-Wstrict-aliasing"
615 flag: "-Wcast-qual"
Austin Schuhef147de2018-10-27 21:19:00 -0700616 flag: "-Wwrite-strings"
617 flag: "-Wtype-limits"
618 flag: "-Wsign-compare"
619 flag: "-Wformat=2"
620 flag: "-Werror"
621 flag: "-Wunused-local-typedefs"
Brian Silverman21280c72019-12-18 20:26:12 -0800622 # We don't use libraries compiled with the broken version.
623 flag: "-Wno-psabi"
Austin Schuhef147de2018-10-27 21:19:00 -0700624
625 # Keep stack frames for debugging, even in opt mode.
626 flag: "-fno-omit-frame-pointer"
627
628 flag: "-D__has_feature(x)=0"
629
630 # Don't use temp files while compiling.
631 flag: "-pipe"
632
633 # Enable debug symbols.
634 flag: "-ggdb3"
635 }
636 }
637 }
638
639 feature {
640 name: "opt"
641 implies: "opt_post"
642 flag_set {
643 action: "assemble"
644 action: "preprocess-assemble"
645 action: "c-compile"
646 action: "c++-compile"
647 action: "c++-module-compile"
648 action: "objc-compile"
649 action: "objc++-compile"
650 action: "c++-header-parsing"
651 action: "linkstamp-compile"
652 flag_group {
653 flag: "-O2"
654 flag: "-DNDEBUG"
655 flag: "-D_FORTIFY_SOURCE=1"
656 flag: "-ffunction-sections"
657 flag: "-fdata-sections"
658 }
659 }
660 flag_set {
661 action: "c++-link-executable"
662 action: "c++-link-nodeps-dynamic-library"
663 action: "c++-link-dynamic-library"
664 flag_group {
665 flag: "-Wl,--gc-sections"
666 }
667 }
668 }
669
Brian Silverman7b8899e2018-06-30 19:19:24 -0700670 # TODO(bazel-team): In theory, the path here ought to exactly match the path
671 # used by gcc. That works because bazel currently doesn't track files at
672 # absolute locations and has no remote execution, yet. However, this will need
673 # to be fixed, maybe with auto-detection?
Austin Schuhf6b94632019-02-02 22:11:27 -0800674
James Kuszmaul3ae42262019-11-08 12:33:41 -0800675 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)%"
676 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)%"
677 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi)%"
678 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 -0700679
680 linker_flag: "-lstdc++"
681 linker_flag: "-Ltools/cpp/arm-frc-linux-gnueabi/libs"
682
683 feature {
Austin Schuhef147de2018-10-27 21:19:00 -0700684 name: "dependency_file"
685 flag_set {
686 action: "assemble"
687 action: "preprocess-assemble"
688 action: "c-compile"
689 action: "c++-compile"
690 action: "c++-module-compile"
691 action: "objc-compile"
692 action: "objc++-compile"
693 action: "c++-header-parsing"
694 action: "clif-match"
695 expand_if_all_available: "dependency_file"
696 flag_group {
697 flag: "-MD"
698 flag: "-MF"
699 flag: "%{dependency_file}"
700 }
701 }
702 }
703
704 feature {
705 name: "random_seed"
706 flag_set {
707 # TODO(austin): Should these also have -frandom-seed set? Upstream
708 # doesn't.
709 # action: "linkstamp-compile"
710 # action: "c-compile"
711 action: "c++-compile"
712 action: "c++-module-codegen"
713 action: "c++-module-compile"
714 flag_group {
715 expand_if_all_available: "output_file"
716 flag: "-frandom-seed=%{output_file}"
717 }
718 }
719 }
720
721 feature {
722 name: "pic"
723 flag_set {
724 action: "assemble"
725 action: "preprocess-assemble"
726 action: "linkstamp-compile"
727 action: "c-compile"
728 action: "c++-compile"
729 action: "c++-module-codegen"
730 action: "c++-module-compile"
731 expand_if_all_available: "pic"
732 flag_group {
733 flag: "-fPIC"
734 }
735 }
736 }
737
738 feature {
739 name: "preprocessor_defines"
740 flag_set {
741 action: "preprocess-assemble"
742 action: "linkstamp-compile"
743 action: "c-compile"
744 action: "c++-compile"
745 action: "c++-header-parsing"
746 action: "c++-module-compile"
747 action: "clif-match"
748 flag_group {
749 iterate_over: "preprocessor_defines"
750 flag: "-D%{preprocessor_defines}"
751 }
752 }
753 }
754
755 feature {
756 name: "include_paths"
757 flag_set {
758 action: "preprocess-assemble"
759 action: "c-compile"
760 action: "c++-compile"
761 action: "c++-header-parsing"
762 action: "c++-header-preprocessing"
763 action: "c++-module-compile"
764 flag_group {
765 flag: "-iquote"
766 flag: "%{quote_include_paths}"
767 iterate_over: "quote_include_paths"
768 }
769 flag_group {
770 flag: "-I%{include_paths}"
771 iterate_over: "include_paths"
772 }
773 flag_group {
774 flag: "-isystem"
775 flag: "%{system_include_paths}"
776 iterate_over: "system_include_paths"
777 }
778 }
779 }
780
781 feature {
782 name: "opt_post"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700783 flag_set {
784 action: "preprocess-assemble"
785 action: "c-compile"
786 action: "c++-compile"
787 action: "c++-header-parsing"
788 action: "c++-header-preprocessing"
789 action: "c++-module-compile"
790 flag_group {
791 flag: "-DAOS_DEBUG=0"
792 }
793 }
794 }
795
796 feature {
797 name: "dbg"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700798 flag_set {
799 action: "preprocess-assemble"
800 action: "c-compile"
801 action: "c++-compile"
802 action: "c++-header-parsing"
803 action: "c++-header-preprocessing"
804 action: "c++-module-compile"
805 flag_group {
806 flag: "-DAOS_DEBUG=1"
807 }
808 flag_group {
809 flag: "-fno-omit-frame-pointer"
810 }
811 }
812 }
813
814 feature {
815 name: "fastbuild"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700816 flag_set {
817 action: "preprocess-assemble"
818 action: "c-compile"
819 action: "c++-compile"
820 action: "c++-header-parsing"
821 action: "c++-header-preprocessing"
822 action: "c++-module-compile"
823 flag_group {
824 flag: "-DAOS_DEBUG=0"
825 }
826 }
827 }
828
829 feature {
830 name: "all_modes"
Austin Schuhef147de2018-10-27 21:19:00 -0700831 enabled: true
Brian Silverman7b8899e2018-06-30 19:19:24 -0700832 flag_set {
833 action: "preprocess-assemble"
834 action: "assemble"
835 action: "c-compile"
836 flag_group {
837 flag: "-std=gnu99"
838 }
839 }
840 flag_set {
841 action: "c++-compile"
842 action: "c++-header-parsing"
843 action: "c++-header-preprocessing"
844 action: "c++-module-compile"
845 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800846 flag: "-std=gnu++1z"
Austin Schuhf6b94632019-02-02 22:11:27 -0800847 flag: "-fno-sized-deallocation"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700848 }
849 }
850 flag_set {
851 action: "preprocess-assemble"
852 action: "assemble"
853 action: "c++-link"
854 action: "c++-compile"
855 action: "c++-header-parsing"
856 action: "c++-header-preprocessing"
857 action: "c++-module-compile"
858 action: "c-compile"
859 flag_group {
860 # We always want to compile with -pthread semantics.
861 flag: "-pthread"
862 }
863 }
864 }
865
Brian Silverman7b8899e2018-06-30 19:19:24 -0700866 # Anticipated future default.
867 # This makes GCC and Clang do what we want when called through symlinks.
868 unfiltered_cxx_flag: "-no-canonical-prefixes"
869 linker_flag: "-no-canonical-prefixes"
870
Brian Silverman7b8899e2018-06-30 19:19:24 -0700871 # Make C++ compilation deterministic. Use linkstamping instead of these
872 # compiler symbols.
873 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
874 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
875 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
876 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
877
Brian Silverman7b8899e2018-06-30 19:19:24 -0700878 linker_flag: "-Wl,-z,relro,-z,now"
879
880 # Pretty much everything needs this, including parts of the glibc STL...
881 linker_flag: "-lm"
882
Brian Silverman7b8899e2018-06-30 19:19:24 -0700883 # Have GCC return the exit code from ld.
884 linker_flag: "-pass-exit-codes"
885
886 # Stamp the binary with a unique identifier.
887 linker_flag: "-Wl,--build-id=md5"
888 linker_flag: "-Wl,--hash-style=gnu"
889 #linker_flag: "-Wl,--warn-execstack"
890 #linker_flag: "-Wl,--detect-odr-violations"
891
Brian Silverman7b8899e2018-06-30 19:19:24 -0700892 feature {
893 name: "pie_for_linking"
894 enabled: true
895 flag_set {
896 action: "c++-link-executable"
897 flag_group {
898 flag: "-pie"
899 }
900 }
901 }
902}
903
904toolchain {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800905 abi_version: "clang_6.0"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700906 abi_libc_version: "glibc_2.19"
907 builtin_sysroot: ""
908 compiler: "clang"
909 host_system_name: "linux"
910 needsPic: true
911 supports_gold_linker: false
912 supports_incremental_linker: false
913 supports_fission: false
914 supports_interface_shared_objects: false
915 supports_normalizing_ar: true
916 supports_start_end_lib: false
917 supports_thin_archives: true
918 target_libc: "glibc_2.19"
919 target_cpu: "armhf-debian"
920 target_system_name: "arm_a15"
921 toolchain_identifier: "clang_linux_armhf"
922
923 tool_path { name: "ar" path: "linaro_linux_gcc/arm-linux-gnueabihf-ar" }
924 tool_path { name: "compat-ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
925 tool_path { name: "cpp" path: "linaro_linux_gcc/clang_bin/clang" }
926 tool_path { name: "dwp" path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp" }
927 tool_path { name: "gcc" path: "linaro_linux_gcc/clang_bin/clang" }
928 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
929 # C(++) compiles invoke the compiler (as that is the one knowing where
930 # to find libraries), but we provide LD so other rules can invoke the linker.
931 tool_path { name: "ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
932 tool_path { name: "nm" path: "linaro_linux_gcc/arm-linux-gnueabihf-nm" }
933 tool_path { name: "objcopy" path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy" }
934 objcopy_embed_flag: "-I"
935 objcopy_embed_flag: "binary"
936 tool_path { name: "objdump" path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump" }
937 tool_path { name: "strip" path: "linaro_linux_gcc/arm-linux-gnueabihf-strip" }
938 linking_mode_flags { mode: DYNAMIC }
939
940 compiler_flag: "-target"
941 compiler_flag: "armv7a-arm-linux-gnueabif"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800942 compiler_flag: "--sysroot=external/linaro_linux_gcc_repo/arm-linux-gnueabihf/libc"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700943 compiler_flag: "-mfloat-abi=hard"
944 compiler_flag: "-mfpu=vfpv3-d16"
945
946 compiler_flag: "-nostdinc"
947 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800948 compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700949 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800950 compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700951 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800952 compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf"
953 compiler_flag: "-isystem"
954 compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1"
955 compiler_flag: "-isystem"
956 compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1/arm-linux-gnueabihf"
957 compiler_flag: "-isystem"
958 compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1"
959 compiler_flag: "-isystem"
960 compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/libc/usr/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700961
James Kuszmaul3ae42262019-11-08 12:33:41 -0800962 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%"
963 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/libc/usr/include)%"
964 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/libc/usr/lib/include)%"
965 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%"
966 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%/c++/7.4.1"
967 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/7.4.1/include)%"
968 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%"
969 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include)%"
970 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%"
971 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/include)%/c++/7.4.1"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700972
973 linker_flag: "-target"
974 linker_flag: "armv7a-arm-linux-gnueabif"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800975 linker_flag: "--sysroot=external/linaro_linux_gcc_repo/arm-linux-gnueabihf/libc"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700976 linker_flag: "-lstdc++"
977 linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800978 linker_flag: "-Lexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/lib"
979 linker_flag: "-Lexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/libc/lib"
980 linker_flag: "-Lexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/libc/usr/lib"
981 linker_flag: "-Lexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
982 linker_flag: "-Bexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
983 linker_flag: "-Bexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/bin"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700984 linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3"
985
986 feature {
987 name: "opt"
988 implies: "all_modes"
989 flag_set {
990 action: "preprocess-assemble"
991 action: "c-compile"
992 action: "c++-compile"
993 action: "c++-header-parsing"
994 action: "c++-header-preprocessing"
995 action: "c++-module-compile"
996 flag_group {
997 flag: "-DAOS_DEBUG=0"
998 }
999 }
1000 }
1001
1002 feature {
1003 name: "dbg"
1004 implies: "all_modes"
1005 flag_set {
1006 action: "preprocess-assemble"
1007 action: "c-compile"
1008 action: "c++-compile"
1009 action: "c++-header-parsing"
1010 action: "c++-header-preprocessing"
1011 action: "c++-module-compile"
1012 flag_group {
1013 flag: "-DAOS_DEBUG=1"
1014 }
1015 flag_group {
1016 flag: "-fno-omit-frame-pointer"
1017 }
1018 }
1019 }
1020
1021 feature {
1022 name: "fastbuild"
1023 implies: "all_modes"
1024 flag_set {
1025 action: "preprocess-assemble"
1026 action: "c-compile"
1027 action: "c++-compile"
1028 action: "c++-header-parsing"
1029 action: "c++-header-preprocessing"
1030 action: "c++-module-compile"
1031 flag_group {
1032 flag: "-DAOS_DEBUG=0"
1033 }
1034 }
1035 }
1036
1037 feature {
1038 name: "all_modes"
1039 flag_set {
1040 action: "preprocess-assemble"
1041 action: "assemble"
1042 action: "c-compile"
1043 flag_group {
1044 flag: "-std=gnu99"
1045 }
1046 }
1047 flag_set {
1048 action: "c++-compile"
1049 action: "c++-header-parsing"
1050 action: "c++-header-preprocessing"
1051 action: "c++-module-compile"
1052 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -08001053 flag: "-std=gnu++1z"
Brian Silverman7b8899e2018-06-30 19:19:24 -07001054 }
1055 }
1056 flag_set {
1057 action: "preprocess-assemble"
1058 action: "assemble"
1059 action: "c++-link"
1060 action: "c++-compile"
1061 action: "c++-header-parsing"
1062 action: "c++-header-preprocessing"
1063 action: "c++-module-compile"
1064 action: "c-compile"
1065 flag_group {
1066 # We always want to compile with -pthread semantics.
1067 flag: "-pthread"
1068 }
1069 }
1070 }
1071
1072 # Anticipated future default.
1073 # This makes GCC and Clang do what we want when called through symlinks.
1074 unfiltered_cxx_flag: "-no-canonical-prefixes"
1075 linker_flag: "-no-canonical-prefixes"
1076
1077 # Things that the code wants defined.
1078 compiler_flag: "-D__STDC_FORMAT_MACROS"
1079 compiler_flag: "-D__STDC_CONSTANT_MACROS"
1080 compiler_flag: "-D__STDC_LIMIT_MACROS"
1081 compiler_flag: "-D_FILE_OFFSET_BITS=64"
1082 # TODO(Brian): Rename this or something.
1083 compiler_flag: "-DAOS_ARCHITECTURE_armhf"
1084
1085 # Make C++ compilation deterministic. Use linkstamping instead of these
1086 # compiler symbols.
1087 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
James Kuszmaul3ae42262019-11-08 12:33:41 -08001088 unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
1089 unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
1090 unfiltered_cxx_flag: "-Wno-varargs"
Brian Silverman7b8899e2018-06-30 19:19:24 -07001091 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
1092 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
1093 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
1094
1095 # Security hardening on by default.
1096 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
1097 # We need to undef it before redefining it as some distributions now have
1098 # it enabled by default.
1099 compiler_flag: "-U_FORTIFY_SOURCE"
1100 compiler_flag: "-fstack-protector"
1101 compiler_flag: "-fPIE"
1102 linker_flag: "-Wl,-z,relro,-z,now"
1103
1104 # Pretty much everything needs this, including parts of the glibc STL...
1105 linker_flag: "-lm"
1106
1107 # Enable coloring even if there's no attached terminal. Bazel removes the
1108 # escape sequences if --nocolor is specified.
1109 compiler_flag: "-fdiagnostics-color=always"
1110
1111 compiler_flag: "-Wall"
1112 compiler_flag: "-Wextra"
1113 compiler_flag: "-Wpointer-arith"
1114 compiler_flag: "-Wstrict-aliasing"
1115 compiler_flag: "-Wcast-qual"
1116 compiler_flag: "-Wcast-align"
1117 compiler_flag: "-Wwrite-strings"
1118 compiler_flag: "-Wtype-limits"
1119 compiler_flag: "-Wsign-compare"
1120 compiler_flag: "-Wformat=2"
1121 compiler_flag: "-Werror"
1122 compiler_flag: "-Wunused-local-typedefs"
1123
1124 # Keep stack frames for debugging, even in opt mode.
1125 compiler_flag: "-fno-omit-frame-pointer"
1126
1127 # Don't use temp files while compiling.
1128 compiler_flag: "-pipe"
1129
1130 # Stamp the binary with a unique identifier.
1131 linker_flag: "-Wl,--build-id=md5"
1132 linker_flag: "-Wl,--hash-style=gnu"
1133 #linker_flag: "-Wl,--warn-execstack"
1134 #linker_flag: "-Wl,--detect-odr-violations"
1135
1136 # Enable debug symbols.
1137 compiler_flag: "-ggdb3"
1138
1139 compilation_mode_flags {
1140 mode: OPT
1141
1142 compiler_flag: "-O2"
1143
1144 # Disable assertions
1145 compiler_flag: "-DNDEBUG"
1146 compiler_flag: "-D_FORTIFY_SOURCE=1"
1147
1148 # Removal of unused code and data at link time (can this increase binary size in some cases?).
1149 compiler_flag: "-ffunction-sections"
1150 compiler_flag: "-fdata-sections"
1151 linker_flag: "-Wl,--gc-sections"
1152 }
1153 feature {
1154 name: "pie_for_linking"
1155 enabled: true
1156 flag_set {
1157 action: "c++-link-executable"
1158 flag_group {
1159 flag: "-pie"
1160 }
1161 }
1162 }
1163}