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? |
| 93 | cxx_builtin_include_directory: "/usr/lib/gcc/" |
| 94 | cxx_builtin_include_directory: "/usr/local/include" |
| 95 | cxx_builtin_include_directory: "/usr/include" |
| 96 | |
| 97 | linker_flag: "-lstdc++" |
| 98 | linker_flag: "-B/usr/bin/" |
| 99 | |
| 100 | feature { |
| 101 | name: "opt" |
| 102 | implies: "all_modes" |
| 103 | flag_set { |
| 104 | action: "preprocess-assemble" |
| 105 | action: "c-compile" |
| 106 | action: "c++-compile" |
| 107 | action: "c++-header-parsing" |
| 108 | action: "c++-header-preprocessing" |
| 109 | action: "c++-module-compile" |
| 110 | flag_group { |
| 111 | flag: "-DAOS_DEBUG=0" |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | feature { |
| 117 | name: "dbg" |
| 118 | implies: "all_modes" |
| 119 | flag_set { |
| 120 | action: "preprocess-assemble" |
| 121 | action: "c-compile" |
| 122 | action: "c++-compile" |
| 123 | action: "c++-header-parsing" |
| 124 | action: "c++-header-preprocessing" |
| 125 | action: "c++-module-compile" |
| 126 | flag_group { |
| 127 | flag: "-DAOS_DEBUG=1" |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | feature { |
| 133 | name: "fastbuild" |
| 134 | implies: "all_modes" |
| 135 | flag_set { |
| 136 | action: "preprocess-assemble" |
| 137 | action: "c-compile" |
| 138 | action: "c++-compile" |
| 139 | action: "c++-header-parsing" |
| 140 | action: "c++-header-preprocessing" |
| 141 | action: "c++-module-compile" |
| 142 | flag_group { |
| 143 | flag: "-DAOS_DEBUG=0" |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | feature { |
| 149 | name: "all_modes" |
| 150 | flag_set { |
| 151 | action: "c-compile" |
| 152 | flag_group { |
| 153 | flag: "-std=gnu99" |
| 154 | } |
| 155 | } |
| 156 | flag_set { |
| 157 | action: "c++-compile" |
| 158 | action: "c++-header-parsing" |
| 159 | action: "c++-header-preprocessing" |
| 160 | action: "c++-module-compile" |
| 161 | flag_group { |
| 162 | flag: "-std=gnu++11" |
| 163 | } |
Brian Silverman | 23a1b34 | 2015-10-11 23:44:09 -0400 | [diff] [blame] | 164 | } |
| 165 | flag_set { |
| 166 | action: "preprocess-assemble" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 167 | action: "assemble" |
| 168 | action: "c++-link" |
Brian Silverman | 23a1b34 | 2015-10-11 23:44:09 -0400 | [diff] [blame] | 169 | action: "c++-compile" |
| 170 | action: "c++-header-parsing" |
| 171 | action: "c++-header-preprocessing" |
| 172 | action: "c++-module-compile" |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 173 | action: "c-compile" |
Brian Silverman | 5dc0007 | 2015-10-12 00:38:14 -0400 | [diff] [blame] | 174 | flag_group { |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 175 | # We always want to compile with -pthread semantics. |
Brian Silverman | 5dc0007 | 2015-10-12 00:38:14 -0400 | [diff] [blame] | 176 | flag: "-pthread" |
| 177 | } |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 178 | } |
| 179 | } |
| 180 | |
| 181 | # Anticipated future default. |
| 182 | # This makes GCC and Clang do what we want when called through symlinks. |
| 183 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 184 | linker_flag: "-no-canonical-prefixes" |
| 185 | |
| 186 | # Things that the code wants defined. |
| 187 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 188 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 189 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
| 190 | compiler_flag: "-D_FILE_OFFSET_BITS=64" |
| 191 | # TODO(Brian): Rename this or something. |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 192 | compiler_flag: "-DAOS_ARCHITECTURE_arm_frc" |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 193 | |
| 194 | linker_flag: "-fuse-ld=gold" |
| 195 | |
| 196 | # Temporary escape hatch for the Gyp->Bazel conversion. |
| 197 | # TODO(Brian): Remove this. |
| 198 | compiler_flag: "-DAOS_BAZEL" |
| 199 | |
| 200 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 201 | # compiler symbols. |
| 202 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 203 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 204 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 205 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 206 | |
| 207 | # Security hardening on by default. |
| 208 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 209 | # We need to undef it before redefining it as some distributions now have |
| 210 | # it enabled by default. |
| 211 | compiler_flag: "-U_FORTIFY_SOURCE" |
| 212 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 213 | compiler_flag: "-fstack-protector" |
| 214 | compiler_flag: "-fPIE" |
| 215 | linker_flag: "-pie" |
| 216 | linker_flag: "-Wl,-z,relro,-z,now" |
| 217 | |
| 218 | # Pretty much everything needs this, including parts of the glibc STL... |
| 219 | linker_flag: "-lm" |
| 220 | |
| 221 | # Enable coloring even if there's no attached terminal. Bazel removes the |
| 222 | # escape sequences if --nocolor is specified. |
| 223 | compiler_flag: "-fcolor-diagnostics" |
| 224 | |
| 225 | compiler_flag: "-Wall" |
| 226 | compiler_flag: "-Wextra" |
| 227 | compiler_flag: "-Wswitch-enum" |
| 228 | compiler_flag: "-Wpointer-arith" |
| 229 | compiler_flag: "-Wstrict-aliasing=2" |
| 230 | compiler_flag: "-Wcast-qual" |
| 231 | compiler_flag: "-Wcast-align" |
| 232 | compiler_flag: "-Wwrite-strings" |
| 233 | compiler_flag: "-Wtype-limits" |
| 234 | compiler_flag: "-Wsign-compare" |
| 235 | compiler_flag: "-Wformat=2" |
| 236 | compiler_flag: "-Werror" |
| 237 | |
| 238 | # Keep stack frames for debugging, even in opt mode. |
| 239 | compiler_flag: "-fno-omit-frame-pointer" |
| 240 | |
| 241 | # Don't use temp files while compiling. |
| 242 | compiler_flag: "-pipe" |
| 243 | |
Brian Silverman | 12b3fc5 | 2015-10-11 19:38:33 -0400 | [diff] [blame] | 244 | # Stamp the binary with a unique identifier. |
| 245 | linker_flag: "-Wl,--build-id=md5" |
| 246 | linker_flag: "-Wl,--hash-style=gnu" |
| 247 | linker_flag: "-Wl,--warn-execstack" |
| 248 | linker_flag: "-Wl,--detect-odr-violations" |
| 249 | |
| 250 | compilation_mode_flags { |
| 251 | mode: DBG |
| 252 | # Enable debug symbols. |
| 253 | compiler_flag: "-ggdb3" |
| 254 | } |
| 255 | compilation_mode_flags { |
| 256 | mode: OPT |
| 257 | |
| 258 | # No debug symbols. |
| 259 | # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or |
| 260 | # even generally? However, that can't happen here, as it requires special |
| 261 | # handling in Bazel. |
| 262 | compiler_flag: "-g0" |
| 263 | |
| 264 | compiler_flag: "-Oz" |
| 265 | |
| 266 | # Disable assertions |
| 267 | compiler_flag: "-DNDEBUG" |
| 268 | |
| 269 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 270 | compiler_flag: "-ffunction-sections" |
| 271 | compiler_flag: "-fdata-sections" |
| 272 | linker_flag: "-Wl,--gc-sections" |
| 273 | } |
| 274 | } |
Austin Schuh | 23da18b | 2015-10-11 20:52:49 -0700 | [diff] [blame] | 275 | |
| 276 | toolchain { |
| 277 | abi_version: "roborio" |
| 278 | abi_libc_version: "roborio" |
| 279 | builtin_sysroot: "" |
| 280 | compiler: "gcc" |
| 281 | host_system_name: "roborio" |
| 282 | needsPic: true |
| 283 | supports_gold_linker: false |
| 284 | supports_incremental_linker: false |
| 285 | supports_fission: false |
| 286 | supports_interface_shared_objects: false |
| 287 | supports_normalizing_ar: false |
| 288 | supports_start_end_lib: false |
| 289 | supports_thin_archives: false |
| 290 | target_libc: "roborio" |
| 291 | target_cpu: "roborio" |
| 292 | target_system_name: "roborio" |
| 293 | toolchain_identifier: "roborio_linux" |
| 294 | |
Austin Schuh | 55139fe | 2015-10-14 23:55:24 -0700 | [diff] [blame] | 295 | tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" } |
| 296 | tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" } |
| 297 | tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" } |
| 298 | tool_path { name: "dwp" path: "/bin/false" } |
| 299 | tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" } |
| 300 | 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] | 301 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 302 | # 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] | 303 | tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" } |
| 304 | tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" } |
| 305 | 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] | 306 | objcopy_embed_flag: "-I" |
| 307 | objcopy_embed_flag: "binary" |
Austin Schuh | 55139fe | 2015-10-14 23:55:24 -0700 | [diff] [blame] | 308 | tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" } |
| 309 | 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] | 310 | |
| 311 | # TODO(bazel-team): In theory, the path here ought to exactly match the path |
| 312 | # used by gcc. That works because bazel currently doesn't track files at |
| 313 | # absolute locations and has no remote execution, yet. However, this will need |
| 314 | # to be fixed, maybe with auto-detection? |
| 315 | cxx_builtin_include_directory: "/usr/lib/gcc/" |
| 316 | cxx_builtin_include_directory: "/usr/local/include" |
| 317 | cxx_builtin_include_directory: "/usr/include" |
| 318 | |
| 319 | linker_flag: "-lstdc++" |
| 320 | #linker_flag: "-B/usr/bin/" |
| 321 | |
| 322 | feature { |
| 323 | name: "opt" |
| 324 | implies: "all_modes" |
| 325 | flag_set { |
| 326 | action: "preprocess-assemble" |
| 327 | action: "c-compile" |
| 328 | action: "c++-compile" |
| 329 | action: "c++-header-parsing" |
| 330 | action: "c++-header-preprocessing" |
| 331 | action: "c++-module-compile" |
| 332 | flag_group { |
| 333 | flag: "-DAOS_DEBUG=0" |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | feature { |
| 339 | name: "dbg" |
| 340 | implies: "all_modes" |
| 341 | flag_set { |
| 342 | action: "preprocess-assemble" |
| 343 | action: "c-compile" |
| 344 | action: "c++-compile" |
| 345 | action: "c++-header-parsing" |
| 346 | action: "c++-header-preprocessing" |
| 347 | action: "c++-module-compile" |
| 348 | flag_group { |
| 349 | flag: "-DAOS_DEBUG=1" |
| 350 | } |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | feature { |
| 355 | name: "fastbuild" |
| 356 | implies: "all_modes" |
| 357 | flag_set { |
| 358 | action: "preprocess-assemble" |
| 359 | action: "c-compile" |
| 360 | action: "c++-compile" |
| 361 | action: "c++-header-parsing" |
| 362 | action: "c++-header-preprocessing" |
| 363 | action: "c++-module-compile" |
| 364 | flag_group { |
| 365 | flag: "-DAOS_DEBUG=0" |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | feature { |
| 371 | name: "all_modes" |
| 372 | flag_set { |
| 373 | action: "c-compile" |
| 374 | flag_group { |
| 375 | flag: "-std=gnu99" |
| 376 | } |
| 377 | } |
| 378 | flag_set { |
| 379 | action: "preprocess-assemble" |
| 380 | action: "assemble" |
| 381 | action: "c++-link" |
| 382 | flag_group { |
| 383 | flag: "-std=gnu99" |
| 384 | } |
| 385 | } |
| 386 | flag_set { |
| 387 | action: "c++-compile" |
| 388 | action: "c++-header-parsing" |
| 389 | action: "c++-header-preprocessing" |
| 390 | action: "c++-module-compile" |
| 391 | flag_group { |
| 392 | flag: "-std=gnu++1y" |
| 393 | } |
| 394 | } |
| 395 | flag_set { |
| 396 | action: "preprocess-assemble" |
| 397 | action: "assemble" |
| 398 | action: "c++-link" |
| 399 | action: "c++-compile" |
| 400 | action: "c++-header-parsing" |
| 401 | action: "c++-header-preprocessing" |
| 402 | action: "c++-module-compile" |
| 403 | action: "c-compile" |
| 404 | flag_group { |
| 405 | # We always want to compile with -pthread semantics. |
| 406 | flag: "-pthread" |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | # Anticipated future default. |
| 412 | # This makes GCC and Clang do what we want when called through symlinks. |
| 413 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 414 | linker_flag: "-no-canonical-prefixes" |
| 415 | |
| 416 | # Things that the code wants defined. |
| 417 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 418 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 419 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
| 420 | compiler_flag: "-D_FILE_OFFSET_BITS=64" |
| 421 | # TODO(Brian): Rename this or something. |
| 422 | #compiler_flag: "-DAOS_ARCHITECTURE_arm_frc" |
| 423 | |
| 424 | #linker_flag: "-fuse-ld=gold" |
| 425 | |
| 426 | # Temporary escape hatch for the Gyp->Bazel conversion. |
| 427 | # TODO(Brian): Remove this. |
| 428 | compiler_flag: "-DAOS_BAZEL" |
| 429 | |
| 430 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 431 | # compiler symbols. |
| 432 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 433 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 434 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 435 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 436 | |
| 437 | # Security hardening on by default. |
| 438 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 439 | # We need to undef it before redefining it as some distributions now have |
| 440 | # it enabled by default. |
| 441 | compiler_flag: "-U_FORTIFY_SOURCE" |
| 442 | compiler_flag: "-fstack-protector" |
| 443 | compiler_flag: "-fPIE" |
| 444 | linker_flag: "-pie" |
| 445 | linker_flag: "-Wl,-z,relro,-z,now" |
| 446 | |
| 447 | # Pretty much everything needs this, including parts of the glibc STL... |
| 448 | linker_flag: "-lm" |
| 449 | |
| 450 | # Enable coloring even if there's no attached terminal. Bazel removes the |
| 451 | # escape sequences if --nocolor is specified. |
| 452 | compiler_flag: "-fdiagnostics-color=always" |
| 453 | |
| 454 | compiler_flag: "-Wall" |
| 455 | compiler_flag: "-Wextra" |
| 456 | compiler_flag: "-Wswitch-enum" |
| 457 | compiler_flag: "-Wpointer-arith" |
| 458 | compiler_flag: "-Wstrict-aliasing=2" |
| 459 | compiler_flag: "-Wcast-qual" |
| 460 | compiler_flag: "-Wcast-align" |
| 461 | compiler_flag: "-Wwrite-strings" |
| 462 | compiler_flag: "-Wtype-limits" |
| 463 | compiler_flag: "-Wsign-compare" |
| 464 | compiler_flag: "-Wformat=2" |
| 465 | compiler_flag: "-Werror" |
| 466 | |
| 467 | # Keep stack frames for debugging, even in opt mode. |
| 468 | compiler_flag: "-fno-omit-frame-pointer" |
| 469 | compiler_flag: "-D__has_feature(x)=0" |
| 470 | |
| 471 | # Don't use temp files while compiling. |
| 472 | compiler_flag: "-pipe" |
| 473 | |
| 474 | # Have GCC return the exit code from ld. |
| 475 | linker_flag: "-pass-exit-codes" |
| 476 | |
| 477 | # Stamp the binary with a unique identifier. |
| 478 | linker_flag: "-Wl,--build-id=md5" |
| 479 | linker_flag: "-Wl,--hash-style=gnu" |
| 480 | #linker_flag: "-Wl,--warn-execstack" |
| 481 | #linker_flag: "-Wl,--detect-odr-violations" |
| 482 | |
| 483 | compilation_mode_flags { |
| 484 | mode: DBG |
| 485 | # Enable debug symbols. |
| 486 | compiler_flag: "-ggdb3" |
| 487 | } |
| 488 | compilation_mode_flags { |
| 489 | mode: OPT |
| 490 | |
| 491 | # No debug symbols. |
| 492 | # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or |
| 493 | # even generally? However, that can't happen here, as it requires special |
| 494 | # handling in Bazel. |
| 495 | compiler_flag: "-g0" |
| 496 | |
| 497 | compiler_flag: "-Oz" |
| 498 | |
| 499 | # Disable assertions |
| 500 | compiler_flag: "-DNDEBUG" |
| 501 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 502 | |
| 503 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 504 | compiler_flag: "-ffunction-sections" |
| 505 | compiler_flag: "-fdata-sections" |
| 506 | linker_flag: "-Wl,--gc-sections" |
| 507 | } |
| 508 | } |