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 | |
| 25 | toolchain { |
| 26 | abi_version: "armeabi-v7a" |
| 27 | abi_libc_version: "armeabi-v7a" |
| 28 | builtin_sysroot: "" |
| 29 | compiler: "compiler" |
| 30 | host_system_name: "armeabi-v7a" |
| 31 | needsPic: true |
| 32 | supports_gold_linker: false |
| 33 | supports_incremental_linker: false |
| 34 | supports_fission: false |
| 35 | supports_interface_shared_objects: false |
| 36 | supports_normalizing_ar: false |
| 37 | supports_start_end_lib: false |
| 38 | supports_thin_archives: false |
| 39 | target_libc: "armeabi-v7a" |
| 40 | target_cpu: "armeabi-v7a" |
| 41 | target_system_name: "armeabi-v7a" |
| 42 | toolchain_identifier: "stub_armeabi-v7a" |
| 43 | |
| 44 | tool_path { name: "ar" path: "/bin/false" } |
| 45 | tool_path { name: "compat-ld" path: "/bin/false" } |
| 46 | tool_path { name: "cpp" path: "/bin/false" } |
| 47 | tool_path { name: "dwp" path: "/bin/false" } |
| 48 | tool_path { name: "gcc" path: "/bin/false" } |
| 49 | tool_path { name: "gcov" path: "/bin/false" } |
| 50 | tool_path { name: "ld" path: "/bin/false" } |
| 51 | |
| 52 | tool_path { name: "nm" path: "/bin/false" } |
| 53 | tool_path { name: "objcopy" path: "/bin/false" } |
| 54 | tool_path { name: "objdump" path: "/bin/false" } |
| 55 | tool_path { name: "strip" path: "/bin/false" } |
| 56 | } |
| 57 | |
| 58 | toolchain { |
| 59 | abi_version: "local" |
| 60 | abi_libc_version: "local" |
| 61 | builtin_sysroot: "" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 62 | compiler: "clang" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 63 | host_system_name: "local" |
| 64 | needsPic: true |
| 65 | supports_gold_linker: false |
| 66 | supports_incremental_linker: false |
| 67 | supports_fission: false |
| 68 | supports_interface_shared_objects: false |
| 69 | supports_normalizing_ar: false |
| 70 | supports_start_end_lib: false |
| 71 | supports_thin_archives: false |
| 72 | target_libc: "local" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 73 | target_cpu: "k8" |
| 74 | target_system_name: "k8" |
| 75 | toolchain_identifier: "k8_linux" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 76 | |
| 77 | tool_path { name: "ar" path: "/usr/bin/ar" } |
| 78 | tool_path { name: "compat-ld" path: "/usr/bin/ld" } |
| 79 | tool_path { name: "cpp" path: "/usr/bin/cpp" } |
| 80 | tool_path { name: "dwp" path: "/usr/bin/dwp" } |
| 81 | tool_path { name: "gcc" path: "/usr/bin/clang-3.6" } |
| 82 | tool_path { name: "gcov" path: "/usr/bin/gcov" } |
| 83 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 84 | # to find libraries), but we provide LD so other rules can invoke the linker. |
| 85 | tool_path { name: "ld" path: "/usr/bin/ld" } |
| 86 | tool_path { name: "nm" path: "/usr/bin/nm" } |
| 87 | tool_path { name: "objcopy" path: "/usr/bin/objcopy" } |
| 88 | objcopy_embed_flag: "-I" |
| 89 | objcopy_embed_flag: "binary" |
| 90 | tool_path { name: "objdump" path: "/usr/bin/objdump" } |
| 91 | tool_path { name: "strip" path: "/usr/bin/strip" } |
Brian Silverman | 6d35040 | 2016-03-05 01:15:46 -0500 | [diff] [blame] | 92 | linking_mode_flags { mode: DYNAMIC } |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 93 | |
| 94 | # TODO(bazel-team): In theory, the path here ought to exactly match the path |
| 95 | # used by gcc. That works because bazel currently doesn't track files at |
| 96 | # absolute locations and has no remote execution, yet. However, this will need |
| 97 | # to be fixed, maybe with auto-detection? |
Austin Schuh | 7b684d3 | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 98 | cxx_builtin_include_directory: '/usr/include/c++/4.9' |
| 99 | cxx_builtin_include_directory: '/usr/include/x86_64-linux-gnu/c++/4.9' |
| 100 | cxx_builtin_include_directory: '/usr/include/c++/4.9/backward' |
| 101 | cxx_builtin_include_directory: '/usr/local/include' |
| 102 | cxx_builtin_include_directory: '/usr/lib/llvm-3.6/lib/clang/3.6.2/include' |
| 103 | cxx_builtin_include_directory: '/usr/include/x86_64-linux-gnu' |
| 104 | cxx_builtin_include_directory: '/usr/include' |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 105 | cxx_builtin_include_directory: '/usr/lib/clang/3.6.2/include' |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 106 | |
| 107 | linker_flag: "-lstdc++" |
| 108 | linker_flag: "-B/usr/bin/" |
| 109 | |
| 110 | feature { |
| 111 | name: "opt" |
| 112 | implies: "all_modes" |
| 113 | flag_set { |
| 114 | action: "preprocess-assemble" |
| 115 | action: "c-compile" |
| 116 | action: "c++-compile" |
| 117 | action: "c++-header-parsing" |
| 118 | action: "c++-header-preprocessing" |
| 119 | action: "c++-module-compile" |
| 120 | flag_group { |
| 121 | flag: "-DAOS_DEBUG=0" |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | feature { |
| 127 | name: "dbg" |
| 128 | implies: "all_modes" |
| 129 | flag_set { |
| 130 | action: "preprocess-assemble" |
| 131 | action: "c-compile" |
| 132 | action: "c++-compile" |
| 133 | action: "c++-header-parsing" |
| 134 | action: "c++-header-preprocessing" |
| 135 | action: "c++-module-compile" |
| 136 | flag_group { |
| 137 | flag: "-DAOS_DEBUG=1" |
| 138 | } |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 139 | flag_group { |
| 140 | flag: "-fno-omit-frame-pointer" |
| 141 | } |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 142 | } |
| 143 | } |
| 144 | |
| 145 | feature { |
| 146 | name: "fastbuild" |
| 147 | implies: "all_modes" |
| 148 | flag_set { |
| 149 | action: "preprocess-assemble" |
| 150 | action: "c-compile" |
| 151 | action: "c++-compile" |
| 152 | action: "c++-header-parsing" |
| 153 | action: "c++-header-preprocessing" |
| 154 | action: "c++-module-compile" |
| 155 | flag_group { |
| 156 | flag: "-DAOS_DEBUG=0" |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | feature { |
| 162 | name: "all_modes" |
| 163 | flag_set { |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 164 | action: "preprocess-assemble" |
| 165 | action: "assemble" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 166 | action: "c-compile" |
| 167 | flag_group { |
| 168 | flag: "-std=gnu99" |
| 169 | } |
| 170 | } |
| 171 | flag_set { |
| 172 | action: "c++-compile" |
| 173 | action: "c++-header-parsing" |
| 174 | action: "c++-header-preprocessing" |
| 175 | action: "c++-module-compile" |
| 176 | flag_group { |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 177 | flag: "-std=gnu++1y" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 178 | } |
Brian Silverman | 23a1b34 | 2015-10-11 23:44:09 -0400 | [diff] [blame] | 179 | } |
| 180 | flag_set { |
| 181 | action: "preprocess-assemble" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 182 | action: "assemble" |
| 183 | action: "c++-link" |
Brian Silverman | 23a1b34 | 2015-10-11 23:44:09 -0400 | [diff] [blame] | 184 | action: "c++-compile" |
| 185 | action: "c++-header-parsing" |
| 186 | action: "c++-header-preprocessing" |
| 187 | action: "c++-module-compile" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 188 | action: "c-compile" |
Brian Silverman | 5dc0007 | 2015-10-12 00:38:14 -0400 | [diff] [blame] | 189 | flag_group { |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 190 | # We always want to compile with -pthread semantics. |
Brian Silverman | 5dc0007 | 2015-10-12 00:38:14 -0400 | [diff] [blame] | 191 | flag: "-pthread" |
| 192 | } |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 193 | } |
| 194 | } |
| 195 | |
| 196 | # Anticipated future default. |
| 197 | # This makes GCC and Clang do what we want when called through symlinks. |
| 198 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 199 | linker_flag: "-no-canonical-prefixes" |
| 200 | |
| 201 | # Things that the code wants defined. |
| 202 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 203 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 204 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
| 205 | compiler_flag: "-D_FILE_OFFSET_BITS=64" |
| 206 | # TODO(Brian): Rename this or something. |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 207 | compiler_flag: "-DAOS_ARCHITECTURE_arm_frc" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 208 | |
| 209 | linker_flag: "-fuse-ld=gold" |
| 210 | |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 211 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 212 | # compiler symbols. |
| 213 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 214 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 215 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 216 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 217 | |
| 218 | # Security hardening on by default. |
| 219 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 220 | # We need to undef it before redefining it as some distributions now have |
| 221 | # it enabled by default. |
| 222 | compiler_flag: "-U_FORTIFY_SOURCE" |
| 223 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 224 | compiler_flag: "-fstack-protector" |
| 225 | compiler_flag: "-fPIE" |
| 226 | linker_flag: "-pie" |
| 227 | linker_flag: "-Wl,-z,relro,-z,now" |
| 228 | |
| 229 | # Pretty much everything needs this, including parts of the glibc STL... |
| 230 | linker_flag: "-lm" |
| 231 | |
| 232 | # Enable coloring even if there's no attached terminal. Bazel removes the |
| 233 | # escape sequences if --nocolor is specified. |
| 234 | compiler_flag: "-fcolor-diagnostics" |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 235 | compiler_flag: "-fmessage-length=80" |
| 236 | compiler_flag: "-fmacro-backtrace-limit=0" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 237 | |
| 238 | compiler_flag: "-Wall" |
| 239 | compiler_flag: "-Wextra" |
| 240 | compiler_flag: "-Wswitch-enum" |
| 241 | compiler_flag: "-Wpointer-arith" |
Brian Silverman | 594be0d | 2015-10-31 17:56:23 -0400 | [diff] [blame] | 242 | compiler_flag: "-Wstrict-aliasing" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 243 | compiler_flag: "-Wcast-qual" |
| 244 | compiler_flag: "-Wcast-align" |
| 245 | compiler_flag: "-Wwrite-strings" |
| 246 | compiler_flag: "-Wtype-limits" |
| 247 | compiler_flag: "-Wsign-compare" |
| 248 | compiler_flag: "-Wformat=2" |
| 249 | compiler_flag: "-Werror" |
| 250 | |
| 251 | # Keep stack frames for debugging, even in opt mode. |
| 252 | compiler_flag: "-fno-omit-frame-pointer" |
| 253 | |
| 254 | # Don't use temp files while compiling. |
| 255 | compiler_flag: "-pipe" |
| 256 | |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 257 | # Stamp the binary with a unique identifier. |
| 258 | linker_flag: "-Wl,--build-id=md5" |
| 259 | linker_flag: "-Wl,--hash-style=gnu" |
| 260 | linker_flag: "-Wl,--warn-execstack" |
| 261 | linker_flag: "-Wl,--detect-odr-violations" |
| 262 | |
Brian Silverman | d254040 | 2015-11-28 18:35:00 -0500 | [diff] [blame] | 263 | # Enable debug symbols. |
| 264 | compiler_flag: "-ggdb3" |
| 265 | |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 266 | compilation_mode_flags { |
| 267 | mode: OPT |
| 268 | |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 269 | compiler_flag: "-O2" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 270 | |
| 271 | # Disable assertions |
| 272 | compiler_flag: "-DNDEBUG" |
| 273 | |
| 274 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 275 | compiler_flag: "-ffunction-sections" |
| 276 | compiler_flag: "-fdata-sections" |
| 277 | linker_flag: "-Wl,--gc-sections" |
| 278 | } |
| 279 | } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 280 | |
| 281 | toolchain { |
| 282 | abi_version: "roborio" |
| 283 | abi_libc_version: "roborio" |
| 284 | builtin_sysroot: "" |
| 285 | compiler: "gcc" |
| 286 | host_system_name: "roborio" |
| 287 | needsPic: true |
| 288 | supports_gold_linker: false |
| 289 | supports_incremental_linker: false |
| 290 | supports_fission: false |
| 291 | supports_interface_shared_objects: false |
| 292 | supports_normalizing_ar: false |
| 293 | supports_start_end_lib: false |
| 294 | supports_thin_archives: false |
| 295 | target_libc: "roborio" |
| 296 | target_cpu: "roborio" |
| 297 | target_system_name: "roborio" |
| 298 | toolchain_identifier: "roborio_linux" |
| 299 | |
Austin Schuh | 55139fe | 2015-10-14 23:55:24 -0700 | [diff] [blame] | 300 | tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" } |
| 301 | tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" } |
| 302 | tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" } |
| 303 | tool_path { name: "dwp" path: "/bin/false" } |
| 304 | tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" } |
| 305 | 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] | 306 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 307 | # 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] | 308 | tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" } |
| 309 | tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" } |
| 310 | 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] | 311 | objcopy_embed_flag: "-I" |
| 312 | objcopy_embed_flag: "binary" |
Austin Schuh | 55139fe | 2015-10-14 23:55:24 -0700 | [diff] [blame] | 313 | tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" } |
| 314 | 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] | 315 | linking_mode_flags { mode: DYNAMIC } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 316 | |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 317 | 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] | 318 | compiler_flag: "-nostdinc" |
| 319 | compiler_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 320 | 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] | 321 | compiler_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 322 | 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] | 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/arm-frc-linux-gnueabi/usr/include" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 325 | |
| 326 | cxx_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 327 | 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] | 328 | cxx_flag: "-isystem" |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 329 | 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] | 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/backward" |
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/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] | 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/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] | 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/arm-frc-linux-gnueabi/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/arm-frc-linux-gnueabi/usr/include" |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 340 | |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 341 | # TODO(bazel-team): In theory, the path here ought to exactly match the path |
| 342 | # used by gcc. That works because bazel currently doesn't track files at |
| 343 | # absolute locations and has no remote execution, yet. However, this will need |
| 344 | # to be fixed, maybe with auto-detection? |
Brian Silverman | 826e1cd | 2016-01-31 18:26:00 -0500 | [diff] [blame] | 345 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/4.9.3" |
| 346 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/4.9.3/arm-frc-linux-gnueabi" |
| 347 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%/c++/4.9.3/backward" |
| 348 | 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)%" |
| 349 | 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)%" |
| 350 | cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//usr/arm-frc-linux-gnueabi/include)%" |
| 351 | 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] | 352 | |
| 353 | linker_flag: "-lstdc++" |
| 354 | #linker_flag: "-B/usr/bin/" |
| 355 | |
| 356 | feature { |
| 357 | name: "opt" |
| 358 | implies: "all_modes" |
| 359 | flag_set { |
| 360 | action: "preprocess-assemble" |
| 361 | action: "c-compile" |
| 362 | action: "c++-compile" |
| 363 | action: "c++-header-parsing" |
| 364 | action: "c++-header-preprocessing" |
| 365 | action: "c++-module-compile" |
| 366 | flag_group { |
| 367 | flag: "-DAOS_DEBUG=0" |
| 368 | } |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | feature { |
| 373 | name: "dbg" |
| 374 | implies: "all_modes" |
| 375 | flag_set { |
| 376 | action: "preprocess-assemble" |
| 377 | action: "c-compile" |
| 378 | action: "c++-compile" |
| 379 | action: "c++-header-parsing" |
| 380 | action: "c++-header-preprocessing" |
| 381 | action: "c++-module-compile" |
| 382 | flag_group { |
| 383 | flag: "-DAOS_DEBUG=1" |
| 384 | } |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 385 | flag_group { |
| 386 | flag: "-fno-omit-frame-pointer" |
| 387 | } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 388 | } |
| 389 | } |
| 390 | |
| 391 | feature { |
| 392 | name: "fastbuild" |
| 393 | implies: "all_modes" |
| 394 | flag_set { |
| 395 | action: "preprocess-assemble" |
| 396 | action: "c-compile" |
| 397 | action: "c++-compile" |
| 398 | action: "c++-header-parsing" |
| 399 | action: "c++-header-preprocessing" |
| 400 | action: "c++-module-compile" |
| 401 | flag_group { |
| 402 | flag: "-DAOS_DEBUG=0" |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | feature { |
| 408 | name: "all_modes" |
| 409 | flag_set { |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 410 | action: "preprocess-assemble" |
| 411 | action: "assemble" |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 412 | action: "c-compile" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 413 | flag_group { |
| 414 | flag: "-std=gnu99" |
| 415 | } |
| 416 | } |
| 417 | flag_set { |
| 418 | action: "c++-compile" |
| 419 | action: "c++-header-parsing" |
| 420 | action: "c++-header-preprocessing" |
| 421 | action: "c++-module-compile" |
| 422 | flag_group { |
| 423 | flag: "-std=gnu++1y" |
| 424 | } |
| 425 | } |
| 426 | flag_set { |
| 427 | action: "preprocess-assemble" |
| 428 | action: "assemble" |
| 429 | action: "c++-link" |
| 430 | action: "c++-compile" |
| 431 | action: "c++-header-parsing" |
| 432 | action: "c++-header-preprocessing" |
| 433 | action: "c++-module-compile" |
| 434 | action: "c-compile" |
| 435 | flag_group { |
| 436 | # We always want to compile with -pthread semantics. |
| 437 | flag: "-pthread" |
| 438 | } |
| 439 | } |
| 440 | } |
| 441 | |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 442 | compiler_flag: "-mfpu=neon" |
| 443 | # TODO(brians): See if it will run with this enabled. |
| 444 | #compiler_flag: "-mhwdiv=arm,thumb" |
| 445 | |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 446 | # Anticipated future default. |
| 447 | # This makes GCC and Clang do what we want when called through symlinks. |
| 448 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 449 | linker_flag: "-no-canonical-prefixes" |
| 450 | |
| 451 | # Things that the code wants defined. |
| 452 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 453 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 454 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
| 455 | compiler_flag: "-D_FILE_OFFSET_BITS=64" |
| 456 | # TODO(Brian): Rename this or something. |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 457 | compiler_flag: "-DAOS_ARCHITECTURE_arm_frc" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 458 | |
| 459 | #linker_flag: "-fuse-ld=gold" |
| 460 | |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 461 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 462 | # compiler symbols. |
| 463 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 464 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 465 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 466 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 467 | |
| 468 | # Security hardening on by default. |
| 469 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 470 | # We need to undef it before redefining it as some distributions now have |
| 471 | # it enabled by default. |
| 472 | compiler_flag: "-U_FORTIFY_SOURCE" |
| 473 | compiler_flag: "-fstack-protector" |
| 474 | compiler_flag: "-fPIE" |
| 475 | linker_flag: "-pie" |
| 476 | linker_flag: "-Wl,-z,relro,-z,now" |
| 477 | |
| 478 | # Pretty much everything needs this, including parts of the glibc STL... |
| 479 | linker_flag: "-lm" |
| 480 | |
| 481 | # Enable coloring even if there's no attached terminal. Bazel removes the |
| 482 | # escape sequences if --nocolor is specified. |
| 483 | compiler_flag: "-fdiagnostics-color=always" |
| 484 | |
| 485 | compiler_flag: "-Wall" |
| 486 | compiler_flag: "-Wextra" |
| 487 | compiler_flag: "-Wswitch-enum" |
| 488 | compiler_flag: "-Wpointer-arith" |
Brian Silverman | 594be0d | 2015-10-31 17:56:23 -0400 | [diff] [blame] | 489 | compiler_flag: "-Wstrict-aliasing" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 490 | compiler_flag: "-Wcast-qual" |
| 491 | compiler_flag: "-Wcast-align" |
| 492 | compiler_flag: "-Wwrite-strings" |
| 493 | compiler_flag: "-Wtype-limits" |
| 494 | compiler_flag: "-Wsign-compare" |
| 495 | compiler_flag: "-Wformat=2" |
| 496 | compiler_flag: "-Werror" |
Brian Silverman | a4a4ea6 | 2015-11-27 10:27:53 -0500 | [diff] [blame] | 497 | compiler_flag: "-Wunused-local-typedefs" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 498 | |
| 499 | # Keep stack frames for debugging, even in opt mode. |
| 500 | compiler_flag: "-fno-omit-frame-pointer" |
| 501 | compiler_flag: "-D__has_feature(x)=0" |
| 502 | |
| 503 | # Don't use temp files while compiling. |
| 504 | compiler_flag: "-pipe" |
| 505 | |
| 506 | # Have GCC return the exit code from ld. |
| 507 | linker_flag: "-pass-exit-codes" |
| 508 | |
| 509 | # Stamp the binary with a unique identifier. |
| 510 | linker_flag: "-Wl,--build-id=md5" |
| 511 | linker_flag: "-Wl,--hash-style=gnu" |
| 512 | #linker_flag: "-Wl,--warn-execstack" |
| 513 | #linker_flag: "-Wl,--detect-odr-violations" |
| 514 | |
Brian Silverman | d254040 | 2015-11-28 18:35:00 -0500 | [diff] [blame] | 515 | # Enable debug symbols. |
| 516 | compiler_flag: "-ggdb3" |
| 517 | |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 518 | compilation_mode_flags { |
| 519 | mode: OPT |
| 520 | |
Brian Silverman | 594be0d | 2015-10-31 17:56:23 -0400 | [diff] [blame] | 521 | compiler_flag: "-O2" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 522 | |
| 523 | # Disable assertions |
| 524 | compiler_flag: "-DNDEBUG" |
| 525 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 526 | |
| 527 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 528 | compiler_flag: "-ffunction-sections" |
| 529 | compiler_flag: "-fdata-sections" |
| 530 | linker_flag: "-Wl,--gc-sections" |
| 531 | } |
| 532 | } |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 533 | |
| 534 | toolchain { |
| 535 | abi_version: "clang_3.6" |
| 536 | abi_libc_version: "glibc_2.19" |
| 537 | builtin_sysroot: "" |
| 538 | compiler: "clang" |
| 539 | host_system_name: "roborio" |
| 540 | needsPic: true |
| 541 | supports_gold_linker: false |
| 542 | supports_incremental_linker: false |
| 543 | supports_fission: false |
| 544 | supports_interface_shared_objects: false |
| 545 | supports_normalizing_ar: true |
| 546 | supports_start_end_lib: false |
| 547 | supports_thin_archives: true |
| 548 | target_libc: "glibc_2.19" |
| 549 | target_cpu: "armhf-debian" |
| 550 | target_system_name: "arm_a15" |
| 551 | toolchain_identifier: "clang_linux_armhf" |
| 552 | |
| 553 | tool_path { name: "ar" path: "linaro_linux_gcc/arm-linux-gnueabihf-ar" } |
| 554 | tool_path { name: "compat-ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" } |
| 555 | tool_path { name: "cpp" path: "linaro_linux_gcc/clang_bin/clang" } |
| 556 | tool_path { name: "dwp" path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp" } |
| 557 | tool_path { name: "gcc" path: "linaro_linux_gcc/clang_bin/clang" } |
| 558 | tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" } |
| 559 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 560 | # to find libraries), but we provide LD so other rules can invoke the linker. |
| 561 | tool_path { name: "ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" } |
| 562 | tool_path { name: "nm" path: "linaro_linux_gcc/arm-linux-gnueabihf-nm" } |
| 563 | tool_path { name: "objcopy" path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy" } |
| 564 | objcopy_embed_flag: "-I" |
| 565 | objcopy_embed_flag: "binary" |
| 566 | tool_path { name: "objdump" path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump" } |
| 567 | tool_path { name: "strip" path: "linaro_linux_gcc/arm-linux-gnueabihf-strip" } |
Brian Silverman | 6d35040 | 2016-03-05 01:15:46 -0500 | [diff] [blame] | 568 | linking_mode_flags { mode: DYNAMIC } |
Brian Silverman | 0d57fc8 | 2016-01-24 21:02:53 -0500 | [diff] [blame] | 569 | |
| 570 | compiler_flag: "-target" |
| 571 | compiler_flag: "armv7a-arm-linux-gnueabif" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 572 | 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] | 573 | compiler_flag: "-mfloat-abi=hard" |
| 574 | compiler_flag: "-mfpu=vfpv3-d16" |
| 575 | |
| 576 | compiler_flag: "-nostdinc" |
| 577 | compiler_flag: "-isystem" |
| 578 | compiler_flag: "/usr/lib/clang/3.6/include" |
| 579 | compiler_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 580 | 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] | 581 | compiler_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 582 | 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] | 583 | compiler_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 584 | 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] | 585 | cxx_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 586 | 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] | 587 | cxx_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 588 | 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] | 589 | cxx_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 590 | 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] | 591 | cxx_flag: "-isystem" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 592 | 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] | 593 | |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 594 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//include)%" |
| 595 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/usr/include)%" |
| 596 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/usr/lib/include)%" |
| 597 | 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)%" |
| 598 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//include)%/c++/4.9.3" |
| 599 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//arm-linux-gnueabihf/libc/lib/gcc/arm-linux-gnueabihf/4.9.3/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//lib/gcc/arm-linux-gnueabihf/4.9.3/include)%" |
| 602 | cxx_builtin_include_directory: "%package(@linaro_linux_gcc_4_9_repo//lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed)%" |
| 603 | 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] | 604 | cxx_builtin_include_directory: '/usr/lib/clang/3.6/include' |
| 605 | |
| 606 | linker_flag: "-target" |
| 607 | linker_flag: "armv7a-arm-linux-gnueabif" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 608 | 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] | 609 | linker_flag: "-lstdc++" |
| 610 | linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs" |
Austin Schuh | 6166083 | 2016-03-04 21:56:39 -0800 | [diff] [blame] | 611 | linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/lib" |
| 612 | linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/lib" |
| 613 | linker_flag: "-Lexternal/linaro_linux_gcc_4_9_repo/arm-linux-gnueabihf/libc/usr/lib" |
| 614 | 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] | 615 | linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3" |
| 616 | |
| 617 | feature { |
| 618 | name: "opt" |
| 619 | implies: "all_modes" |
| 620 | flag_set { |
| 621 | action: "preprocess-assemble" |
| 622 | action: "c-compile" |
| 623 | action: "c++-compile" |
| 624 | action: "c++-header-parsing" |
| 625 | action: "c++-header-preprocessing" |
| 626 | action: "c++-module-compile" |
| 627 | flag_group { |
| 628 | flag: "-DAOS_DEBUG=0" |
| 629 | } |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | feature { |
| 634 | name: "dbg" |
| 635 | implies: "all_modes" |
| 636 | flag_set { |
| 637 | action: "preprocess-assemble" |
| 638 | action: "c-compile" |
| 639 | action: "c++-compile" |
| 640 | action: "c++-header-parsing" |
| 641 | action: "c++-header-preprocessing" |
| 642 | action: "c++-module-compile" |
| 643 | flag_group { |
| 644 | flag: "-DAOS_DEBUG=1" |
| 645 | } |
| 646 | flag_group { |
| 647 | flag: "-fno-omit-frame-pointer" |
| 648 | } |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | feature { |
| 653 | name: "fastbuild" |
| 654 | implies: "all_modes" |
| 655 | flag_set { |
| 656 | action: "preprocess-assemble" |
| 657 | action: "c-compile" |
| 658 | action: "c++-compile" |
| 659 | action: "c++-header-parsing" |
| 660 | action: "c++-header-preprocessing" |
| 661 | action: "c++-module-compile" |
| 662 | flag_group { |
| 663 | flag: "-DAOS_DEBUG=0" |
| 664 | } |
| 665 | } |
| 666 | } |
| 667 | |
| 668 | feature { |
| 669 | name: "all_modes" |
| 670 | flag_set { |
| 671 | action: "preprocess-assemble" |
| 672 | action: "assemble" |
| 673 | action: "c-compile" |
| 674 | flag_group { |
| 675 | flag: "-std=gnu99" |
| 676 | } |
| 677 | } |
| 678 | flag_set { |
| 679 | action: "c++-compile" |
| 680 | action: "c++-header-parsing" |
| 681 | action: "c++-header-preprocessing" |
| 682 | action: "c++-module-compile" |
| 683 | flag_group { |
| 684 | flag: "-std=gnu++1y" |
| 685 | } |
| 686 | } |
| 687 | flag_set { |
| 688 | action: "preprocess-assemble" |
| 689 | action: "assemble" |
| 690 | action: "c++-link" |
| 691 | action: "c++-compile" |
| 692 | action: "c++-header-parsing" |
| 693 | action: "c++-header-preprocessing" |
| 694 | action: "c++-module-compile" |
| 695 | action: "c-compile" |
| 696 | flag_group { |
| 697 | # We always want to compile with -pthread semantics. |
| 698 | flag: "-pthread" |
| 699 | } |
| 700 | } |
| 701 | } |
| 702 | |
| 703 | # Anticipated future default. |
| 704 | # This makes GCC and Clang do what we want when called through symlinks. |
| 705 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 706 | linker_flag: "-no-canonical-prefixes" |
| 707 | |
| 708 | # Things that the code wants defined. |
| 709 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 710 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 711 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
| 712 | compiler_flag: "-D_FILE_OFFSET_BITS=64" |
| 713 | # TODO(Brian): Rename this or something. |
| 714 | compiler_flag: "-DAOS_ARCHITECTURE_armhf" |
| 715 | |
| 716 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 717 | # compiler symbols. |
| 718 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 719 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 720 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 721 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 722 | |
| 723 | # Security hardening on by default. |
| 724 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 725 | # We need to undef it before redefining it as some distributions now have |
| 726 | # it enabled by default. |
| 727 | compiler_flag: "-U_FORTIFY_SOURCE" |
| 728 | compiler_flag: "-fstack-protector" |
| 729 | compiler_flag: "-fPIE" |
| 730 | linker_flag: "-pie" |
| 731 | linker_flag: "-Wl,-z,relro,-z,now" |
| 732 | |
| 733 | # Pretty much everything needs this, including parts of the glibc STL... |
| 734 | linker_flag: "-lm" |
| 735 | |
| 736 | # Enable coloring even if there's no attached terminal. Bazel removes the |
| 737 | # escape sequences if --nocolor is specified. |
| 738 | compiler_flag: "-fdiagnostics-color=always" |
| 739 | |
| 740 | compiler_flag: "-Wall" |
| 741 | compiler_flag: "-Wextra" |
| 742 | compiler_flag: "-Wswitch-enum" |
| 743 | compiler_flag: "-Wpointer-arith" |
| 744 | compiler_flag: "-Wstrict-aliasing" |
| 745 | compiler_flag: "-Wcast-qual" |
| 746 | compiler_flag: "-Wcast-align" |
| 747 | compiler_flag: "-Wwrite-strings" |
| 748 | compiler_flag: "-Wtype-limits" |
| 749 | compiler_flag: "-Wsign-compare" |
| 750 | compiler_flag: "-Wformat=2" |
| 751 | compiler_flag: "-Werror" |
| 752 | compiler_flag: "-Wunused-local-typedefs" |
| 753 | |
| 754 | # Keep stack frames for debugging, even in opt mode. |
| 755 | compiler_flag: "-fno-omit-frame-pointer" |
| 756 | |
| 757 | # Don't use temp files while compiling. |
| 758 | compiler_flag: "-pipe" |
| 759 | |
| 760 | # Stamp the binary with a unique identifier. |
| 761 | linker_flag: "-Wl,--build-id=md5" |
| 762 | linker_flag: "-Wl,--hash-style=gnu" |
| 763 | #linker_flag: "-Wl,--warn-execstack" |
| 764 | #linker_flag: "-Wl,--detect-odr-violations" |
| 765 | |
| 766 | # Enable debug symbols. |
| 767 | compiler_flag: "-ggdb3" |
| 768 | |
| 769 | compilation_mode_flags { |
| 770 | mode: OPT |
| 771 | |
| 772 | compiler_flag: "-O2" |
| 773 | |
| 774 | # Disable assertions |
| 775 | compiler_flag: "-DNDEBUG" |
| 776 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 777 | |
| 778 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 779 | compiler_flag: "-ffunction-sections" |
| 780 | compiler_flag: "-fdata-sections" |
| 781 | linker_flag: "-Wl,--gc-sections" |
| 782 | } |
| 783 | } |