Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 1 | major_version: "local" |
| 2 | minor_version: "" |
| 3 | default_target_cpu: "same_as_host" |
| 4 | |
| 5 | default_toolchain { |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 6 | cpu: "roborio" |
| 7 | toolchain_identifier: "roborio_linux" |
| 8 | } |
| 9 | |
| 10 | default_toolchain { |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 11 | cpu: "k8" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 12 | toolchain_identifier: "k8_linux" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 13 | } |
| 14 | |
| 15 | default_toolchain { |
| 16 | cpu: "armeabi-v7a" |
| 17 | toolchain_identifier: "stub_armeabi-v7a" |
| 18 | } |
| 19 | |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 20 | default_toolchain { |
| 21 | cpu: "armhf-debian" |
| 22 | toolchain_identifier: "clang_linux_armhf" |
| 23 | } |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 24 | |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 25 | default_toolchain { |
| 26 | cpu: "cortex-m4f" |
| 27 | toolchain_identifier: "cortex-m4f" |
| 28 | } |
| 29 | |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 30 | toolchain { |
| 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 | |
| 63 | toolchain { |
| 64 | abi_version: "local" |
| 65 | abi_libc_version: "local" |
| 66 | builtin_sysroot: "" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 67 | compiler: "clang" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 68 | 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 Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 78 | target_cpu: "k8" |
| 79 | target_system_name: "k8" |
| 80 | toolchain_identifier: "k8_linux" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 81 | |
| 82 | tool_path { name: "ar" path: "/usr/bin/ar" } |
| 83 | tool_path { name: "compat-ld" path: "/usr/bin/ld" } |
| 84 | tool_path { name: "cpp" path: "/usr/bin/cpp" } |
| 85 | tool_path { name: "dwp" path: "/usr/bin/dwp" } |
| 86 | tool_path { name: "gcc" path: "/usr/bin/clang-3.6" } |
| 87 | tool_path { name: "gcov" path: "/usr/bin/gcov" } |
| 88 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 89 | # to find libraries), but we provide LD so other rules can invoke the linker. |
| 90 | tool_path { name: "ld" path: "/usr/bin/ld" } |
| 91 | tool_path { name: "nm" path: "/usr/bin/nm" } |
| 92 | tool_path { name: "objcopy" path: "/usr/bin/objcopy" } |
| 93 | objcopy_embed_flag: "-I" |
| 94 | objcopy_embed_flag: "binary" |
| 95 | tool_path { name: "objdump" path: "/usr/bin/objdump" } |
| 96 | tool_path { name: "strip" path: "/usr/bin/strip" } |
Brian Silverman | 6d35040 | 2016-03-05 01:15:46 -0500 | [diff] [blame] | 97 | linking_mode_flags { mode: DYNAMIC } |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 98 | |
| 99 | # TODO(bazel-team): In theory, the path here ought to exactly match the path |
| 100 | # used by gcc. That works because bazel currently doesn't track files at |
| 101 | # absolute locations and has no remote execution, yet. However, this will need |
| 102 | # to be fixed, maybe with auto-detection? |
Austin Schuh | 7b684d3 | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 103 | cxx_builtin_include_directory: '/usr/include/c++/4.9' |
| 104 | cxx_builtin_include_directory: '/usr/include/x86_64-linux-gnu/c++/4.9' |
| 105 | cxx_builtin_include_directory: '/usr/include/c++/4.9/backward' |
| 106 | cxx_builtin_include_directory: '/usr/local/include' |
| 107 | cxx_builtin_include_directory: '/usr/lib/llvm-3.6/lib/clang/3.6.2/include' |
| 108 | cxx_builtin_include_directory: '/usr/include/x86_64-linux-gnu' |
| 109 | cxx_builtin_include_directory: '/usr/include' |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 110 | cxx_builtin_include_directory: '/usr/lib/clang/3.6.2/include' |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 111 | |
| 112 | linker_flag: "-lstdc++" |
| 113 | linker_flag: "-B/usr/bin/" |
| 114 | |
| 115 | feature { |
| 116 | name: "opt" |
| 117 | implies: "all_modes" |
| 118 | flag_set { |
| 119 | action: "preprocess-assemble" |
| 120 | action: "c-compile" |
| 121 | action: "c++-compile" |
| 122 | action: "c++-header-parsing" |
| 123 | action: "c++-header-preprocessing" |
| 124 | action: "c++-module-compile" |
| 125 | flag_group { |
| 126 | flag: "-DAOS_DEBUG=0" |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | feature { |
| 132 | name: "dbg" |
| 133 | implies: "all_modes" |
| 134 | flag_set { |
| 135 | action: "preprocess-assemble" |
| 136 | action: "c-compile" |
| 137 | action: "c++-compile" |
| 138 | action: "c++-header-parsing" |
| 139 | action: "c++-header-preprocessing" |
| 140 | action: "c++-module-compile" |
| 141 | flag_group { |
| 142 | flag: "-DAOS_DEBUG=1" |
| 143 | } |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 144 | flag_group { |
| 145 | flag: "-fno-omit-frame-pointer" |
| 146 | } |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 147 | } |
| 148 | } |
| 149 | |
| 150 | feature { |
| 151 | name: "fastbuild" |
| 152 | implies: "all_modes" |
| 153 | flag_set { |
| 154 | action: "preprocess-assemble" |
| 155 | action: "c-compile" |
| 156 | action: "c++-compile" |
| 157 | action: "c++-header-parsing" |
| 158 | action: "c++-header-preprocessing" |
| 159 | action: "c++-module-compile" |
| 160 | flag_group { |
| 161 | flag: "-DAOS_DEBUG=0" |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | feature { |
| 167 | name: "all_modes" |
| 168 | flag_set { |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 169 | action: "preprocess-assemble" |
| 170 | action: "assemble" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 171 | action: "c-compile" |
| 172 | flag_group { |
| 173 | flag: "-std=gnu99" |
| 174 | } |
| 175 | } |
| 176 | flag_set { |
| 177 | action: "c++-compile" |
| 178 | action: "c++-header-parsing" |
| 179 | action: "c++-header-preprocessing" |
| 180 | action: "c++-module-compile" |
| 181 | flag_group { |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 182 | flag: "-std=gnu++1y" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 183 | } |
Brian Silverman | 23a1b34 | 2015-10-11 23:44:09 -0400 | [diff] [blame] | 184 | } |
| 185 | flag_set { |
| 186 | action: "preprocess-assemble" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 187 | action: "assemble" |
| 188 | action: "c++-link" |
Brian Silverman | 23a1b34 | 2015-10-11 23:44:09 -0400 | [diff] [blame] | 189 | action: "c++-compile" |
| 190 | action: "c++-header-parsing" |
| 191 | action: "c++-header-preprocessing" |
| 192 | action: "c++-module-compile" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 193 | action: "c-compile" |
Brian Silverman | 5dc0007 | 2015-10-12 00:38:14 -0400 | [diff] [blame] | 194 | flag_group { |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 195 | # We always want to compile with -pthread semantics. |
Brian Silverman | 5dc0007 | 2015-10-12 00:38:14 -0400 | [diff] [blame] | 196 | flag: "-pthread" |
| 197 | } |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 198 | } |
| 199 | } |
| 200 | |
| 201 | # Anticipated future default. |
| 202 | # This makes GCC and Clang do what we want when called through symlinks. |
| 203 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 204 | linker_flag: "-no-canonical-prefixes" |
| 205 | |
| 206 | # Things that the code wants defined. |
| 207 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 208 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 209 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
| 210 | compiler_flag: "-D_FILE_OFFSET_BITS=64" |
| 211 | # TODO(Brian): Rename this or something. |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 212 | compiler_flag: "-DAOS_ARCHITECTURE_arm_frc" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 213 | |
| 214 | linker_flag: "-fuse-ld=gold" |
| 215 | |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 216 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 217 | # compiler symbols. |
| 218 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 219 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 220 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 221 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 222 | |
| 223 | # Security hardening on by default. |
| 224 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 225 | # We need to undef it before redefining it as some distributions now have |
| 226 | # it enabled by default. |
| 227 | compiler_flag: "-U_FORTIFY_SOURCE" |
| 228 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 229 | compiler_flag: "-fstack-protector" |
| 230 | compiler_flag: "-fPIE" |
| 231 | linker_flag: "-pie" |
| 232 | linker_flag: "-Wl,-z,relro,-z,now" |
| 233 | |
| 234 | # Pretty much everything needs this, including parts of the glibc STL... |
| 235 | linker_flag: "-lm" |
| 236 | |
| 237 | # Enable coloring even if there's no attached terminal. Bazel removes the |
| 238 | # escape sequences if --nocolor is specified. |
| 239 | compiler_flag: "-fcolor-diagnostics" |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 240 | compiler_flag: "-fmessage-length=80" |
| 241 | compiler_flag: "-fmacro-backtrace-limit=0" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 242 | |
| 243 | compiler_flag: "-Wall" |
| 244 | compiler_flag: "-Wextra" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 245 | compiler_flag: "-Wpointer-arith" |
Brian Silverman | 594be0d | 2015-10-31 17:56:23 -0400 | [diff] [blame] | 246 | compiler_flag: "-Wstrict-aliasing" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 247 | compiler_flag: "-Wcast-qual" |
| 248 | compiler_flag: "-Wcast-align" |
| 249 | compiler_flag: "-Wwrite-strings" |
| 250 | compiler_flag: "-Wtype-limits" |
| 251 | compiler_flag: "-Wsign-compare" |
| 252 | compiler_flag: "-Wformat=2" |
| 253 | compiler_flag: "-Werror" |
| 254 | |
| 255 | # Keep stack frames for debugging, even in opt mode. |
| 256 | compiler_flag: "-fno-omit-frame-pointer" |
| 257 | |
| 258 | # Don't use temp files while compiling. |
| 259 | compiler_flag: "-pipe" |
| 260 | |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 261 | # Stamp the binary with a unique identifier. |
| 262 | linker_flag: "-Wl,--build-id=md5" |
| 263 | linker_flag: "-Wl,--hash-style=gnu" |
| 264 | linker_flag: "-Wl,--warn-execstack" |
| 265 | linker_flag: "-Wl,--detect-odr-violations" |
| 266 | |
Brian Silverman | d254040 | 2015-11-28 18:35:00 -0500 | [diff] [blame] | 267 | # Enable debug symbols. |
| 268 | compiler_flag: "-ggdb3" |
| 269 | |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 270 | compilation_mode_flags { |
| 271 | mode: OPT |
| 272 | |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 273 | compiler_flag: "-O2" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 274 | |
| 275 | # Disable assertions |
| 276 | compiler_flag: "-DNDEBUG" |
| 277 | |
| 278 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 279 | compiler_flag: "-ffunction-sections" |
| 280 | compiler_flag: "-fdata-sections" |
| 281 | linker_flag: "-Wl,--gc-sections" |
| 282 | } |
| 283 | } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 284 | |
| 285 | toolchain { |
| 286 | abi_version: "roborio" |
| 287 | abi_libc_version: "roborio" |
| 288 | builtin_sysroot: "" |
| 289 | compiler: "gcc" |
| 290 | host_system_name: "roborio" |
| 291 | needsPic: true |
| 292 | supports_gold_linker: false |
| 293 | supports_incremental_linker: false |
| 294 | supports_fission: false |
| 295 | supports_interface_shared_objects: false |
| 296 | supports_normalizing_ar: false |
| 297 | supports_start_end_lib: false |
| 298 | supports_thin_archives: false |
| 299 | target_libc: "roborio" |
| 300 | target_cpu: "roborio" |
| 301 | target_system_name: "roborio" |
| 302 | toolchain_identifier: "roborio_linux" |
| 303 | |
Austin Schuh | 55139fe | 2015-10-14 23:55:24 -0700 | [diff] [blame] | 304 | tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" } |
| 305 | tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" } |
| 306 | tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" } |
| 307 | tool_path { name: "dwp" path: "/bin/false" } |
| 308 | tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" } |
| 309 | tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 310 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 311 | # to find libraries), but we provide LD so other rules can invoke the linker. |
Austin Schuh | 55139fe | 2015-10-14 23:55:24 -0700 | [diff] [blame] | 312 | tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" } |
| 313 | tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" } |
| 314 | tool_path { name: "objcopy" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy" } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 315 | objcopy_embed_flag: "-I" |
| 316 | objcopy_embed_flag: "binary" |
Austin Schuh | 55139fe | 2015-10-14 23:55:24 -0700 | [diff] [blame] | 317 | tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" } |
| 318 | tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" } |
Brian Silverman | 6d35040 | 2016-03-05 01:15:46 -0500 | [diff] [blame] | 319 | linking_mode_flags { mode: DYNAMIC } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 320 | |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 321 | compiler_flag: "--sysroot=external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 322 | compiler_flag: "-nostdinc" |
| 323 | compiler_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 324 | compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include", |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 325 | compiler_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 326 | compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include-fixed" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 327 | compiler_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 328 | compiler_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/usr/include" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 329 | |
| 330 | cxx_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 331 | cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 332 | cxx_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 333 | cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3/arm-frc-linux-gnueabi" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 334 | cxx_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 335 | cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3/backward" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 336 | cxx_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 337 | cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 338 | cxx_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 339 | cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include-fixed" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 340 | cxx_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 341 | cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/include" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 342 | cxx_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 343 | cxx_flag: "external/arm_frc_linux_gnueabi_repo/usr/arm-frc-linux-gnueabi/usr/include" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 344 | |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 345 | # TODO(bazel-team): In theory, the path here ought to exactly match the path |
| 346 | # used by gcc. That works because bazel currently doesn't track files at |
| 347 | # absolute locations and has no remote execution, yet. However, this will need |
| 348 | # to be fixed, maybe with auto-detection? |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 349 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/4.9.3" |
| 350 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/4.9.3/arm-frc-linux-gnueabi" |
| 351 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/4.9.3/backward" |
| 352 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include)%" |
| 353 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include-fixed)%" |
| 354 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%" |
| 355 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/usr/include)%" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 356 | |
| 357 | linker_flag: "-lstdc++" |
Brian Silverman | b200c17 | 2017-01-02 17:35:35 -0800 | [diff] [blame] | 358 | linker_flag: "-Ltools/cpp/arm-frc-linux-gnueabi/libs" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 359 | |
| 360 | feature { |
| 361 | name: "opt" |
| 362 | implies: "all_modes" |
| 363 | flag_set { |
| 364 | action: "preprocess-assemble" |
| 365 | action: "c-compile" |
| 366 | action: "c++-compile" |
| 367 | action: "c++-header-parsing" |
| 368 | action: "c++-header-preprocessing" |
| 369 | action: "c++-module-compile" |
| 370 | flag_group { |
| 371 | flag: "-DAOS_DEBUG=0" |
| 372 | } |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | feature { |
| 377 | name: "dbg" |
| 378 | implies: "all_modes" |
| 379 | flag_set { |
| 380 | action: "preprocess-assemble" |
| 381 | action: "c-compile" |
| 382 | action: "c++-compile" |
| 383 | action: "c++-header-parsing" |
| 384 | action: "c++-header-preprocessing" |
| 385 | action: "c++-module-compile" |
| 386 | flag_group { |
| 387 | flag: "-DAOS_DEBUG=1" |
| 388 | } |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 389 | flag_group { |
| 390 | flag: "-fno-omit-frame-pointer" |
| 391 | } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 392 | } |
| 393 | } |
| 394 | |
| 395 | feature { |
| 396 | name: "fastbuild" |
| 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: "all_modes" |
| 413 | flag_set { |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 414 | action: "preprocess-assemble" |
| 415 | action: "assemble" |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 416 | action: "c-compile" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 417 | flag_group { |
| 418 | flag: "-std=gnu99" |
| 419 | } |
| 420 | } |
| 421 | flag_set { |
| 422 | action: "c++-compile" |
| 423 | action: "c++-header-parsing" |
| 424 | action: "c++-header-preprocessing" |
| 425 | action: "c++-module-compile" |
| 426 | flag_group { |
| 427 | flag: "-std=gnu++1y" |
| 428 | } |
| 429 | } |
| 430 | flag_set { |
| 431 | action: "preprocess-assemble" |
| 432 | action: "assemble" |
| 433 | action: "c++-link" |
| 434 | action: "c++-compile" |
| 435 | action: "c++-header-parsing" |
| 436 | action: "c++-header-preprocessing" |
| 437 | action: "c++-module-compile" |
| 438 | action: "c-compile" |
| 439 | flag_group { |
| 440 | # We always want to compile with -pthread semantics. |
| 441 | flag: "-pthread" |
| 442 | } |
| 443 | } |
| 444 | } |
| 445 | |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 446 | compiler_flag: "-mfpu=neon" |
| 447 | # TODO(brians): See if it will run with this enabled. |
| 448 | #compiler_flag: "-mhwdiv=arm,thumb" |
| 449 | |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 450 | # Anticipated future default. |
| 451 | # This makes GCC and Clang do what we want when called through symlinks. |
| 452 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 453 | linker_flag: "-no-canonical-prefixes" |
| 454 | |
| 455 | # Things that the code wants defined. |
| 456 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 457 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 458 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
| 459 | compiler_flag: "-D_FILE_OFFSET_BITS=64" |
| 460 | # TODO(Brian): Rename this or something. |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 461 | compiler_flag: "-DAOS_ARCHITECTURE_arm_frc" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 462 | |
| 463 | #linker_flag: "-fuse-ld=gold" |
| 464 | |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 465 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 466 | # compiler symbols. |
| 467 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 468 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 469 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 470 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 471 | |
| 472 | # Security hardening on by default. |
| 473 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 474 | # We need to undef it before redefining it as some distributions now have |
| 475 | # it enabled by default. |
| 476 | compiler_flag: "-U_FORTIFY_SOURCE" |
| 477 | compiler_flag: "-fstack-protector" |
| 478 | compiler_flag: "-fPIE" |
| 479 | linker_flag: "-pie" |
| 480 | linker_flag: "-Wl,-z,relro,-z,now" |
| 481 | |
| 482 | # Pretty much everything needs this, including parts of the glibc STL... |
| 483 | linker_flag: "-lm" |
| 484 | |
| 485 | # Enable coloring even if there's no attached terminal. Bazel removes the |
| 486 | # escape sequences if --nocolor is specified. |
| 487 | compiler_flag: "-fdiagnostics-color=always" |
| 488 | |
| 489 | compiler_flag: "-Wall" |
| 490 | compiler_flag: "-Wextra" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 491 | compiler_flag: "-Wpointer-arith" |
Brian Silverman | 594be0d | 2015-10-31 17:56:23 -0400 | [diff] [blame] | 492 | compiler_flag: "-Wstrict-aliasing" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 493 | compiler_flag: "-Wcast-qual" |
| 494 | compiler_flag: "-Wcast-align" |
| 495 | compiler_flag: "-Wwrite-strings" |
| 496 | compiler_flag: "-Wtype-limits" |
| 497 | compiler_flag: "-Wsign-compare" |
| 498 | compiler_flag: "-Wformat=2" |
| 499 | compiler_flag: "-Werror" |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 500 | compiler_flag: "-Wunused-local-typedefs" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 501 | |
| 502 | # Keep stack frames for debugging, even in opt mode. |
| 503 | compiler_flag: "-fno-omit-frame-pointer" |
| 504 | compiler_flag: "-D__has_feature(x)=0" |
| 505 | |
| 506 | # Don't use temp files while compiling. |
| 507 | compiler_flag: "-pipe" |
| 508 | |
| 509 | # Have GCC return the exit code from ld. |
| 510 | linker_flag: "-pass-exit-codes" |
| 511 | |
| 512 | # Stamp the binary with a unique identifier. |
| 513 | linker_flag: "-Wl,--build-id=md5" |
| 514 | linker_flag: "-Wl,--hash-style=gnu" |
| 515 | #linker_flag: "-Wl,--warn-execstack" |
| 516 | #linker_flag: "-Wl,--detect-odr-violations" |
| 517 | |
Brian Silverman | d254040 | 2015-11-28 18:35:00 -0500 | [diff] [blame] | 518 | # Enable debug symbols. |
| 519 | compiler_flag: "-ggdb3" |
| 520 | |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 521 | compilation_mode_flags { |
| 522 | mode: OPT |
| 523 | |
Brian Silverman | 594be0d | 2015-10-31 17:56:23 -0400 | [diff] [blame] | 524 | compiler_flag: "-O2" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 525 | |
| 526 | # Disable assertions |
| 527 | compiler_flag: "-DNDEBUG" |
| 528 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 529 | |
| 530 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 531 | compiler_flag: "-ffunction-sections" |
| 532 | compiler_flag: "-fdata-sections" |
| 533 | linker_flag: "-Wl,--gc-sections" |
| 534 | } |
| 535 | } |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 536 | |
| 537 | toolchain { |
| 538 | abi_version: "clang_3.6" |
| 539 | abi_libc_version: "glibc_2.19" |
| 540 | builtin_sysroot: "" |
| 541 | compiler: "clang" |
Brian Silverman | 4bde3e5 | 2018-02-17 23:57:09 -0500 | [diff] [blame^] | 542 | host_system_name: "linux" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 543 | needsPic: true |
| 544 | supports_gold_linker: false |
| 545 | supports_incremental_linker: false |
| 546 | supports_fission: false |
| 547 | supports_interface_shared_objects: false |
| 548 | supports_normalizing_ar: true |
| 549 | supports_start_end_lib: false |
| 550 | supports_thin_archives: true |
| 551 | target_libc: "glibc_2.19" |
| 552 | target_cpu: "armhf-debian" |
| 553 | target_system_name: "arm_a15" |
| 554 | toolchain_identifier: "clang_linux_armhf" |
| 555 | |
| 556 | tool_path { name: "ar" path: "linaro_linux_gcc/arm-linux-gnueabihf-ar" } |
| 557 | tool_path { name: "compat-ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" } |
| 558 | tool_path { name: "cpp" path: "linaro_linux_gcc/clang_bin/clang" } |
| 559 | tool_path { name: "dwp" path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp" } |
| 560 | tool_path { name: "gcc" path: "linaro_linux_gcc/clang_bin/clang" } |
| 561 | tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" } |
| 562 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 563 | # to find libraries), but we provide LD so other rules can invoke the linker. |
| 564 | tool_path { name: "ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" } |
| 565 | tool_path { name: "nm" path: "linaro_linux_gcc/arm-linux-gnueabihf-nm" } |
| 566 | tool_path { name: "objcopy" path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy" } |
| 567 | objcopy_embed_flag: "-I" |
| 568 | objcopy_embed_flag: "binary" |
| 569 | tool_path { name: "objdump" path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump" } |
| 570 | tool_path { name: "strip" path: "linaro_linux_gcc/arm-linux-gnueabihf-strip" } |
Brian Silverman | 6d35040 | 2016-03-05 01:15:46 -0500 | [diff] [blame] | 571 | linking_mode_flags { mode: DYNAMIC } |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 572 | |
| 573 | compiler_flag: "-target" |
| 574 | compiler_flag: "armv7a-arm-linux-gnueabif" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 575 | compiler_flag: "--sysroot=external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 576 | compiler_flag: "-mfloat-abi=hard" |
| 577 | compiler_flag: "-mfpu=vfpv3-d16" |
| 578 | |
| 579 | compiler_flag: "-nostdinc" |
| 580 | compiler_flag: "-isystem" |
| 581 | compiler_flag: "/usr/lib/clang/3.6/include" |
| 582 | compiler_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 583 | compiler_flag: "external/linaro_linux_gcc_4_9_repo/lib/gcc/arm-linux-gnueabihf/4.9.3/include" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 584 | compiler_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 585 | compiler_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/usr/include" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 586 | compiler_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 587 | compiler_flag: "external/linaro_linux_gcc_4_9_repo/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 588 | cxx_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 589 | cxx_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/include/c++/4.9.3/arm-linux-gnueabihf" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 590 | cxx_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 591 | cxx_flag: "external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/include/c++/4.9.3" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 592 | cxx_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 593 | cxx_flag: "external/linaro_linux_gcc_4_9_repo/include/c++/4.9.3/arm-linux-gnueabihf" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 594 | cxx_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 595 | cxx_flag: "external/linaro_linux_gcc_4_9_repo/include/c++/4.9.3" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 596 | |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 597 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//include)%" |
| 598 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/usr/include)%" |
| 599 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/usr/lib/include)%" |
| 600 | 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)%" |
| 601 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//include)%/c++/4.9.3" |
| 602 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/4.9.3/include)%" |
| 603 | 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)%" |
| 604 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//lib/gcc/arm-linux-gnueabihf/4.9.3/include)%" |
| 605 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed)%" |
| 606 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/include)%/c++/4.9.3" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 607 | cxx_builtin_include_directory: '/usr/lib/clang/3.6/include' |
| 608 | |
| 609 | linker_flag: "-target" |
| 610 | linker_flag: "armv7a-arm-linux-gnueabif" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 611 | linker_flag: "--sysroot=external/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 612 | linker_flag: "-lstdc++" |
| 613 | linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 614 | linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/lib" |
| 615 | linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/lib" |
| 616 | linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/usr/lib" |
| 617 | linker_flag: "-Bexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/bin" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 618 | linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3" |
| 619 | |
| 620 | feature { |
| 621 | name: "opt" |
| 622 | implies: "all_modes" |
| 623 | flag_set { |
| 624 | action: "preprocess-assemble" |
| 625 | action: "c-compile" |
| 626 | action: "c++-compile" |
| 627 | action: "c++-header-parsing" |
| 628 | action: "c++-header-preprocessing" |
| 629 | action: "c++-module-compile" |
| 630 | flag_group { |
| 631 | flag: "-DAOS_DEBUG=0" |
| 632 | } |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | feature { |
| 637 | name: "dbg" |
| 638 | implies: "all_modes" |
| 639 | flag_set { |
| 640 | action: "preprocess-assemble" |
| 641 | action: "c-compile" |
| 642 | action: "c++-compile" |
| 643 | action: "c++-header-parsing" |
| 644 | action: "c++-header-preprocessing" |
| 645 | action: "c++-module-compile" |
| 646 | flag_group { |
| 647 | flag: "-DAOS_DEBUG=1" |
| 648 | } |
| 649 | flag_group { |
| 650 | flag: "-fno-omit-frame-pointer" |
| 651 | } |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | feature { |
| 656 | name: "fastbuild" |
| 657 | implies: "all_modes" |
| 658 | flag_set { |
| 659 | action: "preprocess-assemble" |
| 660 | action: "c-compile" |
| 661 | action: "c++-compile" |
| 662 | action: "c++-header-parsing" |
| 663 | action: "c++-header-preprocessing" |
| 664 | action: "c++-module-compile" |
| 665 | flag_group { |
| 666 | flag: "-DAOS_DEBUG=0" |
| 667 | } |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | feature { |
| 672 | name: "all_modes" |
| 673 | flag_set { |
| 674 | action: "preprocess-assemble" |
| 675 | action: "assemble" |
| 676 | action: "c-compile" |
| 677 | flag_group { |
| 678 | flag: "-std=gnu99" |
| 679 | } |
| 680 | } |
| 681 | flag_set { |
| 682 | action: "c++-compile" |
| 683 | action: "c++-header-parsing" |
| 684 | action: "c++-header-preprocessing" |
| 685 | action: "c++-module-compile" |
| 686 | flag_group { |
| 687 | flag: "-std=gnu++1y" |
| 688 | } |
| 689 | } |
| 690 | flag_set { |
| 691 | action: "preprocess-assemble" |
| 692 | action: "assemble" |
| 693 | action: "c++-link" |
| 694 | action: "c++-compile" |
| 695 | action: "c++-header-parsing" |
| 696 | action: "c++-header-preprocessing" |
| 697 | action: "c++-module-compile" |
| 698 | action: "c-compile" |
| 699 | flag_group { |
| 700 | # We always want to compile with -pthread semantics. |
| 701 | flag: "-pthread" |
| 702 | } |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | # Anticipated future default. |
| 707 | # This makes GCC and Clang do what we want when called through symlinks. |
| 708 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 709 | linker_flag: "-no-canonical-prefixes" |
| 710 | |
| 711 | # Things that the code wants defined. |
| 712 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 713 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 714 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
| 715 | compiler_flag: "-D_FILE_OFFSET_BITS=64" |
| 716 | # TODO(Brian): Rename this or something. |
| 717 | compiler_flag: "-DAOS_ARCHITECTURE_armhf" |
| 718 | |
| 719 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 720 | # compiler symbols. |
| 721 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 722 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 723 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 724 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 725 | |
| 726 | # Security hardening on by default. |
| 727 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 728 | # We need to undef it before redefining it as some distributions now have |
| 729 | # it enabled by default. |
| 730 | compiler_flag: "-U_FORTIFY_SOURCE" |
| 731 | compiler_flag: "-fstack-protector" |
| 732 | compiler_flag: "-fPIE" |
| 733 | linker_flag: "-pie" |
| 734 | linker_flag: "-Wl,-z,relro,-z,now" |
| 735 | |
| 736 | # Pretty much everything needs this, including parts of the glibc STL... |
| 737 | linker_flag: "-lm" |
| 738 | |
| 739 | # Enable coloring even if there's no attached terminal. Bazel removes the |
| 740 | # escape sequences if --nocolor is specified. |
| 741 | compiler_flag: "-fdiagnostics-color=always" |
| 742 | |
| 743 | compiler_flag: "-Wall" |
| 744 | compiler_flag: "-Wextra" |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 745 | compiler_flag: "-Wpointer-arith" |
| 746 | compiler_flag: "-Wstrict-aliasing" |
| 747 | compiler_flag: "-Wcast-qual" |
| 748 | compiler_flag: "-Wcast-align" |
| 749 | compiler_flag: "-Wwrite-strings" |
| 750 | compiler_flag: "-Wtype-limits" |
| 751 | compiler_flag: "-Wsign-compare" |
| 752 | compiler_flag: "-Wformat=2" |
| 753 | compiler_flag: "-Werror" |
| 754 | compiler_flag: "-Wunused-local-typedefs" |
| 755 | |
| 756 | # Keep stack frames for debugging, even in opt mode. |
| 757 | compiler_flag: "-fno-omit-frame-pointer" |
| 758 | |
| 759 | # Don't use temp files while compiling. |
| 760 | compiler_flag: "-pipe" |
| 761 | |
| 762 | # Stamp the binary with a unique identifier. |
| 763 | linker_flag: "-Wl,--build-id=md5" |
| 764 | linker_flag: "-Wl,--hash-style=gnu" |
| 765 | #linker_flag: "-Wl,--warn-execstack" |
| 766 | #linker_flag: "-Wl,--detect-odr-violations" |
| 767 | |
| 768 | # Enable debug symbols. |
| 769 | compiler_flag: "-ggdb3" |
| 770 | |
| 771 | compilation_mode_flags { |
| 772 | mode: OPT |
| 773 | |
| 774 | compiler_flag: "-O2" |
| 775 | |
| 776 | # Disable assertions |
| 777 | compiler_flag: "-DNDEBUG" |
| 778 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 779 | |
| 780 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 781 | compiler_flag: "-ffunction-sections" |
| 782 | compiler_flag: "-fdata-sections" |
| 783 | linker_flag: "-Wl,--gc-sections" |
| 784 | } |
| 785 | } |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 786 | |
| 787 | toolchain { |
| 788 | abi_version: "cortex-m4f" |
| 789 | abi_libc_version: "cortex-m4f" |
| 790 | builtin_sysroot: "" |
| 791 | compiler: "gcc" |
| 792 | host_system_name: "local" |
| 793 | needsPic: false |
| 794 | supports_gold_linker: false |
| 795 | supports_incremental_linker: false |
| 796 | supports_fission: false |
| 797 | supports_interface_shared_objects: false |
| 798 | supports_normalizing_ar: false |
| 799 | supports_start_end_lib: false |
| 800 | supports_thin_archives: false |
| 801 | target_libc: "cortex-m4f" |
| 802 | target_cpu: "cortex-m4f" |
| 803 | target_system_name: "cortex-m4f" |
| 804 | toolchain_identifier: "cortex-m4f" |
| 805 | |
| 806 | tool_path { name: "ar" path: "/usr/bin/arm-none-eabi-ar" } |
| 807 | tool_path { name: "compat-ld" path: "/usr/bin/arm-none-eabi-ld" } |
| 808 | tool_path { name: "cpp" path: "/usr/bin/arm-none-eabi-cpp" } |
| 809 | tool_path { name: "dwp" path: "/usr/bin/arm-none-eabi-dwp" } |
| 810 | tool_path { name: "gcc" path: "/usr/bin/arm-none-eabi-gcc" } |
| 811 | tool_path { name: "gcov" path: "/usr/bin/arm-none-eabi-gcov" } |
| 812 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 813 | # to find libraries), but we provide LD so other rules can invoke the linker. |
| 814 | tool_path { name: "ld" path: "/usr/bin/arm-none-eabi-ld" } |
| 815 | tool_path { name: "nm" path: "/usr/bin/arm-none-eabi-nm" } |
| 816 | tool_path { name: "objcopy" path: "/usr/bin/arm-none-eabi-objcopy" } |
| 817 | objcopy_embed_flag: "-I" |
| 818 | objcopy_embed_flag: "binary" |
| 819 | tool_path { name: "objdump" path: "/usr/bin/arm-none-eabi-objdump" } |
| 820 | tool_path { name: "strip" path: "/usr/bin/arm-none-eabi-strip" } |
| 821 | linking_mode_flags { mode: FULLY_STATIC } |
| 822 | |
| 823 | # TODO(bazel-team): In theory, the path here ought to exactly match the path |
| 824 | # used by gcc. That works because bazel currently doesn't track files at |
| 825 | # absolute locations and has no remote execution, yet. However, this will need |
| 826 | # to be fixed, maybe with auto-detection? |
| 827 | cxx_builtin_include_directory: '/usr/lib/gcc/arm-none-eabi/4.8/include' |
| 828 | cxx_builtin_include_directory: '/usr/lib/gcc/arm-none-eabi/4.8/include-fixed' |
| 829 | cxx_builtin_include_directory: '/usr/lib/arm-none-eabi/include' |
| 830 | cxx_builtin_include_directory: '/usr/include/newlib', |
| 831 | |
| 832 | feature { |
| 833 | name: "dbg" |
| 834 | implies: "all_modes" |
| 835 | flag_set { |
| 836 | action: "preprocess-assemble" |
| 837 | action: "c-compile" |
| 838 | action: "c++-compile" |
| 839 | action: "c++-header-parsing" |
| 840 | action: "c++-header-preprocessing" |
| 841 | action: "c++-module-compile" |
| 842 | flag_group { |
| 843 | flag: "-fno-omit-frame-pointer" |
| 844 | } |
| 845 | } |
| 846 | } |
| 847 | |
| 848 | feature { |
| 849 | name: "opt" |
| 850 | implies: "all_modes" |
| 851 | } |
| 852 | feature { |
| 853 | name: "fastbuild" |
| 854 | implies: "all_modes" |
| 855 | } |
| 856 | |
| 857 | feature { |
| 858 | name: "all_modes" |
| 859 | flag_set { |
| 860 | action: "preprocess-assemble" |
| 861 | action: "assemble" |
| 862 | action: "c-compile" |
| 863 | flag_group { |
| 864 | flag: "--std=gnu99" |
| 865 | } |
| 866 | } |
| 867 | flag_set { |
| 868 | action: "c++-compile" |
| 869 | action: "c++-header-parsing" |
| 870 | action: "c++-header-preprocessing" |
| 871 | action: "c++-module-compile" |
| 872 | flag_group { |
| 873 | flag: "--std=gnu++11" |
| 874 | flag: "-fno-exceptions" |
| 875 | flag: "-fno-rtti" |
| 876 | } |
| 877 | } |
| 878 | } |
| 879 | |
| 880 | # Anticipated future default. |
| 881 | # This makes GCC and Clang do what we want when called through symlinks. |
| 882 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 883 | linker_flag: "-no-canonical-prefixes" |
| 884 | |
| 885 | # Things that the code wants defined. |
| 886 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 887 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 888 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
Brian Silverman | f91524f | 2017-09-23 13:15:55 -0400 | [diff] [blame] | 889 | |
| 890 | # Some identifiers for what MCU we're using. |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 891 | compiler_flag: "-D__MK64FX512__" |
| 892 | compiler_flag: "-DF_CPU=120000000" |
Brian Silverman | f91524f | 2017-09-23 13:15:55 -0400 | [diff] [blame] | 893 | |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 894 | compiler_flag: "-Wl,--gc-sections" |
| 895 | |
Brian Silverman | f91524f | 2017-09-23 13:15:55 -0400 | [diff] [blame] | 896 | # Newlib's stdint.h does this, but GCC's freestanding stdint.h doesn't use |
| 897 | # newlib's so we have to do it manually... |
| 898 | compiler_flag: "-D__have_long32" |
| 899 | |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 900 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 901 | # compiler symbols. |
| 902 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 903 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 904 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 905 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 906 | |
| 907 | # Security hardening on by default. |
| 908 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 909 | # We need to undef it before redefining it as some distributions now have |
| 910 | # it enabled by default. |
| 911 | compiler_flag: "-fstack-protector" |
| 912 | compiler_flag: "-mcpu=cortex-m4" |
| 913 | compiler_flag: "-mfpu=fpv4-sp-d16" |
| 914 | compiler_flag: "-mthumb" |
| 915 | compiler_flag: "-mfloat-abi=hard" |
| 916 | compiler_flag: "-fno-strict-aliasing" |
| 917 | linker_flag: "-mcpu=cortex-m4" |
| 918 | linker_flag: "-mfpu=fpv4-sp-d16" |
| 919 | linker_flag: "-mthumb" |
| 920 | linker_flag: "-mfloat-abi=hard" |
| 921 | linker_flag: "-fno-strict-aliasing" |
| 922 | linker_flag: "--specs=nano.specs" |
| 923 | |
| 924 | # Pretty much everything needs this, including parts of the glibc STL... |
| 925 | linker_flag: "-lgcc" |
| 926 | linker_flag: "-lstdc++" |
| 927 | linker_flag: "-lm" |
| 928 | linker_flag: "-lc" |
| 929 | linker_flag: "-Tmotors/core/mk64fx512.ld" |
| 930 | |
| 931 | compiler_flag: "-fmessage-length=80" |
Brian Silverman | f91524f | 2017-09-23 13:15:55 -0400 | [diff] [blame] | 932 | compiler_flag: "-fmax-errors=20" |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 933 | |
| 934 | compiler_flag: "-Wall" |
| 935 | compiler_flag: "-Wextra" |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 936 | compiler_flag: "-Wpointer-arith" |
| 937 | compiler_flag: "-Wcast-qual" |
| 938 | compiler_flag: "-Wwrite-strings" |
| 939 | compiler_flag: "-Wtype-limits" |
| 940 | compiler_flag: "-Wsign-compare" |
| 941 | compiler_flag: "-Wformat=2" |
| 942 | compiler_flag: "-Werror" |
| 943 | compiler_flag: "-Wstrict-aliasing=2" |
| 944 | |
| 945 | # Be annoying about using doubles places we probably didn't mean to, because |
| 946 | # the FPU only does single-precision. |
| 947 | compiler_flag: "-Wdouble-promotion" |
| 948 | |
| 949 | # Don't use temp files while compiling. |
| 950 | compiler_flag: "-pipe" |
| 951 | |
| 952 | # Stamp the binary with a unique identifier. |
| 953 | # TODO(austin): Put these back in. |
| 954 | #linker_flag: "-Wl,--build-id=md5" |
| 955 | #linker_flag: "-Wl,--hash-style=gnu" |
| 956 | |
| 957 | # Enable debug symbols. |
| 958 | compiler_flag: "-g" |
| 959 | |
Brian Silverman | f91524f | 2017-09-23 13:15:55 -0400 | [diff] [blame] | 960 | # Common symbols are weird and not what we want, so just give multiple |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 961 | # declaration errors instead. |
| 962 | compiler_flag: "-fno-common" |
| 963 | |
Brian Silverman | f91524f | 2017-09-23 13:15:55 -0400 | [diff] [blame] | 964 | # We're not a hosted environment (no file IO, main is called from our code, |
| 965 | # etc). |
| 966 | compiler_flag: "-ffreestanding" |
| 967 | # However, we still want to optimize things like memcpy. |
| 968 | compiler_flag: "-fbuiltin" |
| 969 | |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 970 | compilation_mode_flags { |
| 971 | mode: OPT |
| 972 | |
| 973 | # Freescale recommends this combination for reducing cycle count. |
| 974 | # http://www.nxp.com/assets/documents/data/en/application-notes/AN4808.pdf |
| 975 | compiler_flag: "-O2" |
| 976 | compiler_flag: "-finline-functions" |
| 977 | |
| 978 | # This is definitely worth it for us. It makes the FPU a lot more useful, |
| 979 | # especially with complex arithmetic, which matters a lot. |
| 980 | compiler_flag: "-ffast-math" |
| 981 | |
| 982 | # It seems like this is a good idea, at least for the number crunching code. |
| 983 | # Might want to look into moving it to copts on specific rules if the code |
| 984 | # size increase becomes a problem. |
| 985 | compiler_flag: "-funroll-loops" |
| 986 | |
| 987 | # Disable assertions |
| 988 | compiler_flag: "-DNDEBUG" |
| 989 | |
| 990 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 991 | compiler_flag: "-ffunction-sections" |
| 992 | #compiler_flag: "-fdata-sections" |
| 993 | linker_flag: "-Wl,--gc-sections" |
| 994 | } |
| 995 | |
| 996 | feature { |
| 997 | name: 'include_paths' |
| 998 | flag_set { |
| 999 | action: 'preprocess-assemble' |
| 1000 | action: 'c-compile' |
| 1001 | action: 'c++-compile' |
| 1002 | action: 'c++-header-parsing' |
| 1003 | action: 'c++-header-preprocessing' |
| 1004 | action: 'c++-module-compile' |
| 1005 | flag_group { |
Brian Silverman | f91524f | 2017-09-23 13:15:55 -0400 | [diff] [blame] | 1006 | iterate_over: 'quote_include_paths' |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 1007 | flag: '-iquote' |
| 1008 | flag: '%{quote_include_paths}' |
| 1009 | } |
| 1010 | flag_group { |
Brian Silverman | f91524f | 2017-09-23 13:15:55 -0400 | [diff] [blame] | 1011 | iterate_over: 'include_paths' |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 1012 | flag: '-I%{include_paths}' |
| 1013 | } |
| 1014 | flag_group { |
Brian Silverman | f91524f | 2017-09-23 13:15:55 -0400 | [diff] [blame] | 1015 | iterate_over: 'system_include_paths' |
Brian Silverman | 6260c09 | 2018-01-14 15:21:36 -0800 | [diff] [blame] | 1016 | flag: '-I' |
Brian Silverman | 8b63869 | 2017-06-26 23:10:26 -0700 | [diff] [blame] | 1017 | flag: '%{system_include_paths}' |
| 1018 | } |
| 1019 | } |
| 1020 | } |
| 1021 | } |