|
| 1 | +major_version: "local" |
| 2 | +minor_version: "" |
| 3 | +default_target_cpu: "same_as_host" |
| 4 | + |
| 5 | +default_toolchain { |
| 6 | + cpu: "k8" |
| 7 | + toolchain_identifier: "local_linux" |
| 8 | +} |
| 9 | + |
| 10 | +toolchain { |
| 11 | + abi_version: "local" |
| 12 | + abi_libc_version: "local" |
| 13 | + builtin_sysroot: "" |
| 14 | + compiler: "compiler" |
| 15 | + host_system_name: "local" |
| 16 | + needsPic: true |
| 17 | + supports_gold_linker: false |
| 18 | + supports_incremental_linker: false |
| 19 | + supports_fission: false |
| 20 | + supports_interface_shared_objects: false |
| 21 | + supports_normalizing_ar: false |
| 22 | + supports_start_end_lib: false |
| 23 | + supports_thin_archives: false |
| 24 | + target_libc: "local" |
| 25 | + target_cpu: "local" |
| 26 | + target_system_name: "local" |
| 27 | + toolchain_identifier: "local_linux" |
| 28 | + |
| 29 | + tool_path { name: "ar" path: "/usr/bin/ar" } |
| 30 | + tool_path { name: "compat-ld" path: "/usr/bin/ld" } |
| 31 | + tool_path { name: "cpp" path: "/usr/bin/cpp" } |
| 32 | + tool_path { name: "dwp" path: "/usr/bin/dwp" } |
| 33 | + tool_path { name: "gcc" path: "/usr/bin/gcc-4.8" } |
| 34 | + cxx_flag: "-std=c++0x" |
| 35 | + linker_flag: "-lstdc++" |
| 36 | + linker_flag: "-B/usr/bin/" |
| 37 | + |
| 38 | + # TODO(bazel-team): In theory, the path here ought to exactly match the path |
| 39 | + # used by gcc. That works because bazel currently doesn't track files at |
| 40 | + # absolute locations and has no remote execution, yet. However, this will need |
| 41 | + # to be fixed, maybe with auto-detection? |
| 42 | + cxx_builtin_include_directory: "/usr/lib/gcc/" |
| 43 | + cxx_builtin_include_directory: "/usr/local/include" |
| 44 | + cxx_builtin_include_directory: "/usr/include" |
| 45 | + tool_path { name: "gcov" path: "/usr/bin/gcov" } |
| 46 | + |
| 47 | + # C(++) compiles invoke the compiler (as that is the one knowing where |
| 48 | + # to find libraries), but we provide LD so other rules can invoke the linker. |
| 49 | + tool_path { name: "ld" path: "/usr/bin/ld" } |
| 50 | + |
| 51 | + tool_path { name: "nm" path: "/usr/bin/nm" } |
| 52 | + tool_path { name: "objcopy" path: "/usr/bin/objcopy" } |
| 53 | + objcopy_embed_flag: "-I" |
| 54 | + objcopy_embed_flag: "binary" |
| 55 | + tool_path { name: "objdump" path: "/usr/bin/objdump" } |
| 56 | + tool_path { name: "strip" path: "/usr/bin/strip" } |
| 57 | + |
| 58 | + # Anticipated future default. |
| 59 | + unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 60 | + |
| 61 | + # Make C++ compilation deterministic. Use linkstamping instead of these |
| 62 | + # compiler symbols. |
| 63 | + unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 64 | + unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 65 | + unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 66 | + unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 67 | + |
| 68 | + # Security hardening on by default. |
| 69 | + # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 70 | + # We need to undef it before redefining it as some distributions now have |
| 71 | + # it enabled by default. |
| 72 | + compiler_flag: "-U_FORTIFY_SOURCE" |
| 73 | + compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 74 | + compiler_flag: "-fstack-protector" |
| 75 | + compiler_flag: "-fPIE" |
| 76 | + linker_flag: "-pie" |
| 77 | + linker_flag: "-Wl,-z,relro,-z,now" |
| 78 | + |
| 79 | + # Enable coloring even if there's no attached terminal. Bazel removes the |
| 80 | + # escape sequences if --nocolor is specified. This isn't supported by gcc |
| 81 | + # on Ubuntu 14.04. |
| 82 | + # compiler_flag: "-fcolor-diagnostics" |
| 83 | + |
| 84 | + # All warnings are enabled. Maybe enable -Werror as well? |
| 85 | + compiler_flag: "-Wall" |
| 86 | + # Enable a few more warnings that aren't part of -Wall. |
| 87 | + compiler_flag: "-Wunused-but-set-parameter" |
| 88 | + # But disable some that are problematic. |
| 89 | + compiler_flag: "-Wno-free-nonheap-object" # has false positives |
| 90 | + |
| 91 | + # Keep stack frames for debugging, even in opt mode. |
| 92 | + compiler_flag: "-fno-omit-frame-pointer" |
| 93 | + |
| 94 | + # Anticipated future default. |
| 95 | + linker_flag: "-no-canonical-prefixes" |
| 96 | + # Have gcc return the exit code from ld. |
| 97 | + linker_flag: "-pass-exit-codes" |
| 98 | + # Stamp the binary with a unique identifier. |
| 99 | + linker_flag: "-Wl,--build-id=md5" |
| 100 | + linker_flag: "-Wl,--hash-style=gnu" |
| 101 | + # Gold linker only? Can we enable this by default? |
| 102 | + # linker_flag: "-Wl,--warn-execstack" |
| 103 | + # linker_flag: "-Wl,--detect-odr-violations" |
| 104 | + |
| 105 | + compilation_mode_flags { |
| 106 | + mode: DBG |
| 107 | + # Enable debug symbols. |
| 108 | + compiler_flag: "-g" |
| 109 | + } |
| 110 | + compilation_mode_flags { |
| 111 | + mode: OPT |
| 112 | + |
| 113 | + # No debug symbols. |
| 114 | + # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or |
| 115 | + # even generally? However, that can't happen here, as it requires special |
| 116 | + # handling in Bazel. |
| 117 | + compiler_flag: "-g0" |
| 118 | + |
| 119 | + # Conservative choice for -O |
| 120 | + # -O3 can increase binary size and even slow down the resulting binaries. |
| 121 | + # Profile first and / or use FDO if you need better performance than this. |
| 122 | + compiler_flag: "-O2" |
| 123 | + |
| 124 | + # Disable assertions |
| 125 | + compiler_flag: "-DNDEBUG" |
| 126 | + |
| 127 | + # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 128 | + compiler_flag: "-ffunction-sections" |
| 129 | + compiler_flag: "-fdata-sections" |
| 130 | + linker_flag: "-Wl,--gc-sections" |
| 131 | + } |
| 132 | +} |
0 commit comments