blob: dc650d901e8994c50e801585f8ea064458755004 [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 {
21 cpu: "armhf-debian"
22 toolchain_identifier: "clang_linux_armhf"
23}
24
25default_toolchain {
26 cpu: "cortex-m4f"
27 toolchain_identifier: "cortex-m4f"
28}
29
Brian Silverman6c8b88b2018-09-03 18:17:02 -070030default_toolchain {
31 cpu: "cortex-m4f-k22"
32 toolchain_identifier: "cortex-m4f-k22"
33}
34
Brian Silverman7b8899e2018-06-30 19:19:24 -070035toolchain {
James Kuszmaul3ae42262019-11-08 12:33:41 -080036 toolchain_identifier: "stub_armeabi-v7a"
Brian Silverman7b8899e2018-06-30 19:19:24 -070037 abi_version: "armeabi-v7a"
38 abi_libc_version: "armeabi-v7a"
39 builtin_sysroot: ""
40 compiler: "compiler"
41 host_system_name: "armeabi-v7a"
42 needsPic: true
43 supports_gold_linker: false
44 supports_incremental_linker: false
45 supports_fission: false
46 supports_interface_shared_objects: false
47 supports_normalizing_ar: false
48 supports_start_end_lib: false
49 supports_thin_archives: false
50 target_libc: "armeabi-v7a"
51 target_cpu: "armeabi-v7a"
52 target_system_name: "armeabi-v7a"
Brian Silverman7b8899e2018-06-30 19:19:24 -070053
54 tool_path { name: "ar" path: "/bin/false" }
55 tool_path { name: "compat-ld" path: "/bin/false" }
56 tool_path { name: "cpp" path: "/bin/false" }
57 tool_path { name: "dwp" path: "/bin/false" }
58 tool_path { name: "gcc" path: "/bin/false" }
59 tool_path { name: "gcov" path: "/bin/false" }
60 tool_path { name: "ld" path: "/bin/false" }
61
62 tool_path { name: "nm" path: "/bin/false" }
63 tool_path { name: "objcopy" path: "/bin/false" }
64 tool_path { name: "objdump" path: "/bin/false" }
65 tool_path { name: "strip" path: "/bin/false" }
66}
67
68toolchain {
69 abi_version: "local"
70 abi_libc_version: "local"
71 builtin_sysroot: ""
72 compiler: "clang"
73 host_system_name: "local"
74 needsPic: true
75 supports_gold_linker: false
76 supports_incremental_linker: false
77 supports_fission: false
78 supports_interface_shared_objects: false
79 supports_normalizing_ar: false
80 supports_start_end_lib: false
81 supports_thin_archives: false
82 target_libc: "local"
83 target_cpu: "k8"
84 target_system_name: "k8"
85 toolchain_identifier: "k8_linux"
86
87 # These paths are relative to //tools/cpp.
James Kuszmaul3ae42262019-11-08 12:33:41 -080088 tool_path { name: "ar" path: "clang_6p0/x86_64-linux-gnu-ar" }
89 tool_path { name: "compat-ld" path: "clang_6p0/x86_64-linux-gnu-ld" }
90 tool_path { name: "cpp" path: "clang_6p0/x86_64-linux-gnu-cpp" }
91 tool_path { name: "dwp" path: "clang_6p0/x86_64-linux-gnu-dwp" }
92 tool_path { name: "gcc" path: "clang_6p0/x86_64-linux-gnu-clang-6.0" }
93 tool_path { name: "gcov" path: "clang_6p0/x86_64-linux-gnu-gcov" }
Brian Silverman7b8899e2018-06-30 19:19:24 -070094 # C(++) compiles invoke the compiler (as that is the one knowing where
95 # to find libraries), but we provide LD so other rules can invoke the linker.
James Kuszmaul3ae42262019-11-08 12:33:41 -080096 tool_path { name: "ld" path: "clang_6p0/x86_64-linux-gnu-ld" }
97 tool_path { name: "nm" path: "clang_6p0/x86_64-linux-gnu-nm" }
98 tool_path { name: "objcopy" path: "clang_6p0/x86_64-linux-gnu-objcopy" }
Brian Silverman7b8899e2018-06-30 19:19:24 -070099 objcopy_embed_flag: "-I"
100 objcopy_embed_flag: "binary"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800101 tool_path { name: "objdump" path: "clang_6p0/x86_64-linux-gnu-objdump" }
102 tool_path { name: "strip" path: "clang_6p0/x86_64-linux-gnu-strip" }
Brian Silverman7b8899e2018-06-30 19:19:24 -0700103 linking_mode_flags { mode: DYNAMIC }
104
Brian Silverman60606c92020-01-15 22:45:04 -0800105 compiler_flag: "--sysroot=external/amd64_debian_sysroot"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700106 compiler_flag: "-nostdinc"
107 compiler_flag: "-isystem"
Brian Silverman60606c92020-01-15 22:45:04 -0800108 compiler_flag: "external/amd64_debian_sysroot/usr/include/c++/7"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700109 compiler_flag: "-isystem"
Brian Silverman60606c92020-01-15 22:45:04 -0800110 compiler_flag: "external/amd64_debian_sysroot/usr/include/x86_64-linux-gnu/c++/7"
111 compiler_flag: "-isystem"
112 compiler_flag: "external/amd64_debian_sysroot/usr/include/c++/8/backward"
113 compiler_flag: "-isystem"
114 compiler_flag: "external/amd64_debian_sysroot/usr/lib/gcc/x86_64-linux-gnu/8/include"
115 # We don't have anything in /usr/local/include, so don't include it here where
116 # would normally go on the default search path.
117 compiler_flag: "-isystem"
118 compiler_flag: "external/clang_6p0_repo/usr/lib/llvm-6.0/lib/clang/6.0.0/include"
119 compiler_flag: "-isystem"
120 compiler_flag: "external/amd64_debian_sysroot/usr/include/x86_64-linux-gnu"
121 compiler_flag: "-isystem"
122 compiler_flag: "external/amd64_debian_sysroot/usr/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700123
James Kuszmaul3ae42262019-11-08 12:33:41 -0800124 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 -0800125 cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/include"
126 cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/lib/gcc/x86_64-linux-gnu/7/include"
127 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 -0700128
129 linker_flag: "-nodefaultlibs"
Brian Silverman60606c92020-01-15 22:45:04 -0800130 linker_flag: "--sysroot=external/amd64_debian_sysroot"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700131 linker_flag: "-lstdc++"
132 linker_flag: "-lc"
133 linker_flag: "-lgcc"
134 linker_flag: "-lgcc_s"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800135 linker_flag: "-Bexternal/clang_6p0_repo/usr/bin/"
136 linker_flag: "-Ltools/cpp/clang_6p0/clang_more_libs"
Brian Silverman60606c92020-01-15 22:45:04 -0800137 linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/gcc/x86_64-linux-gnu/7/"
138 linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/x86_64-linux-gnu/"
139 linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/"
140 linker_flag: "-Lexternal/amd64_debian_sysroot/lib/x86_64-linux-gnu/"
141 linker_flag: "-Lexternal/amd64_debian_sysroot/lib/"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700142
143 feature {
144 name: "opt"
145 implies: "all_modes"
146 flag_set {
147 action: "preprocess-assemble"
148 action: "c-compile"
149 action: "c++-compile"
150 action: "c++-header-parsing"
151 action: "c++-header-preprocessing"
152 action: "c++-module-compile"
153 flag_group {
154 flag: "-DAOS_DEBUG=0"
155 }
156 }
157 }
158
159 feature {
160 name: "dbg"
161 implies: "all_modes"
162 flag_set {
163 action: "preprocess-assemble"
164 action: "c-compile"
165 action: "c++-compile"
166 action: "c++-header-parsing"
167 action: "c++-header-preprocessing"
168 action: "c++-module-compile"
169 flag_group {
170 flag: "-DAOS_DEBUG=1"
171 }
172 flag_group {
173 flag: "-fno-omit-frame-pointer"
174 }
175 }
176 }
177
178 feature {
179 name: "fastbuild"
180 implies: "all_modes"
181 flag_set {
182 action: "preprocess-assemble"
183 action: "c-compile"
184 action: "c++-compile"
185 action: "c++-header-parsing"
186 action: "c++-header-preprocessing"
187 action: "c++-module-compile"
188 flag_group {
189 flag: "-DAOS_DEBUG=0"
190 }
191 }
192 }
193
194 feature {
195 name: "all_modes"
196 flag_set {
197 action: "preprocess-assemble"
198 action: "assemble"
199 action: "c-compile"
200 flag_group {
201 flag: "-std=gnu99"
202 }
203 }
204 flag_set {
205 action: "c++-compile"
206 action: "c++-header-parsing"
207 action: "c++-header-preprocessing"
208 action: "c++-module-compile"
209 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800210 flag: "-std=gnu++1z"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700211 }
212 }
Brian Silverman7b8899e2018-06-30 19:19:24 -0700213 }
214
215 # Anticipated future default.
216 # This makes GCC and Clang do what we want when called through symlinks.
217 unfiltered_cxx_flag: "-no-canonical-prefixes"
218 linker_flag: "-no-canonical-prefixes"
219
220 # Things that the code wants defined.
221 compiler_flag: "-D__STDC_FORMAT_MACROS"
222 compiler_flag: "-D__STDC_CONSTANT_MACROS"
223 compiler_flag: "-D__STDC_LIMIT_MACROS"
224 compiler_flag: "-D_FILE_OFFSET_BITS=64"
225 # TODO(Brian): Rename this or something.
226 compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
227
228 linker_flag: "-fuse-ld=gold"
229
230 # Make C++ compilation deterministic. Use linkstamping instead of these
231 # compiler symbols.
232 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
233 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
234 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
235 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
236
James Kuszmaul3ae42262019-11-08 12:33:41 -0800237 # C++17 libraries that tend to cause issues in some libraries that we include.
238 unfiltered_cxx_flag: "-Wno-varargs"
239 unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
240 # The mismatched-new-delete seems to be a bit overly strict currently
241 # and errors on:
242 # char *p = new char;
243 # delete p;
244 # p = new char[100];
245 # delete[] p;
246 unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
247
Brian Silverman7b8899e2018-06-30 19:19:24 -0700248 # Security hardening on by default.
249 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
250 # We need to undef it before redefining it as some distributions now have
251 # it enabled by default.
252 compiler_flag: "-U_FORTIFY_SOURCE"
253 compiler_flag: "-D_FORTIFY_SOURCE=1"
254 compiler_flag: "-fstack-protector"
255 compiler_flag: "-fPIE"
256 linker_flag: "-Wl,-z,relro,-z,now"
257
258 # Pretty much everything needs this, including parts of the glibc STL...
259 linker_flag: "-lm"
260
261 # Enable coloring even if there's no attached terminal. Bazel removes the
262 # escape sequences if --nocolor is specified.
263 compiler_flag: "-fcolor-diagnostics"
264 compiler_flag: "-fmessage-length=80"
265 compiler_flag: "-fmacro-backtrace-limit=0"
266
267 compiler_flag: "-Wall"
268 compiler_flag: "-Wextra"
269 compiler_flag: "-Wpointer-arith"
270 compiler_flag: "-Wstrict-aliasing"
271 compiler_flag: "-Wcast-qual"
272 compiler_flag: "-Wcast-align"
273 compiler_flag: "-Wwrite-strings"
274 compiler_flag: "-Wtype-limits"
275 compiler_flag: "-Wsign-compare"
276 compiler_flag: "-Wformat=2"
277 compiler_flag: "-Werror"
278
279 # Keep stack frames for debugging, even in opt mode.
280 compiler_flag: "-fno-omit-frame-pointer"
281
282 # Don't use temp files while compiling.
283 compiler_flag: "-pipe"
284
285 # Stamp the binary with a unique identifier.
286 linker_flag: "-Wl,--build-id=md5"
287 linker_flag: "-Wl,--hash-style=gnu"
288 linker_flag: "-Wl,--warn-execstack"
289 linker_flag: "-Wl,--detect-odr-violations"
290
291 # Enable debug symbols.
292 compiler_flag: "-ggdb3"
293
294 compilation_mode_flags {
295 mode: OPT
296
297 compiler_flag: "-O2"
298
299 # Disable assertions
300 compiler_flag: "-DNDEBUG"
301
302 # Removal of unused code and data at link time (can this increase binary size in some cases?).
303 compiler_flag: "-ffunction-sections"
304 compiler_flag: "-fdata-sections"
305 linker_flag: "-Wl,--gc-sections"
306 }
307 feature {
308 name: "pie_for_linking"
309 enabled: true
310 flag_set {
311 action: "c++-link-executable"
312 flag_group {
313 flag: "-pie"
314 }
315 }
316 }
317}
318
319toolchain {
Austin Schuhef147de2018-10-27 21:19:00 -0700320 toolchain_identifier: "roborio_linux"
321 host_system_name: "roborio"
322 target_system_name: "roborio"
323 target_cpu: "roborio"
324 target_libc: "roborio"
325 compiler: "gcc"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700326 abi_version: "roborio"
327 abi_libc_version: "roborio"
Austin Schuhef147de2018-10-27 21:19:00 -0700328
Brian Silverman7b8899e2018-06-30 19:19:24 -0700329 builtin_sysroot: ""
Brian Silverman7b8899e2018-06-30 19:19:24 -0700330 needsPic: true
331 supports_gold_linker: false
332 supports_incremental_linker: false
333 supports_fission: false
334 supports_interface_shared_objects: false
335 supports_normalizing_ar: false
336 supports_start_end_lib: false
337 supports_thin_archives: false
Brian Silverman7b8899e2018-06-30 19:19:24 -0700338
339 tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" }
Austin Schuhf6b94632019-02-02 22:11:27 -0800340 tool_path { name: "as" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as" }
Brian Silverman7b8899e2018-06-30 19:19:24 -0700341 tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
342 tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" }
343 tool_path { name: "dwp" path: "/bin/false" }
344 tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" }
345 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
346 # C(++) compiles invoke the compiler (as that is the one knowing where
347 # to find libraries), but we provide LD so other rules can invoke the linker.
348 tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
349 tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" }
350 tool_path { name: "objcopy" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy" }
351 objcopy_embed_flag: "-I"
352 objcopy_embed_flag: "binary"
353 tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" }
354 tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" }
355 linking_mode_flags { mode: DYNAMIC }
356
Austin Schuhef147de2018-10-27 21:19:00 -0700357 feature {
358 name: "compile_flags1"
359 enabled: true
360 flag_set {
361 action: "assemble"
362 action: "preprocess-assemble"
363 action: "c-compile"
364 action: "c++-compile"
365 action: "c++-header-parsing"
366 action: "c++-module-compile"
367 action: "c++-module-codegen"
368 action: "lto-backend"
369 action: "clif-match"
370 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800371 flag: "--sysroot=external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi"
Austin Schuhef147de2018-10-27 21:19:00 -0700372 flag: "-nostdinc"
373 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800374 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 -0700375 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800376 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 -0800377 }
378 }
379
380 flag_set {
James Kuszmaulebdeaf52019-05-22 20:31:25 -0700381 action: "assemble"
382 action: "preprocess-assemble"
383 action: "c++-compile"
384 action: "c++-header-parsing"
385 action: "c++-header-preprocessing"
386 flag_group {
387 flag: "-fno-canonical-system-headers"
388 }
389 }
390
391 flag_set {
Austin Schuhf6b94632019-02-02 22:11:27 -0800392 action: "c++-compile"
393 action: "c++-header-parsing"
394 action: "c++-module-compile"
395 action: "c++-module-codegen"
396 flag_group {
Austin Schuhef147de2018-10-27 21:19:00 -0700397 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800398 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0"
Austin Schuhf6b94632019-02-02 22:11:27 -0800399 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800400 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 -0800401 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800402 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 -0800403 }
404 }
405
406 flag_set {
407 action: "assemble"
408 action: "preprocess-assemble"
409 action: "c-compile"
410 action: "c++-compile"
411 action: "c++-header-parsing"
412 action: "c++-module-compile"
413 action: "c++-module-codegen"
414 action: "lto-backend"
415 action: "clif-match"
416 flag_group {
417 flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800418 flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include"
Austin Schuhf6b94632019-02-02 22:11:27 -0800419
Austin Schuhef147de2018-10-27 21:19:00 -0700420 flag: "-mfpu=neon"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700421
Austin Schuhef147de2018-10-27 21:19:00 -0700422 # Things that the code wants defined.
423 flag: "-D__STDC_FORMAT_MACROS"
424 flag: "-D__STDC_CONSTANT_MACROS"
425 flag: "-D__STDC_LIMIT_MACROS"
426 flag: "-D_FILE_OFFSET_BITS=64"
427
428 # TODO(Brian): Rename this or something.
429 flag: "-DAOS_ARCHITECTURE_arm_frc"
430
431 # Security hardening on by default.
432 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
433 # We need to undef it before redefining it as some distributions now have
434 # it enabled by default.
435 flag: "-U_FORTIFY_SOURCE"
436 flag: "-fstack-protector"
437 flag: "-fPIE"
438
439 # Enable coloring even if there's no attached terminal. Bazel removes the
440 # escape sequences if --nocolor is specified.
441 flag: "-fdiagnostics-color=always"
442
443 flag: "-Wall"
444 flag: "-Wextra"
445 flag: "-Wpointer-arith"
446 flag: "-Wstrict-aliasing"
447 flag: "-Wcast-qual"
Austin Schuhef147de2018-10-27 21:19:00 -0700448 flag: "-Wwrite-strings"
449 flag: "-Wtype-limits"
450 flag: "-Wsign-compare"
451 flag: "-Wformat=2"
452 flag: "-Werror"
453 flag: "-Wunused-local-typedefs"
Brian Silverman21280c72019-12-18 20:26:12 -0800454 # We don't use libraries compiled with the broken version.
455 flag: "-Wno-psabi"
Austin Schuhef147de2018-10-27 21:19:00 -0700456
457 # Keep stack frames for debugging, even in opt mode.
458 flag: "-fno-omit-frame-pointer"
459
460 flag: "-D__has_feature(x)=0"
461
462 # Don't use temp files while compiling.
463 flag: "-pipe"
464
465 # Enable debug symbols.
466 flag: "-ggdb3"
467 }
468 }
469 }
470
471 feature {
472 name: "opt"
473 implies: "opt_post"
474 flag_set {
475 action: "assemble"
476 action: "preprocess-assemble"
477 action: "c-compile"
478 action: "c++-compile"
479 action: "c++-module-compile"
480 action: "objc-compile"
481 action: "objc++-compile"
482 action: "c++-header-parsing"
483 action: "linkstamp-compile"
484 flag_group {
485 flag: "-O2"
486 flag: "-DNDEBUG"
487 flag: "-D_FORTIFY_SOURCE=1"
488 flag: "-ffunction-sections"
489 flag: "-fdata-sections"
490 }
491 }
492 flag_set {
493 action: "c++-link-executable"
494 action: "c++-link-nodeps-dynamic-library"
495 action: "c++-link-dynamic-library"
496 flag_group {
497 flag: "-Wl,--gc-sections"
498 }
499 }
500 }
501
Brian Silverman7b8899e2018-06-30 19:19:24 -0700502 # TODO(bazel-team): In theory, the path here ought to exactly match the path
503 # used by gcc. That works because bazel currently doesn't track files at
504 # absolute locations and has no remote execution, yet. However, this will need
505 # to be fixed, maybe with auto-detection?
Austin Schuhf6b94632019-02-02 22:11:27 -0800506
James Kuszmaul3ae42262019-11-08 12:33:41 -0800507 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)%"
508 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)%"
509 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi)%"
510 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 -0700511
512 linker_flag: "-lstdc++"
513 linker_flag: "-Ltools/cpp/arm-frc-linux-gnueabi/libs"
514
515 feature {
Austin Schuhef147de2018-10-27 21:19:00 -0700516 name: "dependency_file"
517 flag_set {
518 action: "assemble"
519 action: "preprocess-assemble"
520 action: "c-compile"
521 action: "c++-compile"
522 action: "c++-module-compile"
523 action: "objc-compile"
524 action: "objc++-compile"
525 action: "c++-header-parsing"
526 action: "clif-match"
527 expand_if_all_available: "dependency_file"
528 flag_group {
529 flag: "-MD"
530 flag: "-MF"
531 flag: "%{dependency_file}"
532 }
533 }
534 }
535
536 feature {
537 name: "random_seed"
538 flag_set {
539 # TODO(austin): Should these also have -frandom-seed set? Upstream
540 # doesn't.
541 # action: "linkstamp-compile"
542 # action: "c-compile"
543 action: "c++-compile"
544 action: "c++-module-codegen"
545 action: "c++-module-compile"
546 flag_group {
547 expand_if_all_available: "output_file"
548 flag: "-frandom-seed=%{output_file}"
549 }
550 }
551 }
552
553 feature {
554 name: "pic"
555 flag_set {
556 action: "assemble"
557 action: "preprocess-assemble"
558 action: "linkstamp-compile"
559 action: "c-compile"
560 action: "c++-compile"
561 action: "c++-module-codegen"
562 action: "c++-module-compile"
563 expand_if_all_available: "pic"
564 flag_group {
565 flag: "-fPIC"
566 }
567 }
568 }
569
570 feature {
571 name: "preprocessor_defines"
572 flag_set {
573 action: "preprocess-assemble"
574 action: "linkstamp-compile"
575 action: "c-compile"
576 action: "c++-compile"
577 action: "c++-header-parsing"
578 action: "c++-module-compile"
579 action: "clif-match"
580 flag_group {
581 iterate_over: "preprocessor_defines"
582 flag: "-D%{preprocessor_defines}"
583 }
584 }
585 }
586
587 feature {
588 name: "include_paths"
589 flag_set {
590 action: "preprocess-assemble"
591 action: "c-compile"
592 action: "c++-compile"
593 action: "c++-header-parsing"
594 action: "c++-header-preprocessing"
595 action: "c++-module-compile"
596 flag_group {
597 flag: "-iquote"
598 flag: "%{quote_include_paths}"
599 iterate_over: "quote_include_paths"
600 }
601 flag_group {
602 flag: "-I%{include_paths}"
603 iterate_over: "include_paths"
604 }
605 flag_group {
606 flag: "-isystem"
607 flag: "%{system_include_paths}"
608 iterate_over: "system_include_paths"
609 }
610 }
611 }
612
613 feature {
614 name: "opt_post"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700615 flag_set {
616 action: "preprocess-assemble"
617 action: "c-compile"
618 action: "c++-compile"
619 action: "c++-header-parsing"
620 action: "c++-header-preprocessing"
621 action: "c++-module-compile"
622 flag_group {
623 flag: "-DAOS_DEBUG=0"
624 }
625 }
626 }
627
628 feature {
629 name: "dbg"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700630 flag_set {
631 action: "preprocess-assemble"
632 action: "c-compile"
633 action: "c++-compile"
634 action: "c++-header-parsing"
635 action: "c++-header-preprocessing"
636 action: "c++-module-compile"
637 flag_group {
638 flag: "-DAOS_DEBUG=1"
639 }
640 flag_group {
641 flag: "-fno-omit-frame-pointer"
642 }
643 }
644 }
645
646 feature {
647 name: "fastbuild"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700648 flag_set {
649 action: "preprocess-assemble"
650 action: "c-compile"
651 action: "c++-compile"
652 action: "c++-header-parsing"
653 action: "c++-header-preprocessing"
654 action: "c++-module-compile"
655 flag_group {
656 flag: "-DAOS_DEBUG=0"
657 }
658 }
659 }
660
661 feature {
662 name: "all_modes"
Austin Schuhef147de2018-10-27 21:19:00 -0700663 enabled: true
Brian Silverman7b8899e2018-06-30 19:19:24 -0700664 flag_set {
665 action: "preprocess-assemble"
666 action: "assemble"
667 action: "c-compile"
668 flag_group {
669 flag: "-std=gnu99"
670 }
671 }
672 flag_set {
673 action: "c++-compile"
674 action: "c++-header-parsing"
675 action: "c++-header-preprocessing"
676 action: "c++-module-compile"
677 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800678 flag: "-std=gnu++1z"
Austin Schuhf6b94632019-02-02 22:11:27 -0800679 flag: "-fno-sized-deallocation"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700680 }
681 }
682 flag_set {
683 action: "preprocess-assemble"
684 action: "assemble"
685 action: "c++-link"
686 action: "c++-compile"
687 action: "c++-header-parsing"
688 action: "c++-header-preprocessing"
689 action: "c++-module-compile"
690 action: "c-compile"
691 flag_group {
692 # We always want to compile with -pthread semantics.
693 flag: "-pthread"
694 }
695 }
696 }
697
Brian Silverman7b8899e2018-06-30 19:19:24 -0700698 # Anticipated future default.
699 # This makes GCC and Clang do what we want when called through symlinks.
700 unfiltered_cxx_flag: "-no-canonical-prefixes"
701 linker_flag: "-no-canonical-prefixes"
702
Brian Silverman7b8899e2018-06-30 19:19:24 -0700703 # Make C++ compilation deterministic. Use linkstamping instead of these
704 # compiler symbols.
705 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
706 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
707 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
708 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
709
Brian Silverman7b8899e2018-06-30 19:19:24 -0700710 linker_flag: "-Wl,-z,relro,-z,now"
711
712 # Pretty much everything needs this, including parts of the glibc STL...
713 linker_flag: "-lm"
714
Brian Silverman7b8899e2018-06-30 19:19:24 -0700715 # Have GCC return the exit code from ld.
716 linker_flag: "-pass-exit-codes"
717
718 # Stamp the binary with a unique identifier.
719 linker_flag: "-Wl,--build-id=md5"
720 linker_flag: "-Wl,--hash-style=gnu"
721 #linker_flag: "-Wl,--warn-execstack"
722 #linker_flag: "-Wl,--detect-odr-violations"
723
Brian Silverman7b8899e2018-06-30 19:19:24 -0700724 feature {
725 name: "pie_for_linking"
726 enabled: true
727 flag_set {
728 action: "c++-link-executable"
729 flag_group {
730 flag: "-pie"
731 }
732 }
733 }
734}
735
736toolchain {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800737 abi_version: "clang_6.0"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700738 abi_libc_version: "glibc_2.19"
739 builtin_sysroot: ""
740 compiler: "clang"
741 host_system_name: "linux"
742 needsPic: true
743 supports_gold_linker: false
744 supports_incremental_linker: false
745 supports_fission: false
746 supports_interface_shared_objects: false
747 supports_normalizing_ar: true
748 supports_start_end_lib: false
749 supports_thin_archives: true
750 target_libc: "glibc_2.19"
751 target_cpu: "armhf-debian"
752 target_system_name: "arm_a15"
753 toolchain_identifier: "clang_linux_armhf"
754
755 tool_path { name: "ar" path: "linaro_linux_gcc/arm-linux-gnueabihf-ar" }
756 tool_path { name: "compat-ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
757 tool_path { name: "cpp" path: "linaro_linux_gcc/clang_bin/clang" }
758 tool_path { name: "dwp" path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp" }
759 tool_path { name: "gcc" path: "linaro_linux_gcc/clang_bin/clang" }
760 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
761 # C(++) compiles invoke the compiler (as that is the one knowing where
762 # to find libraries), but we provide LD so other rules can invoke the linker.
763 tool_path { name: "ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
764 tool_path { name: "nm" path: "linaro_linux_gcc/arm-linux-gnueabihf-nm" }
765 tool_path { name: "objcopy" path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy" }
766 objcopy_embed_flag: "-I"
767 objcopy_embed_flag: "binary"
768 tool_path { name: "objdump" path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump" }
769 tool_path { name: "strip" path: "linaro_linux_gcc/arm-linux-gnueabihf-strip" }
770 linking_mode_flags { mode: DYNAMIC }
771
772 compiler_flag: "-target"
773 compiler_flag: "armv7a-arm-linux-gnueabif"
Brian Silvermanbf4c1312020-01-12 11:35:45 -0800774 compiler_flag: "--sysroot=external/armhf_debian_rootfs"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700775 compiler_flag: "-mfloat-abi=hard"
776 compiler_flag: "-mfpu=vfpv3-d16"
777
778 compiler_flag: "-nostdinc"
779 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800780 compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700781 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800782 compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700783 compiler_flag: "-isystem"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800784 compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf"
785 compiler_flag: "-isystem"
786 compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1"
787 compiler_flag: "-isystem"
788 compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1/arm-linux-gnueabihf"
789 compiler_flag: "-isystem"
790 compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1"
791 compiler_flag: "-isystem"
Brian Silvermanbf4c1312020-01-12 11:35:45 -0800792 compiler_flag: "external/armhf_debian_rootfs/usr/include"
793 compiler_flag: "-isystem"
794 compiler_flag: "external/armhf_debian_rootfs/usr/include/arm-linux-gnueabihf"
795 compiler_flag: "-isystem"
796 compiler_flag: "external/org_frc971/third_party"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700797
James Kuszmaul3ae42262019-11-08 12:33:41 -0800798 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%"
Brian Silvermanbf4c1312020-01-12 11:35:45 -0800799 cxx_builtin_include_directory: "%package(@armhf_debian_rootfs//usr/include)%"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800800 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%/c++/7.4.1"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800801 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include)%"
802 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%"
803 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/include)%/c++/7.4.1"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700804
805 linker_flag: "-target"
806 linker_flag: "armv7a-arm-linux-gnueabif"
Brian Silvermanbf4c1312020-01-12 11:35:45 -0800807 linker_flag: "--sysroot=external/armhf_debian_rootfs"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700808 linker_flag: "-lstdc++"
809 linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs"
Brian Silvermanbf4c1312020-01-12 11:35:45 -0800810 linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib/gcc/arm-linux-gnueabihf/8"
811 linker_flag: "-Lexternal/armhf_debian_rootfs/lib/arm-linux-gnueabihf"
812 linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib/arm-linux-gnueabihf"
813 linker_flag: "-Lexternal/armhf_debian_rootfs/lib"
814 linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800815 linker_flag: "-Lexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
816 linker_flag: "-Bexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
817 linker_flag: "-Bexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/bin"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700818 linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3"
819
820 feature {
821 name: "opt"
822 implies: "all_modes"
823 flag_set {
824 action: "preprocess-assemble"
825 action: "c-compile"
826 action: "c++-compile"
827 action: "c++-header-parsing"
828 action: "c++-header-preprocessing"
829 action: "c++-module-compile"
830 flag_group {
831 flag: "-DAOS_DEBUG=0"
832 }
833 }
834 }
835
836 feature {
837 name: "dbg"
838 implies: "all_modes"
839 flag_set {
840 action: "preprocess-assemble"
841 action: "c-compile"
842 action: "c++-compile"
843 action: "c++-header-parsing"
844 action: "c++-header-preprocessing"
845 action: "c++-module-compile"
846 flag_group {
847 flag: "-DAOS_DEBUG=1"
848 }
849 flag_group {
850 flag: "-fno-omit-frame-pointer"
851 }
852 }
853 }
854
855 feature {
856 name: "fastbuild"
857 implies: "all_modes"
858 flag_set {
859 action: "preprocess-assemble"
860 action: "c-compile"
861 action: "c++-compile"
862 action: "c++-header-parsing"
863 action: "c++-header-preprocessing"
864 action: "c++-module-compile"
865 flag_group {
866 flag: "-DAOS_DEBUG=0"
867 }
868 }
869 }
870
871 feature {
872 name: "all_modes"
873 flag_set {
874 action: "preprocess-assemble"
875 action: "assemble"
876 action: "c-compile"
877 flag_group {
878 flag: "-std=gnu99"
879 }
880 }
881 flag_set {
882 action: "c++-compile"
883 action: "c++-header-parsing"
884 action: "c++-header-preprocessing"
885 action: "c++-module-compile"
886 flag_group {
James Kuszmaul3ae42262019-11-08 12:33:41 -0800887 flag: "-std=gnu++1z"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700888 }
889 }
890 flag_set {
891 action: "preprocess-assemble"
892 action: "assemble"
893 action: "c++-link"
894 action: "c++-compile"
895 action: "c++-header-parsing"
896 action: "c++-header-preprocessing"
897 action: "c++-module-compile"
898 action: "c-compile"
899 flag_group {
900 # We always want to compile with -pthread semantics.
901 flag: "-pthread"
902 }
903 }
904 }
905
906 # Anticipated future default.
907 # This makes GCC and Clang do what we want when called through symlinks.
908 unfiltered_cxx_flag: "-no-canonical-prefixes"
909 linker_flag: "-no-canonical-prefixes"
910
911 # Things that the code wants defined.
912 compiler_flag: "-D__STDC_FORMAT_MACROS"
913 compiler_flag: "-D__STDC_CONSTANT_MACROS"
914 compiler_flag: "-D__STDC_LIMIT_MACROS"
915 compiler_flag: "-D_FILE_OFFSET_BITS=64"
916 # TODO(Brian): Rename this or something.
917 compiler_flag: "-DAOS_ARCHITECTURE_armhf"
918
919 # Make C++ compilation deterministic. Use linkstamping instead of these
920 # compiler symbols.
921 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
James Kuszmaul3ae42262019-11-08 12:33:41 -0800922 unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
923 unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
924 unfiltered_cxx_flag: "-Wno-varargs"
Brian Silverman7b8899e2018-06-30 19:19:24 -0700925 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
926 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
927 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
928
929 # Security hardening on by default.
930 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
931 # We need to undef it before redefining it as some distributions now have
932 # it enabled by default.
933 compiler_flag: "-U_FORTIFY_SOURCE"
934 compiler_flag: "-fstack-protector"
935 compiler_flag: "-fPIE"
936 linker_flag: "-Wl,-z,relro,-z,now"
937
938 # Pretty much everything needs this, including parts of the glibc STL...
939 linker_flag: "-lm"
940
941 # Enable coloring even if there's no attached terminal. Bazel removes the
942 # escape sequences if --nocolor is specified.
943 compiler_flag: "-fdiagnostics-color=always"
944
945 compiler_flag: "-Wall"
946 compiler_flag: "-Wextra"
947 compiler_flag: "-Wpointer-arith"
948 compiler_flag: "-Wstrict-aliasing"
949 compiler_flag: "-Wcast-qual"
950 compiler_flag: "-Wcast-align"
951 compiler_flag: "-Wwrite-strings"
952 compiler_flag: "-Wtype-limits"
953 compiler_flag: "-Wsign-compare"
954 compiler_flag: "-Wformat=2"
955 compiler_flag: "-Werror"
956 compiler_flag: "-Wunused-local-typedefs"
957
958 # Keep stack frames for debugging, even in opt mode.
959 compiler_flag: "-fno-omit-frame-pointer"
960
961 # Don't use temp files while compiling.
962 compiler_flag: "-pipe"
963
964 # Stamp the binary with a unique identifier.
965 linker_flag: "-Wl,--build-id=md5"
966 linker_flag: "-Wl,--hash-style=gnu"
967 #linker_flag: "-Wl,--warn-execstack"
968 #linker_flag: "-Wl,--detect-odr-violations"
969
970 # Enable debug symbols.
971 compiler_flag: "-ggdb3"
972
973 compilation_mode_flags {
974 mode: OPT
975
976 compiler_flag: "-O2"
977
978 # Disable assertions
979 compiler_flag: "-DNDEBUG"
980 compiler_flag: "-D_FORTIFY_SOURCE=1"
981
982 # Removal of unused code and data at link time (can this increase binary size in some cases?).
983 compiler_flag: "-ffunction-sections"
984 compiler_flag: "-fdata-sections"
985 linker_flag: "-Wl,--gc-sections"
986 }
987 feature {
988 name: "pie_for_linking"
989 enabled: true
990 flag_set {
991 action: "c++-link-executable"
992 flag_group {
993 flag: "-pie"
994 }
995 }
996 }
997}