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 | |
| 20 | |
| 21 | toolchain { |
| 22 | abi_version: "armeabi-v7a" |
| 23 | abi_libc_version: "armeabi-v7a" |
| 24 | builtin_sysroot: "" |
| 25 | compiler: "compiler" |
| 26 | host_system_name: "armeabi-v7a" |
| 27 | needsPic: true |
| 28 | supports_gold_linker: false |
| 29 | supports_incremental_linker: false |
| 30 | supports_fission: false |
| 31 | supports_interface_shared_objects: false |
| 32 | supports_normalizing_ar: false |
| 33 | supports_start_end_lib: false |
| 34 | supports_thin_archives: false |
| 35 | target_libc: "armeabi-v7a" |
| 36 | target_cpu: "armeabi-v7a" |
| 37 | target_system_name: "armeabi-v7a" |
| 38 | toolchain_identifier: "stub_armeabi-v7a" |
| 39 | |
| 40 | tool_path { name: "ar" path: "/bin/false" } |
| 41 | tool_path { name: "compat-ld" path: "/bin/false" } |
| 42 | tool_path { name: "cpp" path: "/bin/false" } |
| 43 | tool_path { name: "dwp" path: "/bin/false" } |
| 44 | tool_path { name: "gcc" path: "/bin/false" } |
| 45 | tool_path { name: "gcov" path: "/bin/false" } |
| 46 | tool_path { name: "ld" path: "/bin/false" } |
| 47 | |
| 48 | tool_path { name: "nm" path: "/bin/false" } |
| 49 | tool_path { name: "objcopy" path: "/bin/false" } |
| 50 | tool_path { name: "objdump" path: "/bin/false" } |
| 51 | tool_path { name: "strip" path: "/bin/false" } |
| 52 | } |
| 53 | |
| 54 | toolchain { |
| 55 | abi_version: "local" |
| 56 | abi_libc_version: "local" |
| 57 | builtin_sysroot: "" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 58 | compiler: "clang" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 59 | host_system_name: "local" |
| 60 | needsPic: true |
| 61 | supports_gold_linker: false |
| 62 | supports_incremental_linker: false |
| 63 | supports_fission: false |
| 64 | supports_interface_shared_objects: false |
| 65 | supports_normalizing_ar: false |
| 66 | supports_start_end_lib: false |
| 67 | supports_thin_archives: false |
| 68 | target_libc: "local" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 69 | target_cpu: "k8" |
| 70 | target_system_name: "k8" |
| 71 | toolchain_identifier: "k8_linux" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 72 | |
| 73 | tool_path { name: "ar" path: "/usr/bin/ar" } |
| 74 | tool_path { name: "compat-ld" path: "/usr/bin/ld" } |
| 75 | tool_path { name: "cpp" path: "/usr/bin/cpp" } |
| 76 | tool_path { name: "dwp" path: "/usr/bin/dwp" } |
| 77 | tool_path { name: "gcc" path: "/usr/bin/clang-3.6" } |
| 78 | tool_path { name: "gcov" path: "/usr/bin/gcov" } |
| 79 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 80 | # to find libraries), but we provide LD so other rules can invoke the linker. |
| 81 | tool_path { name: "ld" path: "/usr/bin/ld" } |
| 82 | tool_path { name: "nm" path: "/usr/bin/nm" } |
| 83 | tool_path { name: "objcopy" path: "/usr/bin/objcopy" } |
| 84 | objcopy_embed_flag: "-I" |
| 85 | objcopy_embed_flag: "binary" |
| 86 | tool_path { name: "objdump" path: "/usr/bin/objdump" } |
| 87 | tool_path { name: "strip" path: "/usr/bin/strip" } |
| 88 | |
| 89 | # TODO(bazel-team): In theory, the path here ought to exactly match the path |
| 90 | # used by gcc. That works because bazel currently doesn't track files at |
| 91 | # absolute locations and has no remote execution, yet. However, this will need |
| 92 | # to be fixed, maybe with auto-detection? |
Austin Schuh | 7b684d3 | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 93 | cxx_builtin_include_directory: '/usr/include/c++/4.9' |
| 94 | cxx_builtin_include_directory: '/usr/include/x86_64-linux-gnu/c++/4.9' |
| 95 | cxx_builtin_include_directory: '/usr/include/c++/4.9/backward' |
| 96 | cxx_builtin_include_directory: '/usr/local/include' |
| 97 | cxx_builtin_include_directory: '/usr/lib/llvm-3.6/lib/clang/3.6.2/include' |
| 98 | cxx_builtin_include_directory: '/usr/include/x86_64-linux-gnu' |
| 99 | cxx_builtin_include_directory: '/usr/include' |
| 100 | cxx_builtin_include_directory: '/usr/lib/clang/3.6.2/include/' |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 101 | |
| 102 | linker_flag: "-lstdc++" |
| 103 | linker_flag: "-B/usr/bin/" |
| 104 | |
| 105 | feature { |
| 106 | name: "opt" |
| 107 | implies: "all_modes" |
| 108 | flag_set { |
| 109 | action: "preprocess-assemble" |
| 110 | action: "c-compile" |
| 111 | action: "c++-compile" |
| 112 | action: "c++-header-parsing" |
| 113 | action: "c++-header-preprocessing" |
| 114 | action: "c++-module-compile" |
| 115 | flag_group { |
| 116 | flag: "-DAOS_DEBUG=0" |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | feature { |
| 122 | name: "dbg" |
| 123 | implies: "all_modes" |
| 124 | flag_set { |
| 125 | action: "preprocess-assemble" |
| 126 | action: "c-compile" |
| 127 | action: "c++-compile" |
| 128 | action: "c++-header-parsing" |
| 129 | action: "c++-header-preprocessing" |
| 130 | action: "c++-module-compile" |
| 131 | flag_group { |
| 132 | flag: "-DAOS_DEBUG=1" |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | feature { |
| 138 | name: "fastbuild" |
| 139 | implies: "all_modes" |
| 140 | flag_set { |
| 141 | action: "preprocess-assemble" |
| 142 | action: "c-compile" |
| 143 | action: "c++-compile" |
| 144 | action: "c++-header-parsing" |
| 145 | action: "c++-header-preprocessing" |
| 146 | action: "c++-module-compile" |
| 147 | flag_group { |
| 148 | flag: "-DAOS_DEBUG=0" |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | feature { |
| 154 | name: "all_modes" |
| 155 | flag_set { |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 156 | action: "preprocess-assemble" |
| 157 | action: "assemble" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 158 | action: "c-compile" |
| 159 | flag_group { |
| 160 | flag: "-std=gnu99" |
| 161 | } |
| 162 | } |
| 163 | flag_set { |
| 164 | action: "c++-compile" |
| 165 | action: "c++-header-parsing" |
| 166 | action: "c++-header-preprocessing" |
| 167 | action: "c++-module-compile" |
| 168 | flag_group { |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 169 | flag: "-std=gnu++1y" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 170 | } |
Brian Silverman | 23a1b34 | 2015-10-11 23:44:09 -0400 | [diff] [blame] | 171 | } |
| 172 | flag_set { |
| 173 | action: "preprocess-assemble" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 174 | action: "assemble" |
| 175 | action: "c++-link" |
Brian Silverman | 23a1b34 | 2015-10-11 23:44:09 -0400 | [diff] [blame] | 176 | action: "c++-compile" |
| 177 | action: "c++-header-parsing" |
| 178 | action: "c++-header-preprocessing" |
| 179 | action: "c++-module-compile" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 180 | action: "c-compile" |
Brian Silverman | 5dc0007 | 2015-10-12 00:38:14 -0400 | [diff] [blame] | 181 | flag_group { |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 182 | # We always want to compile with -pthread semantics. |
Brian Silverman | 5dc0007 | 2015-10-12 00:38:14 -0400 | [diff] [blame] | 183 | flag: "-pthread" |
| 184 | } |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 185 | } |
| 186 | } |
| 187 | |
| 188 | # Anticipated future default. |
| 189 | # This makes GCC and Clang do what we want when called through symlinks. |
| 190 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 191 | linker_flag: "-no-canonical-prefixes" |
| 192 | |
| 193 | # Things that the code wants defined. |
| 194 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 195 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 196 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
| 197 | compiler_flag: "-D_FILE_OFFSET_BITS=64" |
| 198 | # TODO(Brian): Rename this or something. |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 199 | compiler_flag: "-DAOS_ARCHITECTURE_arm_frc" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 200 | |
| 201 | linker_flag: "-fuse-ld=gold" |
| 202 | |
| 203 | # Temporary escape hatch for the Gyp->Bazel conversion. |
| 204 | # TODO(Brian): Remove this. |
| 205 | compiler_flag: "-DAOS_BAZEL" |
| 206 | |
| 207 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 208 | # compiler symbols. |
| 209 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 210 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 211 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 212 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 213 | |
| 214 | # Security hardening on by default. |
| 215 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 216 | # We need to undef it before redefining it as some distributions now have |
| 217 | # it enabled by default. |
| 218 | compiler_flag: "-U_FORTIFY_SOURCE" |
| 219 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 220 | compiler_flag: "-fstack-protector" |
| 221 | compiler_flag: "-fPIE" |
| 222 | linker_flag: "-pie" |
| 223 | linker_flag: "-Wl,-z,relro,-z,now" |
| 224 | |
| 225 | # Pretty much everything needs this, including parts of the glibc STL... |
| 226 | linker_flag: "-lm" |
| 227 | |
| 228 | # Enable coloring even if there's no attached terminal. Bazel removes the |
| 229 | # escape sequences if --nocolor is specified. |
| 230 | compiler_flag: "-fcolor-diagnostics" |
| 231 | |
| 232 | compiler_flag: "-Wall" |
| 233 | compiler_flag: "-Wextra" |
| 234 | compiler_flag: "-Wswitch-enum" |
| 235 | compiler_flag: "-Wpointer-arith" |
Brian Silverman | 594be0d | 2015-10-31 17:56:23 -0400 | [diff] [blame] | 236 | compiler_flag: "-Wstrict-aliasing" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 237 | compiler_flag: "-Wcast-qual" |
| 238 | compiler_flag: "-Wcast-align" |
| 239 | compiler_flag: "-Wwrite-strings" |
| 240 | compiler_flag: "-Wtype-limits" |
| 241 | compiler_flag: "-Wsign-compare" |
| 242 | compiler_flag: "-Wformat=2" |
| 243 | compiler_flag: "-Werror" |
| 244 | |
| 245 | # Keep stack frames for debugging, even in opt mode. |
| 246 | compiler_flag: "-fno-omit-frame-pointer" |
| 247 | |
| 248 | # Don't use temp files while compiling. |
| 249 | compiler_flag: "-pipe" |
| 250 | |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 251 | # Stamp the binary with a unique identifier. |
| 252 | linker_flag: "-Wl,--build-id=md5" |
| 253 | linker_flag: "-Wl,--hash-style=gnu" |
| 254 | linker_flag: "-Wl,--warn-execstack" |
| 255 | linker_flag: "-Wl,--detect-odr-violations" |
| 256 | |
| 257 | compilation_mode_flags { |
| 258 | mode: DBG |
| 259 | # Enable debug symbols. |
| 260 | compiler_flag: "-ggdb3" |
| 261 | } |
| 262 | compilation_mode_flags { |
| 263 | mode: OPT |
| 264 | |
| 265 | # No debug symbols. |
| 266 | # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or |
| 267 | # even generally? However, that can't happen here, as it requires special |
| 268 | # handling in Bazel. |
| 269 | compiler_flag: "-g0" |
| 270 | |
Austin Schuh | a20ae72 | 2015-11-01 12:29:38 -0800 | [diff] [blame] | 271 | compiler_flag: "-O2" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 272 | |
| 273 | # Disable assertions |
| 274 | compiler_flag: "-DNDEBUG" |
| 275 | |
| 276 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 277 | compiler_flag: "-ffunction-sections" |
| 278 | compiler_flag: "-fdata-sections" |
| 279 | linker_flag: "-Wl,--gc-sections" |
| 280 | } |
| 281 | } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 282 | |
| 283 | toolchain { |
| 284 | abi_version: "roborio" |
| 285 | abi_libc_version: "roborio" |
| 286 | builtin_sysroot: "" |
| 287 | compiler: "gcc" |
| 288 | host_system_name: "roborio" |
| 289 | needsPic: true |
| 290 | supports_gold_linker: false |
| 291 | supports_incremental_linker: false |
| 292 | supports_fission: false |
| 293 | supports_interface_shared_objects: false |
| 294 | supports_normalizing_ar: false |
| 295 | supports_start_end_lib: false |
| 296 | supports_thin_archives: false |
| 297 | target_libc: "roborio" |
| 298 | target_cpu: "roborio" |
| 299 | target_system_name: "roborio" |
| 300 | toolchain_identifier: "roborio_linux" |
| 301 | |
Austin Schuh | 55139fe | 2015-10-14 23:55:24 -0700 | [diff] [blame] | 302 | tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" } |
| 303 | tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" } |
| 304 | tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" } |
| 305 | tool_path { name: "dwp" path: "/bin/false" } |
| 306 | tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" } |
| 307 | 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] | 308 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 309 | # 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] | 310 | tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" } |
| 311 | tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" } |
| 312 | 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] | 313 | objcopy_embed_flag: "-I" |
| 314 | objcopy_embed_flag: "binary" |
Austin Schuh | 55139fe | 2015-10-14 23:55:24 -0700 | [diff] [blame] | 315 | tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" } |
| 316 | tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 317 | |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 318 | compiler_flag: "--sysroot=external/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi" |
| 319 | compiler_flag: "-nostdinc" |
| 320 | compiler_flag: "-isystem" |
| 321 | compiler_flag: "tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include", |
| 322 | compiler_flag: "-isystem" |
| 323 | compiler_flag: "tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include-fixed" |
| 324 | compiler_flag: "-isystem" |
| 325 | compiler_flag: "tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/usr/include" |
| 326 | |
| 327 | cxx_flag: "-isystem" |
| 328 | cxx_flag: "tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3" |
| 329 | cxx_flag: "-isystem" |
| 330 | cxx_flag: "tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3/arm-frc-linux-gnueabi" |
| 331 | cxx_flag: "-isystem" |
| 332 | cxx_flag: "tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3/backward" |
| 333 | cxx_flag: "-isystem" |
| 334 | cxx_flag: "tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include" |
| 335 | cxx_flag: "-isystem" |
| 336 | cxx_flag: "tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include-fixed" |
| 337 | cxx_flag: "-isystem" |
| 338 | cxx_flag: "tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/include" |
| 339 | cxx_flag: "-isystem" |
| 340 | cxx_flag: "tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/usr/include" |
| 341 | |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 342 | # TODO(bazel-team): In theory, the path here ought to exactly match the path |
| 343 | # used by gcc. That works because bazel currently doesn't track files at |
| 344 | # absolute locations and has no remote execution, yet. However, this will need |
| 345 | # to be fixed, maybe with auto-detection? |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 346 | cxx_builtin_include_directory: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3" |
| 347 | cxx_builtin_include_directory: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3/arm-frc-linux-gnueabi" |
| 348 | cxx_builtin_include_directory: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/include/c++/4.9.3/backward" |
| 349 | cxx_builtin_include_directory: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include" |
| 350 | cxx_builtin_include_directory: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/lib/x86_64-linux-gnu/gcc/arm-frc-linux-gnueabi/4.9.3/include-fixed" |
| 351 | cxx_builtin_include_directory: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/include" |
| 352 | cxx_builtin_include_directory: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo/usr/arm-frc-linux-gnueabi/usr/include" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 353 | |
| 354 | linker_flag: "-lstdc++" |
| 355 | #linker_flag: "-B/usr/bin/" |
| 356 | |
| 357 | feature { |
| 358 | name: "opt" |
| 359 | implies: "all_modes" |
| 360 | flag_set { |
| 361 | action: "preprocess-assemble" |
| 362 | action: "c-compile" |
| 363 | action: "c++-compile" |
| 364 | action: "c++-header-parsing" |
| 365 | action: "c++-header-preprocessing" |
| 366 | action: "c++-module-compile" |
| 367 | flag_group { |
| 368 | flag: "-DAOS_DEBUG=0" |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | feature { |
| 374 | name: "dbg" |
| 375 | implies: "all_modes" |
| 376 | flag_set { |
| 377 | action: "preprocess-assemble" |
| 378 | action: "c-compile" |
| 379 | action: "c++-compile" |
| 380 | action: "c++-header-parsing" |
| 381 | action: "c++-header-preprocessing" |
| 382 | action: "c++-module-compile" |
| 383 | flag_group { |
| 384 | flag: "-DAOS_DEBUG=1" |
| 385 | } |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | feature { |
| 390 | name: "fastbuild" |
| 391 | implies: "all_modes" |
| 392 | flag_set { |
| 393 | action: "preprocess-assemble" |
| 394 | action: "c-compile" |
| 395 | action: "c++-compile" |
| 396 | action: "c++-header-parsing" |
| 397 | action: "c++-header-preprocessing" |
| 398 | action: "c++-module-compile" |
| 399 | flag_group { |
| 400 | flag: "-DAOS_DEBUG=0" |
| 401 | } |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | feature { |
| 406 | name: "all_modes" |
| 407 | flag_set { |
| 408 | action: "c-compile" |
| 409 | flag_group { |
| 410 | flag: "-std=gnu99" |
| 411 | } |
| 412 | } |
| 413 | flag_set { |
| 414 | action: "preprocess-assemble" |
| 415 | action: "assemble" |
| 416 | action: "c++-link" |
| 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 | |
| 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 | |
| 461 | # Temporary escape hatch for the Gyp->Bazel conversion. |
| 462 | # TODO(Brian): Remove this. |
| 463 | compiler_flag: "-DAOS_BAZEL" |
| 464 | |
| 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" |
| 491 | compiler_flag: "-Wswitch-enum" |
| 492 | compiler_flag: "-Wpointer-arith" |
Brian Silverman | 594be0d | 2015-10-31 17:56:23 -0400 | [diff] [blame] | 493 | compiler_flag: "-Wstrict-aliasing" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 494 | compiler_flag: "-Wcast-qual" |
| 495 | compiler_flag: "-Wcast-align" |
| 496 | compiler_flag: "-Wwrite-strings" |
| 497 | compiler_flag: "-Wtype-limits" |
| 498 | compiler_flag: "-Wsign-compare" |
| 499 | compiler_flag: "-Wformat=2" |
| 500 | compiler_flag: "-Werror" |
| 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 | |
| 518 | compilation_mode_flags { |
| 519 | mode: DBG |
| 520 | # Enable debug symbols. |
| 521 | compiler_flag: "-ggdb3" |
| 522 | } |
| 523 | compilation_mode_flags { |
| 524 | mode: OPT |
| 525 | |
| 526 | # No debug symbols. |
| 527 | # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or |
| 528 | # even generally? However, that can't happen here, as it requires special |
| 529 | # handling in Bazel. |
| 530 | compiler_flag: "-g0" |
| 531 | |
Brian Silverman | 594be0d | 2015-10-31 17:56:23 -0400 | [diff] [blame] | 532 | compiler_flag: "-O2" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 533 | |
| 534 | # Disable assertions |
| 535 | compiler_flag: "-DNDEBUG" |
| 536 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 537 | |
| 538 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 539 | compiler_flag: "-ffunction-sections" |
| 540 | compiler_flag: "-fdata-sections" |
| 541 | linker_flag: "-Wl,--gc-sections" |
| 542 | } |
| 543 | } |