blob: b29c5ad7f16a2949c0736999ae42d0a02834e155 [file] [log] [blame]
Brian Silverman12b3fc52015-10-11 19:38:33 -04001major_version: "local"
2minor_version: ""
3default_target_cpu: "same_as_host"
4
5default_toolchain {
Austin Schuh23da18b2015-10-11 20:52:49 -07006 cpu: "roborio"
7 toolchain_identifier: "roborio_linux"
8}
9
10default_toolchain {
Brian Silverman12b3fc52015-10-11 19:38:33 -040011 cpu: "k8"
Austin Schuh23da18b2015-10-11 20:52:49 -070012 toolchain_identifier: "k8_linux"
Brian Silverman12b3fc52015-10-11 19:38:33 -040013}
14
15default_toolchain {
16 cpu: "armeabi-v7a"
17 toolchain_identifier: "stub_armeabi-v7a"
18}
19
Brian Silverman0d57fc82016-01-24 21:02:53 -050020default_toolchain {
21 cpu: "armhf-debian"
22 toolchain_identifier: "clang_linux_armhf"
23}
Brian Silverman12b3fc52015-10-11 19:38:33 -040024
Brian Silverman8b638692017-06-26 23:10:26 -070025default_toolchain {
26 cpu: "cortex-m4f"
27 toolchain_identifier: "cortex-m4f"
28}
29
Brian Silverman12b3fc52015-10-11 19:38:33 -040030toolchain {
31 abi_version: "armeabi-v7a"
32 abi_libc_version: "armeabi-v7a"
33 builtin_sysroot: ""
34 compiler: "compiler"
35 host_system_name: "armeabi-v7a"
36 needsPic: true
37 supports_gold_linker: false
38 supports_incremental_linker: false
39 supports_fission: false
40 supports_interface_shared_objects: false
41 supports_normalizing_ar: false
42 supports_start_end_lib: false
43 supports_thin_archives: false
44 target_libc: "armeabi-v7a"
45 target_cpu: "armeabi-v7a"
46 target_system_name: "armeabi-v7a"
47 toolchain_identifier: "stub_armeabi-v7a"
48
49 tool_path { name: "ar" path: "/bin/false" }
50 tool_path { name: "compat-ld" path: "/bin/false" }
51 tool_path { name: "cpp" path: "/bin/false" }
52 tool_path { name: "dwp" path: "/bin/false" }
53 tool_path { name: "gcc" path: "/bin/false" }
54 tool_path { name: "gcov" path: "/bin/false" }
55 tool_path { name: "ld" path: "/bin/false" }
56
57 tool_path { name: "nm" path: "/bin/false" }
58 tool_path { name: "objcopy" path: "/bin/false" }
59 tool_path { name: "objdump" path: "/bin/false" }
60 tool_path { name: "strip" path: "/bin/false" }
61}
62
63toolchain {
64 abi_version: "local"
65 abi_libc_version: "local"
66 builtin_sysroot: ""
Austin Schuh23da18b2015-10-11 20:52:49 -070067 compiler: "clang"
Brian Silverman12b3fc52015-10-11 19:38:33 -040068 host_system_name: "local"
69 needsPic: true
70 supports_gold_linker: false
71 supports_incremental_linker: false
72 supports_fission: false
73 supports_interface_shared_objects: false
74 supports_normalizing_ar: false
75 supports_start_end_lib: false
76 supports_thin_archives: false
77 target_libc: "local"
Austin Schuh23da18b2015-10-11 20:52:49 -070078 target_cpu: "k8"
79 target_system_name: "k8"
80 toolchain_identifier: "k8_linux"
Brian Silverman12b3fc52015-10-11 19:38:33 -040081
Philipp Schrader9b1790e2018-03-10 20:21:30 -080082 # These paths are relative to //tools/cpp.
83 tool_path { name: "ar" path: "clang_3p6/x86_64-linux-gnu-ar" }
84 tool_path { name: "compat-ld" path: "clang_3p6/x86_64-linux-gnu-ld" }
85 tool_path { name: "cpp" path: "clang_3p6/x86_64-linux-gnu-cpp" }
86 tool_path { name: "dwp" path: "clang_3p6/x86_64-linux-gnu-dwp" }
87 tool_path { name: "gcc" path: "clang_3p6/x86_64-linux-gnu-clang-3.6" }
88 tool_path { name: "gcov" path: "clang_3p6/x86_64-linux-gnu-gcov" }
Brian Silverman12b3fc52015-10-11 19:38:33 -040089 # C(++) compiles invoke the compiler (as that is the one knowing where
90 # to find libraries), but we provide LD so other rules can invoke the linker.
Philipp Schrader9b1790e2018-03-10 20:21:30 -080091 tool_path { name: "ld" path: "clang_3p6/x86_64-linux-gnu-ld" }
92 tool_path { name: "nm" path: "clang_3p6/x86_64-linux-gnu-nm" }
93 tool_path { name: "objcopy" path: "clang_3p6/x86_64-linux-gnu-objcopy" }
Brian Silverman12b3fc52015-10-11 19:38:33 -040094 objcopy_embed_flag: "-I"
95 objcopy_embed_flag: "binary"
Philipp Schrader9b1790e2018-03-10 20:21:30 -080096 tool_path { name: "objdump" path: "clang_3p6/x86_64-linux-gnu-objdump" }
97 tool_path { name: "strip" path: "clang_3p6/x86_64-linux-gnu-strip" }
Brian Silverman6d350402016-03-05 01:15:46 -050098 linking_mode_flags { mode: DYNAMIC }
Brian Silverman12b3fc52015-10-11 19:38:33 -040099
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800100 compiler_flag: "--sysroot=external/clang_3p6_repo/"
101 compiler_flag: "-nostdinc"
102 compiler_flag: "-isystem"
103 compiler_flag: "external/clang_3p6_repo/usr/include",
104 compiler_flag: "-isystem"
105 compiler_flag: "external/clang_3p6_repo/usr/include/x86_64-linux-gnu",
106 compiler_flag: "-isystem"
107 compiler_flag: "external/clang_3p6_repo/usr/lib/llvm-3.6/lib/clang/3.6.2/include",
108
109 cxx_flag: "-isystem"
110 cxx_flag: "external/clang_3p6_repo/usr/include/c++/4.9"
111 cxx_flag: "-isystem"
112 cxx_flag: "external/clang_3p6_repo/usr/include/x86_64-linux-gnu/c++/4.9"
113 cxx_flag: "-isystem"
114 cxx_flag: "external/clang_3p6_repo/usr/include/c++/4.9/backward"
115
Brian Silverman12b3fc52015-10-11 19:38:33 -0400116 # TODO(bazel-team): In theory, the path here ought to exactly match the path
117 # used by gcc. That works because bazel currently doesn't track files at
118 # absolute locations and has no remote execution, yet. However, this will need
119 # to be fixed, maybe with auto-detection?
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800120 cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/include/c++/4.9'
121 cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/include/x86_64-linux-gnu/c++/4.9'
122 cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/include/c++/4.9/backward'
123 cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/local/include'
124 cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/lib/llvm-3.6/lib/clang/3.6.2/include'
125 cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/include/x86_64-linux-gnu'
126 cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/include'
127 cxx_builtin_include_directory: '%package(@clang_3p6_repo//usr)%/lib/clang/3.6.2/include'
Brian Silverman12b3fc52015-10-11 19:38:33 -0400128
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800129 linker_flag: "-nodefaultlibs"
130 linker_flag: "--sysroot=external/clang_3p6_repo/"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400131 linker_flag: "-lstdc++"
Philipp Schrader9b1790e2018-03-10 20:21:30 -0800132 linker_flag: "-lc"
133 linker_flag: "-lgcc"
134 linker_flag: "-lgcc_s"
135 linker_flag: "-Bexternal/clang_3p6_repo/usr/bin/"
136 linker_flag: "-Ltools/cpp/clang_3p6/clang_more_libs"
137 linker_flag: "-Lexternal/clang_3p6/lib/x86_64-linux-gnu"
138 linker_flag: "-Lexternal/clang_3p6/usr/lib/x86_64-linux-gnu"
139 linker_flag: "-Lexternal/clang_3p6/usr/lib/gcc/x86_64-linux-gnu"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400140
141 feature {
142 name: "opt"
143 implies: "all_modes"
144 flag_set {
145 action: "preprocess-assemble"
146 action: "c-compile"
147 action: "c++-compile"
148 action: "c++-header-parsing"
149 action: "c++-header-preprocessing"
150 action: "c++-module-compile"
151 flag_group {
152 flag: "-DAOS_DEBUG=0"
153 }
154 }
155 }
156
157 feature {
158 name: "dbg"
159 implies: "all_modes"
160 flag_set {
161 action: "preprocess-assemble"
162 action: "c-compile"
163 action: "c++-compile"
164 action: "c++-header-parsing"
165 action: "c++-header-preprocessing"
166 action: "c++-module-compile"
167 flag_group {
168 flag: "-DAOS_DEBUG=1"
169 }
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500170 flag_group {
171 flag: "-fno-omit-frame-pointer"
172 }
Brian Silverman12b3fc52015-10-11 19:38:33 -0400173 }
174 }
175
176 feature {
177 name: "fastbuild"
178 implies: "all_modes"
179 flag_set {
180 action: "preprocess-assemble"
181 action: "c-compile"
182 action: "c++-compile"
183 action: "c++-header-parsing"
184 action: "c++-header-preprocessing"
185 action: "c++-module-compile"
186 flag_group {
187 flag: "-DAOS_DEBUG=0"
188 }
189 }
190 }
191
192 feature {
193 name: "all_modes"
194 flag_set {
Austin Schuha20ae722015-11-01 12:29:38 -0800195 action: "preprocess-assemble"
196 action: "assemble"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400197 action: "c-compile"
198 flag_group {
199 flag: "-std=gnu99"
200 }
201 }
202 flag_set {
203 action: "c++-compile"
204 action: "c++-header-parsing"
205 action: "c++-header-preprocessing"
206 action: "c++-module-compile"
207 flag_group {
Austin Schuha20ae722015-11-01 12:29:38 -0800208 flag: "-std=gnu++1y"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400209 }
Brian Silverman23a1b342015-10-11 23:44:09 -0400210 }
211 flag_set {
212 action: "preprocess-assemble"
Austin Schuh23da18b2015-10-11 20:52:49 -0700213 action: "assemble"
214 action: "c++-link"
Brian Silverman23a1b342015-10-11 23:44:09 -0400215 action: "c++-compile"
216 action: "c++-header-parsing"
217 action: "c++-header-preprocessing"
218 action: "c++-module-compile"
Austin Schuh23da18b2015-10-11 20:52:49 -0700219 action: "c-compile"
Brian Silverman5dc00072015-10-12 00:38:14 -0400220 flag_group {
Brian Silverman12b3fc52015-10-11 19:38:33 -0400221 # We always want to compile with -pthread semantics.
Brian Silverman5dc00072015-10-12 00:38:14 -0400222 flag: "-pthread"
223 }
Brian Silverman12b3fc52015-10-11 19:38:33 -0400224 }
225 }
226
227 # Anticipated future default.
228 # This makes GCC and Clang do what we want when called through symlinks.
229 unfiltered_cxx_flag: "-no-canonical-prefixes"
230 linker_flag: "-no-canonical-prefixes"
231
232 # Things that the code wants defined.
233 compiler_flag: "-D__STDC_FORMAT_MACROS"
234 compiler_flag: "-D__STDC_CONSTANT_MACROS"
235 compiler_flag: "-D__STDC_LIMIT_MACROS"
236 compiler_flag: "-D_FILE_OFFSET_BITS=64"
237 # TODO(Brian): Rename this or something.
Austin Schuh23da18b2015-10-11 20:52:49 -0700238 compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400239
240 linker_flag: "-fuse-ld=gold"
241
Brian Silverman12b3fc52015-10-11 19:38:33 -0400242 # Make C++ compilation deterministic. Use linkstamping instead of these
243 # compiler symbols.
244 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
245 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
246 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
247 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
248
249 # Security hardening on by default.
250 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
251 # We need to undef it before redefining it as some distributions now have
252 # it enabled by default.
253 compiler_flag: "-U_FORTIFY_SOURCE"
254 compiler_flag: "-D_FORTIFY_SOURCE=1"
255 compiler_flag: "-fstack-protector"
256 compiler_flag: "-fPIE"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400257 linker_flag: "-Wl,-z,relro,-z,now"
258
259 # Pretty much everything needs this, including parts of the glibc STL...
260 linker_flag: "-lm"
261
262 # Enable coloring even if there's no attached terminal. Bazel removes the
263 # escape sequences if --nocolor is specified.
264 compiler_flag: "-fcolor-diagnostics"
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500265 compiler_flag: "-fmessage-length=80"
266 compiler_flag: "-fmacro-backtrace-limit=0"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400267
268 compiler_flag: "-Wall"
269 compiler_flag: "-Wextra"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400270 compiler_flag: "-Wpointer-arith"
Brian Silverman594be0d2015-10-31 17:56:23 -0400271 compiler_flag: "-Wstrict-aliasing"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400272 compiler_flag: "-Wcast-qual"
273 compiler_flag: "-Wcast-align"
274 compiler_flag: "-Wwrite-strings"
275 compiler_flag: "-Wtype-limits"
276 compiler_flag: "-Wsign-compare"
277 compiler_flag: "-Wformat=2"
278 compiler_flag: "-Werror"
279
280 # Keep stack frames for debugging, even in opt mode.
281 compiler_flag: "-fno-omit-frame-pointer"
282
283 # Don't use temp files while compiling.
284 compiler_flag: "-pipe"
285
Brian Silverman12b3fc52015-10-11 19:38:33 -0400286 # Stamp the binary with a unique identifier.
287 linker_flag: "-Wl,--build-id=md5"
288 linker_flag: "-Wl,--hash-style=gnu"
289 linker_flag: "-Wl,--warn-execstack"
290 linker_flag: "-Wl,--detect-odr-violations"
291
Brian Silvermand2540402015-11-28 18:35:00 -0500292 # Enable debug symbols.
293 compiler_flag: "-ggdb3"
294
Brian Silverman12b3fc52015-10-11 19:38:33 -0400295 compilation_mode_flags {
296 mode: OPT
297
Austin Schuha20ae722015-11-01 12:29:38 -0800298 compiler_flag: "-O2"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400299
300 # Disable assertions
301 compiler_flag: "-DNDEBUG"
302
303 # Removal of unused code and data at link time (can this increase binary size in some cases?).
304 compiler_flag: "-ffunction-sections"
305 compiler_flag: "-fdata-sections"
306 linker_flag: "-Wl,--gc-sections"
307 }
Austin Schuh137d9452018-07-07 15:42:36 -0700308 feature {
309 name: "pie_for_linking"
310 enabled: true
311 flag_set {
312 action: "c++-link-executable"
313 flag_group {
314 flag: "-pie"
315 }
316 }
317 }
Brian Silverman12b3fc52015-10-11 19:38:33 -0400318}
Austin Schuh23da18b2015-10-11 20:52:49 -0700319
320toolchain {
321 abi_version: "roborio"
322 abi_libc_version: "roborio"
323 builtin_sysroot: ""
324 compiler: "gcc"
325 host_system_name: "roborio"
326 needsPic: true
327 supports_gold_linker: false
328 supports_incremental_linker: false
329 supports_fission: false
330 supports_interface_shared_objects: false
331 supports_normalizing_ar: false
332 supports_start_end_lib: false
333 supports_thin_archives: false
334 target_libc: "roborio"
335 target_cpu: "roborio"
336 target_system_name: "roborio"
337 toolchain_identifier: "roborio_linux"
338
Austin Schuh55139fe2015-10-14 23:55:24 -0700339 tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" }
340 tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
341 tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" }
342 tool_path { name: "dwp" path: "/bin/false" }
343 tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" }
344 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
Austin Schuh23da18b2015-10-11 20:52:49 -0700345 # C(++) compiles invoke the compiler (as that is the one knowing where
346 # to find libraries), but we provide LD so other rules can invoke the linker.
Austin Schuh55139fe2015-10-14 23:55:24 -0700347 tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
348 tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" }
349 tool_path { name: "objcopy" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy" }
Austin Schuh23da18b2015-10-11 20:52:49 -0700350 objcopy_embed_flag: "-I"
351 objcopy_embed_flag: "binary"
Austin Schuh55139fe2015-10-14 23:55:24 -0700352 tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" }
353 tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" }
Brian Silverman6d350402016-03-05 01:15:46 -0500354 linking_mode_flags { mode: DYNAMIC }
Austin Schuh23da18b2015-10-11 20:52:49 -0700355
Brian Silverman826e1cd2016-01-31 18:26:00 -0500356 compiler_flag: "--sysroot=external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi"
Austin Schuh044e18b2015-10-21 20:17:09 -0700357 compiler_flag: "-nostdinc"
358 compiler_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700359 compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include",
Austin Schuh044e18b2015-10-21 20:17:09 -0700360 compiler_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700361 compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include-fixed"
Austin Schuh044e18b2015-10-21 20:17:09 -0700362 compiler_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500363 compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/usr/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700364
365 cxx_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700366 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/5.4.0"
Austin Schuh044e18b2015-10-21 20:17:09 -0700367 cxx_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700368 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/5.4.0/arm-frc-linux-gnueabi"
Austin Schuh044e18b2015-10-21 20:17:09 -0700369 cxx_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700370 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/5.4.0/backward"
Austin Schuh044e18b2015-10-21 20:17:09 -0700371 cxx_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700372 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700373 cxx_flag: "-isystem"
Austin Schuh94f51e92017-10-30 19:25:32 -0700374 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include-fixed"
Austin Schuh044e18b2015-10-21 20:17:09 -0700375 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500376 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700377 cxx_flag: "-isystem"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500378 cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/usr/include"
Austin Schuh044e18b2015-10-21 20:17:09 -0700379
Austin Schuh23da18b2015-10-11 20:52:49 -0700380 # TODO(bazel-team): In theory, the path here ought to exactly match the path
381 # used by gcc. That works because bazel currently doesn't track files at
382 # absolute locations and has no remote execution, yet. However, this will need
383 # to be fixed, maybe with auto-detection?
Austin Schuh94f51e92017-10-30 19:25:32 -0700384 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/5.4.0"
385 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/5.4.0/arm-frc-linux-gnueabi"
386 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/5.4.0/backward"
387 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include)%"
388 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/5.4.0/include-fixed)%"
Brian Silverman826e1cd2016-01-31 18:26:00 -0500389 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%"
390 cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/usr/include)%"
Austin Schuh23da18b2015-10-11 20:52:49 -0700391
392 linker_flag: "-lstdc++"
Brian Silvermanb200c172017-01-02 17:35:35 -0800393 linker_flag: "-Ltools/cpp/arm-frc-linux-gnueabi/libs"
Austin Schuh23da18b2015-10-11 20:52:49 -0700394
395 feature {
396 name: "opt"
397 implies: "all_modes"
398 flag_set {
399 action: "preprocess-assemble"
400 action: "c-compile"
401 action: "c++-compile"
402 action: "c++-header-parsing"
403 action: "c++-header-preprocessing"
404 action: "c++-module-compile"
405 flag_group {
406 flag: "-DAOS_DEBUG=0"
407 }
408 }
409 }
410
411 feature {
412 name: "dbg"
413 implies: "all_modes"
414 flag_set {
415 action: "preprocess-assemble"
416 action: "c-compile"
417 action: "c++-compile"
418 action: "c++-header-parsing"
419 action: "c++-header-preprocessing"
420 action: "c++-module-compile"
421 flag_group {
422 flag: "-DAOS_DEBUG=1"
423 }
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500424 flag_group {
425 flag: "-fno-omit-frame-pointer"
426 }
Austin Schuh23da18b2015-10-11 20:52:49 -0700427 }
428 }
429
430 feature {
431 name: "fastbuild"
432 implies: "all_modes"
433 flag_set {
434 action: "preprocess-assemble"
435 action: "c-compile"
436 action: "c++-compile"
437 action: "c++-header-parsing"
438 action: "c++-header-preprocessing"
439 action: "c++-module-compile"
440 flag_group {
441 flag: "-DAOS_DEBUG=0"
442 }
443 }
444 }
445
446 feature {
447 name: "all_modes"
448 flag_set {
Austin Schuh23da18b2015-10-11 20:52:49 -0700449 action: "preprocess-assemble"
450 action: "assemble"
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500451 action: "c-compile"
Austin Schuh23da18b2015-10-11 20:52:49 -0700452 flag_group {
453 flag: "-std=gnu99"
454 }
455 }
456 flag_set {
457 action: "c++-compile"
458 action: "c++-header-parsing"
459 action: "c++-header-preprocessing"
460 action: "c++-module-compile"
461 flag_group {
462 flag: "-std=gnu++1y"
463 }
464 }
465 flag_set {
466 action: "preprocess-assemble"
467 action: "assemble"
468 action: "c++-link"
469 action: "c++-compile"
470 action: "c++-header-parsing"
471 action: "c++-header-preprocessing"
472 action: "c++-module-compile"
473 action: "c-compile"
474 flag_group {
475 # We always want to compile with -pthread semantics.
476 flag: "-pthread"
477 }
478 }
479 }
480
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500481 compiler_flag: "-mfpu=neon"
482 # TODO(brians): See if it will run with this enabled.
483 #compiler_flag: "-mhwdiv=arm,thumb"
484
Austin Schuh23da18b2015-10-11 20:52:49 -0700485 # Anticipated future default.
486 # This makes GCC and Clang do what we want when called through symlinks.
487 unfiltered_cxx_flag: "-no-canonical-prefixes"
488 linker_flag: "-no-canonical-prefixes"
489
490 # Things that the code wants defined.
491 compiler_flag: "-D__STDC_FORMAT_MACROS"
492 compiler_flag: "-D__STDC_CONSTANT_MACROS"
493 compiler_flag: "-D__STDC_LIMIT_MACROS"
494 compiler_flag: "-D_FILE_OFFSET_BITS=64"
495 # TODO(Brian): Rename this or something.
Austin Schuha20ae722015-11-01 12:29:38 -0800496 compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
Austin Schuh23da18b2015-10-11 20:52:49 -0700497
498 #linker_flag: "-fuse-ld=gold"
499
Austin Schuh23da18b2015-10-11 20:52:49 -0700500 # Make C++ compilation deterministic. Use linkstamping instead of these
501 # compiler symbols.
502 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
503 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
504 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
505 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
506
507 # Security hardening on by default.
508 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
509 # We need to undef it before redefining it as some distributions now have
510 # it enabled by default.
511 compiler_flag: "-U_FORTIFY_SOURCE"
512 compiler_flag: "-fstack-protector"
513 compiler_flag: "-fPIE"
Austin Schuh23da18b2015-10-11 20:52:49 -0700514 linker_flag: "-Wl,-z,relro,-z,now"
515
516 # Pretty much everything needs this, including parts of the glibc STL...
517 linker_flag: "-lm"
518
519 # Enable coloring even if there's no attached terminal. Bazel removes the
520 # escape sequences if --nocolor is specified.
521 compiler_flag: "-fdiagnostics-color=always"
522
523 compiler_flag: "-Wall"
524 compiler_flag: "-Wextra"
Austin Schuh23da18b2015-10-11 20:52:49 -0700525 compiler_flag: "-Wpointer-arith"
Brian Silverman594be0d2015-10-31 17:56:23 -0400526 compiler_flag: "-Wstrict-aliasing"
Austin Schuh23da18b2015-10-11 20:52:49 -0700527 compiler_flag: "-Wcast-qual"
528 compiler_flag: "-Wcast-align"
529 compiler_flag: "-Wwrite-strings"
530 compiler_flag: "-Wtype-limits"
531 compiler_flag: "-Wsign-compare"
532 compiler_flag: "-Wformat=2"
533 compiler_flag: "-Werror"
Brian Silvermana4a4ea62015-11-27 10:27:53 -0500534 compiler_flag: "-Wunused-local-typedefs"
Austin Schuh23da18b2015-10-11 20:52:49 -0700535
536 # Keep stack frames for debugging, even in opt mode.
537 compiler_flag: "-fno-omit-frame-pointer"
538 compiler_flag: "-D__has_feature(x)=0"
539
540 # Don't use temp files while compiling.
541 compiler_flag: "-pipe"
542
543 # Have GCC return the exit code from ld.
544 linker_flag: "-pass-exit-codes"
545
546 # Stamp the binary with a unique identifier.
547 linker_flag: "-Wl,--build-id=md5"
548 linker_flag: "-Wl,--hash-style=gnu"
549 #linker_flag: "-Wl,--warn-execstack"
550 #linker_flag: "-Wl,--detect-odr-violations"
551
Brian Silvermand2540402015-11-28 18:35:00 -0500552 # Enable debug symbols.
553 compiler_flag: "-ggdb3"
554
Austin Schuh23da18b2015-10-11 20:52:49 -0700555 compilation_mode_flags {
556 mode: OPT
557
Brian Silverman594be0d2015-10-31 17:56:23 -0400558 compiler_flag: "-O2"
Austin Schuh23da18b2015-10-11 20:52:49 -0700559
560 # Disable assertions
561 compiler_flag: "-DNDEBUG"
562 compiler_flag: "-D_FORTIFY_SOURCE=1"
563
564 # Removal of unused code and data at link time (can this increase binary size in some cases?).
565 compiler_flag: "-ffunction-sections"
566 compiler_flag: "-fdata-sections"
567 linker_flag: "-Wl,--gc-sections"
568 }
Austin Schuh137d9452018-07-07 15:42:36 -0700569 feature {
570 name: "pie_for_linking"
571 enabled: true
572 flag_set {
573 action: "c++-link-executable"
574 flag_group {
575 flag: "-pie"
576 }
577 }
578 }
Austin Schuh23da18b2015-10-11 20:52:49 -0700579}
Brian Silverman0d57fc82016-01-24 21:02:53 -0500580
581toolchain {
582 abi_version: "clang_3.6"
583 abi_libc_version: "glibc_2.19"
584 builtin_sysroot: ""
585 compiler: "clang"
Brian Silverman4bde3e52018-02-17 23:57:09 -0500586 host_system_name: "linux"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500587 needsPic: true
588 supports_gold_linker: false
589 supports_incremental_linker: false
590 supports_fission: false
591 supports_interface_shared_objects: false
592 supports_normalizing_ar: true
593 supports_start_end_lib: false
594 supports_thin_archives: true
595 target_libc: "glibc_2.19"
596 target_cpu: "armhf-debian"
597 target_system_name: "arm_a15"
598 toolchain_identifier: "clang_linux_armhf"
599
600 tool_path { name: "ar" path: "linaro_linux_gcc/arm-linux-gnueabihf-ar" }
601 tool_path { name: "compat-ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
602 tool_path { name: "cpp" path: "linaro_linux_gcc/clang_bin/clang" }
603 tool_path { name: "dwp" path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp" }
604 tool_path { name: "gcc" path: "linaro_linux_gcc/clang_bin/clang" }
605 tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
606 # C(++) compiles invoke the compiler (as that is the one knowing where
607 # to find libraries), but we provide LD so other rules can invoke the linker.
608 tool_path { name: "ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
609 tool_path { name: "nm" path: "linaro_linux_gcc/arm-linux-gnueabihf-nm" }
610 tool_path { name: "objcopy" path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy" }
611 objcopy_embed_flag: "-I"
612 objcopy_embed_flag: "binary"
613 tool_path { name: "objdump" path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump" }
614 tool_path { name: "strip" path: "linaro_linux_gcc/arm-linux-gnueabihf-strip" }
Brian Silverman6d350402016-03-05 01:15:46 -0500615 linking_mode_flags { mode: DYNAMIC }
Brian Silverman0d57fc82016-01-24 21:02:53 -0500616
617 compiler_flag: "-target"
618 compiler_flag: "armv7a-arm-linux-gnueabif"
Austin Schuh61660832016-03-04 21:56:39 -0800619 compiler_flag: "--sysroot=external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500620 compiler_flag: "-mfloat-abi=hard"
621 compiler_flag: "-mfpu=vfpv3-d16"
622
623 compiler_flag: "-nostdinc"
624 compiler_flag: "-isystem"
625 compiler_flag: "/usr/lib/clang/3.6/include"
626 compiler_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800627 compiler_flag: "external/linaro_linux_gcc_4_9_repo/lib/gcc/arm-linux-gnueabihf/4.9.3/include"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500628 compiler_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800629 compiler_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/usr/include"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500630 compiler_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800631 compiler_flag: "external/linaro_linux_gcc_4_9_repo/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500632 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800633 cxx_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/include/c++/4.9.3/arm-linux-gnueabihf"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500634 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800635 cxx_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/include/c++/4.9.3"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500636 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800637 cxx_flag: "external/linaro_linux_gcc_4_9_repo/include/c++/4.9.3/arm-linux-gnueabihf"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500638 cxx_flag: "-isystem"
Austin Schuh61660832016-03-04 21:56:39 -0800639 cxx_flag: "external/linaro_linux_gcc_4_9_repo/include/c++/4.9.3"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500640
Austin Schuh61660832016-03-04 21:56:39 -0800641 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//include)%"
642 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/usr/include)%"
643 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/usr/lib/include)%"
644 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed)%"
645 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//include)%/c++/4.9.3"
646 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/4.9.3/include)%"
647 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed)%"
648 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//lib/gcc/arm-linux-gnueabihf/4.9.3/include)%"
649 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed)%"
650 cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/include)%/c++/4.9.3"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500651 cxx_builtin_include_directory: '/usr/lib/clang/3.6/include'
652
653 linker_flag: "-target"
654 linker_flag: "armv7a-arm-linux-gnueabif"
Austin Schuh61660832016-03-04 21:56:39 -0800655 linker_flag: "--sysroot=external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500656 linker_flag: "-lstdc++"
657 linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs"
Austin Schuh61660832016-03-04 21:56:39 -0800658 linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/lib"
659 linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/lib"
660 linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/usr/lib"
661 linker_flag: "-Bexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/bin"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500662 linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3"
663
664 feature {
665 name: "opt"
666 implies: "all_modes"
667 flag_set {
668 action: "preprocess-assemble"
669 action: "c-compile"
670 action: "c++-compile"
671 action: "c++-header-parsing"
672 action: "c++-header-preprocessing"
673 action: "c++-module-compile"
674 flag_group {
675 flag: "-DAOS_DEBUG=0"
676 }
677 }
678 }
679
680 feature {
681 name: "dbg"
682 implies: "all_modes"
683 flag_set {
684 action: "preprocess-assemble"
685 action: "c-compile"
686 action: "c++-compile"
687 action: "c++-header-parsing"
688 action: "c++-header-preprocessing"
689 action: "c++-module-compile"
690 flag_group {
691 flag: "-DAOS_DEBUG=1"
692 }
693 flag_group {
694 flag: "-fno-omit-frame-pointer"
695 }
696 }
697 }
698
699 feature {
700 name: "fastbuild"
701 implies: "all_modes"
702 flag_set {
703 action: "preprocess-assemble"
704 action: "c-compile"
705 action: "c++-compile"
706 action: "c++-header-parsing"
707 action: "c++-header-preprocessing"
708 action: "c++-module-compile"
709 flag_group {
710 flag: "-DAOS_DEBUG=0"
711 }
712 }
713 }
714
715 feature {
716 name: "all_modes"
717 flag_set {
718 action: "preprocess-assemble"
719 action: "assemble"
720 action: "c-compile"
721 flag_group {
722 flag: "-std=gnu99"
723 }
724 }
725 flag_set {
726 action: "c++-compile"
727 action: "c++-header-parsing"
728 action: "c++-header-preprocessing"
729 action: "c++-module-compile"
730 flag_group {
731 flag: "-std=gnu++1y"
732 }
733 }
734 flag_set {
735 action: "preprocess-assemble"
736 action: "assemble"
737 action: "c++-link"
738 action: "c++-compile"
739 action: "c++-header-parsing"
740 action: "c++-header-preprocessing"
741 action: "c++-module-compile"
742 action: "c-compile"
743 flag_group {
744 # We always want to compile with -pthread semantics.
745 flag: "-pthread"
746 }
747 }
748 }
749
750 # Anticipated future default.
751 # This makes GCC and Clang do what we want when called through symlinks.
752 unfiltered_cxx_flag: "-no-canonical-prefixes"
753 linker_flag: "-no-canonical-prefixes"
754
755 # Things that the code wants defined.
756 compiler_flag: "-D__STDC_FORMAT_MACROS"
757 compiler_flag: "-D__STDC_CONSTANT_MACROS"
758 compiler_flag: "-D__STDC_LIMIT_MACROS"
759 compiler_flag: "-D_FILE_OFFSET_BITS=64"
760 # TODO(Brian): Rename this or something.
761 compiler_flag: "-DAOS_ARCHITECTURE_armhf"
762
763 # Make C++ compilation deterministic. Use linkstamping instead of these
764 # compiler symbols.
765 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
766 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
767 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
768 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
769
770 # Security hardening on by default.
771 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
772 # We need to undef it before redefining it as some distributions now have
773 # it enabled by default.
774 compiler_flag: "-U_FORTIFY_SOURCE"
775 compiler_flag: "-fstack-protector"
776 compiler_flag: "-fPIE"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500777 linker_flag: "-Wl,-z,relro,-z,now"
778
779 # Pretty much everything needs this, including parts of the glibc STL...
780 linker_flag: "-lm"
781
782 # Enable coloring even if there's no attached terminal. Bazel removes the
783 # escape sequences if --nocolor is specified.
784 compiler_flag: "-fdiagnostics-color=always"
785
786 compiler_flag: "-Wall"
787 compiler_flag: "-Wextra"
Brian Silverman0d57fc82016-01-24 21:02:53 -0500788 compiler_flag: "-Wpointer-arith"
789 compiler_flag: "-Wstrict-aliasing"
790 compiler_flag: "-Wcast-qual"
791 compiler_flag: "-Wcast-align"
792 compiler_flag: "-Wwrite-strings"
793 compiler_flag: "-Wtype-limits"
794 compiler_flag: "-Wsign-compare"
795 compiler_flag: "-Wformat=2"
796 compiler_flag: "-Werror"
797 compiler_flag: "-Wunused-local-typedefs"
798
799 # Keep stack frames for debugging, even in opt mode.
800 compiler_flag: "-fno-omit-frame-pointer"
801
802 # Don't use temp files while compiling.
803 compiler_flag: "-pipe"
804
805 # Stamp the binary with a unique identifier.
806 linker_flag: "-Wl,--build-id=md5"
807 linker_flag: "-Wl,--hash-style=gnu"
808 #linker_flag: "-Wl,--warn-execstack"
809 #linker_flag: "-Wl,--detect-odr-violations"
810
811 # Enable debug symbols.
812 compiler_flag: "-ggdb3"
813
814 compilation_mode_flags {
815 mode: OPT
816
817 compiler_flag: "-O2"
818
819 # Disable assertions
820 compiler_flag: "-DNDEBUG"
821 compiler_flag: "-D_FORTIFY_SOURCE=1"
822
823 # Removal of unused code and data at link time (can this increase binary size in some cases?).
824 compiler_flag: "-ffunction-sections"
825 compiler_flag: "-fdata-sections"
826 linker_flag: "-Wl,--gc-sections"
827 }
Austin Schuh137d9452018-07-07 15:42:36 -0700828 feature {
829 name: "pie_for_linking"
830 enabled: true
831 flag_set {
832 action: "c++-link-executable"
833 flag_group {
834 flag: "-pie"
835 }
836 }
837 }
Brian Silverman0d57fc82016-01-24 21:02:53 -0500838}
Brian Silverman8b638692017-06-26 23:10:26 -0700839
840toolchain {
841 abi_version: "cortex-m4f"
842 abi_libc_version: "cortex-m4f"
843 builtin_sysroot: ""
844 compiler: "gcc"
845 host_system_name: "local"
846 needsPic: false
847 supports_gold_linker: false
848 supports_incremental_linker: false
849 supports_fission: false
850 supports_interface_shared_objects: false
851 supports_normalizing_ar: false
852 supports_start_end_lib: false
853 supports_thin_archives: false
854 target_libc: "cortex-m4f"
855 target_cpu: "cortex-m4f"
856 target_system_name: "cortex-m4f"
857 toolchain_identifier: "cortex-m4f"
858
859 tool_path { name: "ar" path: "/usr/bin/arm-none-eabi-ar" }
860 tool_path { name: "compat-ld" path: "/usr/bin/arm-none-eabi-ld" }
861 tool_path { name: "cpp" path: "/usr/bin/arm-none-eabi-cpp" }
862 tool_path { name: "dwp" path: "/usr/bin/arm-none-eabi-dwp" }
863 tool_path { name: "gcc" path: "/usr/bin/arm-none-eabi-gcc" }
864 tool_path { name: "gcov" path: "/usr/bin/arm-none-eabi-gcov" }
865 # C(++) compiles invoke the compiler (as that is the one knowing where
866 # to find libraries), but we provide LD so other rules can invoke the linker.
867 tool_path { name: "ld" path: "/usr/bin/arm-none-eabi-ld" }
868 tool_path { name: "nm" path: "/usr/bin/arm-none-eabi-nm" }
869 tool_path { name: "objcopy" path: "/usr/bin/arm-none-eabi-objcopy" }
870 objcopy_embed_flag: "-I"
871 objcopy_embed_flag: "binary"
872 tool_path { name: "objdump" path: "/usr/bin/arm-none-eabi-objdump" }
873 tool_path { name: "strip" path: "/usr/bin/arm-none-eabi-strip" }
874 linking_mode_flags { mode: FULLY_STATIC }
875
876 # TODO(bazel-team): In theory, the path here ought to exactly match the path
877 # used by gcc. That works because bazel currently doesn't track files at
878 # absolute locations and has no remote execution, yet. However, this will need
879 # to be fixed, maybe with auto-detection?
880 cxx_builtin_include_directory: '/usr/lib/gcc/arm-none-eabi/4.8/include'
881 cxx_builtin_include_directory: '/usr/lib/gcc/arm-none-eabi/4.8/include-fixed'
882 cxx_builtin_include_directory: '/usr/lib/arm-none-eabi/include'
883 cxx_builtin_include_directory: '/usr/include/newlib',
884
885 feature {
886 name: "dbg"
887 implies: "all_modes"
888 flag_set {
889 action: "preprocess-assemble"
890 action: "c-compile"
891 action: "c++-compile"
892 action: "c++-header-parsing"
893 action: "c++-header-preprocessing"
894 action: "c++-module-compile"
895 flag_group {
896 flag: "-fno-omit-frame-pointer"
897 }
898 }
899 }
900
901 feature {
902 name: "opt"
903 implies: "all_modes"
904 }
905 feature {
906 name: "fastbuild"
907 implies: "all_modes"
908 }
909
910 feature {
911 name: "all_modes"
912 flag_set {
913 action: "preprocess-assemble"
914 action: "assemble"
915 action: "c-compile"
916 flag_group {
917 flag: "--std=gnu99"
918 }
919 }
920 flag_set {
921 action: "c++-compile"
922 action: "c++-header-parsing"
923 action: "c++-header-preprocessing"
924 action: "c++-module-compile"
925 flag_group {
926 flag: "--std=gnu++11"
927 flag: "-fno-exceptions"
928 flag: "-fno-rtti"
929 }
930 }
931 }
932
933 # Anticipated future default.
934 # This makes GCC and Clang do what we want when called through symlinks.
935 unfiltered_cxx_flag: "-no-canonical-prefixes"
936 linker_flag: "-no-canonical-prefixes"
937
938 # Things that the code wants defined.
939 compiler_flag: "-D__STDC_FORMAT_MACROS"
940 compiler_flag: "-D__STDC_CONSTANT_MACROS"
941 compiler_flag: "-D__STDC_LIMIT_MACROS"
Brian Silvermanf91524f2017-09-23 13:15:55 -0400942
943 # Some identifiers for what MCU we're using.
Brian Silverman8b638692017-06-26 23:10:26 -0700944 compiler_flag: "-D__MK64FX512__"
945 compiler_flag: "-DF_CPU=120000000"
Brian Silvermanf91524f2017-09-23 13:15:55 -0400946
Brian Silverman8b638692017-06-26 23:10:26 -0700947 compiler_flag: "-Wl,--gc-sections"
948
Brian Silvermanf91524f2017-09-23 13:15:55 -0400949 # Newlib's stdint.h does this, but GCC's freestanding stdint.h doesn't use
950 # newlib's so we have to do it manually...
951 compiler_flag: "-D__have_long32"
952
Brian Silverman8b638692017-06-26 23:10:26 -0700953 # Make C++ compilation deterministic. Use linkstamping instead of these
954 # compiler symbols.
955 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
956 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
957 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
958 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
959
960 # Security hardening on by default.
961 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
962 # We need to undef it before redefining it as some distributions now have
963 # it enabled by default.
964 compiler_flag: "-fstack-protector"
965 compiler_flag: "-mcpu=cortex-m4"
966 compiler_flag: "-mfpu=fpv4-sp-d16"
967 compiler_flag: "-mthumb"
968 compiler_flag: "-mfloat-abi=hard"
969 compiler_flag: "-fno-strict-aliasing"
970 linker_flag: "-mcpu=cortex-m4"
971 linker_flag: "-mfpu=fpv4-sp-d16"
972 linker_flag: "-mthumb"
973 linker_flag: "-mfloat-abi=hard"
974 linker_flag: "-fno-strict-aliasing"
975 linker_flag: "--specs=nano.specs"
976
977 # Pretty much everything needs this, including parts of the glibc STL...
978 linker_flag: "-lgcc"
979 linker_flag: "-lstdc++"
980 linker_flag: "-lm"
981 linker_flag: "-lc"
982 linker_flag: "-Tmotors/core/mk64fx512.ld"
983
984 compiler_flag: "-fmessage-length=80"
Brian Silvermanf91524f2017-09-23 13:15:55 -0400985 compiler_flag: "-fmax-errors=20"
Brian Silverman8b638692017-06-26 23:10:26 -0700986
987 compiler_flag: "-Wall"
988 compiler_flag: "-Wextra"
Brian Silverman8b638692017-06-26 23:10:26 -0700989 compiler_flag: "-Wpointer-arith"
990 compiler_flag: "-Wcast-qual"
991 compiler_flag: "-Wwrite-strings"
992 compiler_flag: "-Wtype-limits"
993 compiler_flag: "-Wsign-compare"
994 compiler_flag: "-Wformat=2"
995 compiler_flag: "-Werror"
996 compiler_flag: "-Wstrict-aliasing=2"
997
998 # Be annoying about using doubles places we probably didn't mean to, because
999 # the FPU only does single-precision.
1000 compiler_flag: "-Wdouble-promotion"
1001
1002 # Don't use temp files while compiling.
1003 compiler_flag: "-pipe"
1004
1005 # Stamp the binary with a unique identifier.
1006 # TODO(austin): Put these back in.
1007 #linker_flag: "-Wl,--build-id=md5"
1008 #linker_flag: "-Wl,--hash-style=gnu"
1009
1010 # Enable debug symbols.
1011 compiler_flag: "-g"
1012
Brian Silvermanf91524f2017-09-23 13:15:55 -04001013 # Common symbols are weird and not what we want, so just give multiple
Brian Silverman8b638692017-06-26 23:10:26 -07001014 # declaration errors instead.
1015 compiler_flag: "-fno-common"
1016
Brian Silvermanf91524f2017-09-23 13:15:55 -04001017 # We're not a hosted environment (no file IO, main is called from our code,
1018 # etc).
1019 compiler_flag: "-ffreestanding"
1020 # However, we still want to optimize things like memcpy.
1021 compiler_flag: "-fbuiltin"
1022
Brian Silverman8b638692017-06-26 23:10:26 -07001023 compilation_mode_flags {
1024 mode: OPT
1025
1026 # Freescale recommends this combination for reducing cycle count.
1027 # http://www.nxp.com/assets/documents/data/en/application-notes/AN4808.pdf
1028 compiler_flag: "-O2"
1029 compiler_flag: "-finline-functions"
1030
1031 # This is definitely worth it for us. It makes the FPU a lot more useful,
1032 # especially with complex arithmetic, which matters a lot.
1033 compiler_flag: "-ffast-math"
1034
1035 # It seems like this is a good idea, at least for the number crunching code.
1036 # Might want to look into moving it to copts on specific rules if the code
1037 # size increase becomes a problem.
1038 compiler_flag: "-funroll-loops"
1039
1040 # Disable assertions
1041 compiler_flag: "-DNDEBUG"
1042
1043 # Removal of unused code and data at link time (can this increase binary size in some cases?).
1044 compiler_flag: "-ffunction-sections"
1045 #compiler_flag: "-fdata-sections"
1046 linker_flag: "-Wl,--gc-sections"
1047 }
1048
1049 feature {
1050 name: 'include_paths'
1051 flag_set {
1052 action: 'preprocess-assemble'
1053 action: 'c-compile'
1054 action: 'c++-compile'
1055 action: 'c++-header-parsing'
1056 action: 'c++-header-preprocessing'
1057 action: 'c++-module-compile'
1058 flag_group {
Brian Silvermanf91524f2017-09-23 13:15:55 -04001059 iterate_over: 'quote_include_paths'
Brian Silverman8b638692017-06-26 23:10:26 -07001060 flag: '-iquote'
1061 flag: '%{quote_include_paths}'
1062 }
1063 flag_group {
Brian Silvermanf91524f2017-09-23 13:15:55 -04001064 iterate_over: 'include_paths'
Brian Silverman8b638692017-06-26 23:10:26 -07001065 flag: '-I%{include_paths}'
1066 }
1067 flag_group {
Brian Silvermanf91524f2017-09-23 13:15:55 -04001068 iterate_over: 'system_include_paths'
Brian Silverman6260c092018-01-14 15:21:36 -08001069 flag: '-I'
Brian Silverman8b638692017-06-26 23:10:26 -07001070 flag: '%{system_include_paths}'
1071 }
1072 }
1073 }
1074}