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