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 { |
| 6 | cpu: "k8" |
| 7 | toolchain_identifier: "local_linux" |
| 8 | } |
| 9 | |
| 10 | default_toolchain { |
| 11 | cpu: "armeabi-v7a" |
| 12 | toolchain_identifier: "stub_armeabi-v7a" |
| 13 | } |
| 14 | |
| 15 | |
| 16 | toolchain { |
| 17 | abi_version: "armeabi-v7a" |
| 18 | abi_libc_version: "armeabi-v7a" |
| 19 | builtin_sysroot: "" |
| 20 | compiler: "compiler" |
| 21 | host_system_name: "armeabi-v7a" |
| 22 | needsPic: true |
| 23 | supports_gold_linker: false |
| 24 | supports_incremental_linker: false |
| 25 | supports_fission: false |
| 26 | supports_interface_shared_objects: false |
| 27 | supports_normalizing_ar: false |
| 28 | supports_start_end_lib: false |
| 29 | supports_thin_archives: false |
| 30 | target_libc: "armeabi-v7a" |
| 31 | target_cpu: "armeabi-v7a" |
| 32 | target_system_name: "armeabi-v7a" |
| 33 | toolchain_identifier: "stub_armeabi-v7a" |
| 34 | |
| 35 | tool_path { name: "ar" path: "/bin/false" } |
| 36 | tool_path { name: "compat-ld" path: "/bin/false" } |
| 37 | tool_path { name: "cpp" path: "/bin/false" } |
| 38 | tool_path { name: "dwp" path: "/bin/false" } |
| 39 | tool_path { name: "gcc" path: "/bin/false" } |
| 40 | tool_path { name: "gcov" path: "/bin/false" } |
| 41 | tool_path { name: "ld" path: "/bin/false" } |
| 42 | |
| 43 | tool_path { name: "nm" path: "/bin/false" } |
| 44 | tool_path { name: "objcopy" path: "/bin/false" } |
| 45 | tool_path { name: "objdump" path: "/bin/false" } |
| 46 | tool_path { name: "strip" path: "/bin/false" } |
| 47 | } |
| 48 | |
| 49 | toolchain { |
| 50 | abi_version: "local" |
| 51 | abi_libc_version: "local" |
| 52 | builtin_sysroot: "" |
| 53 | compiler: "compiler" |
| 54 | host_system_name: "local" |
| 55 | needsPic: true |
| 56 | supports_gold_linker: false |
| 57 | supports_incremental_linker: false |
| 58 | supports_fission: false |
| 59 | supports_interface_shared_objects: false |
| 60 | supports_normalizing_ar: false |
| 61 | supports_start_end_lib: false |
| 62 | supports_thin_archives: false |
| 63 | target_libc: "local" |
| 64 | target_cpu: "local" |
| 65 | target_system_name: "local" |
| 66 | toolchain_identifier: "local_linux" |
| 67 | |
| 68 | tool_path { name: "ar" path: "/usr/bin/ar" } |
| 69 | tool_path { name: "compat-ld" path: "/usr/bin/ld" } |
| 70 | tool_path { name: "cpp" path: "/usr/bin/cpp" } |
| 71 | tool_path { name: "dwp" path: "/usr/bin/dwp" } |
| 72 | tool_path { name: "gcc" path: "/usr/bin/clang-3.6" } |
| 73 | tool_path { name: "gcov" path: "/usr/bin/gcov" } |
| 74 | # C(++) compiles invoke the compiler (as that is the one knowing where |
| 75 | # to find libraries), but we provide LD so other rules can invoke the linker. |
| 76 | tool_path { name: "ld" path: "/usr/bin/ld" } |
| 77 | tool_path { name: "nm" path: "/usr/bin/nm" } |
| 78 | tool_path { name: "objcopy" path: "/usr/bin/objcopy" } |
| 79 | objcopy_embed_flag: "-I" |
| 80 | objcopy_embed_flag: "binary" |
| 81 | tool_path { name: "objdump" path: "/usr/bin/objdump" } |
| 82 | tool_path { name: "strip" path: "/usr/bin/strip" } |
| 83 | |
| 84 | # TODO(bazel-team): In theory, the path here ought to exactly match the path |
| 85 | # used by gcc. That works because bazel currently doesn't track files at |
| 86 | # absolute locations and has no remote execution, yet. However, this will need |
| 87 | # to be fixed, maybe with auto-detection? |
| 88 | cxx_builtin_include_directory: "/usr/lib/gcc/" |
| 89 | cxx_builtin_include_directory: "/usr/local/include" |
| 90 | cxx_builtin_include_directory: "/usr/include" |
| 91 | |
| 92 | linker_flag: "-lstdc++" |
| 93 | linker_flag: "-B/usr/bin/" |
| 94 | |
| 95 | feature { |
| 96 | name: "opt" |
| 97 | implies: "all_modes" |
| 98 | flag_set { |
| 99 | action: "preprocess-assemble" |
| 100 | action: "c-compile" |
| 101 | action: "c++-compile" |
| 102 | action: "c++-header-parsing" |
| 103 | action: "c++-header-preprocessing" |
| 104 | action: "c++-module-compile" |
| 105 | flag_group { |
| 106 | flag: "-DAOS_DEBUG=0" |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | feature { |
| 112 | name: "dbg" |
| 113 | implies: "all_modes" |
| 114 | flag_set { |
| 115 | action: "preprocess-assemble" |
| 116 | action: "c-compile" |
| 117 | action: "c++-compile" |
| 118 | action: "c++-header-parsing" |
| 119 | action: "c++-header-preprocessing" |
| 120 | action: "c++-module-compile" |
| 121 | flag_group { |
| 122 | flag: "-DAOS_DEBUG=1" |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | feature { |
| 128 | name: "fastbuild" |
| 129 | implies: "all_modes" |
| 130 | flag_set { |
| 131 | action: "preprocess-assemble" |
| 132 | action: "c-compile" |
| 133 | action: "c++-compile" |
| 134 | action: "c++-header-parsing" |
| 135 | action: "c++-header-preprocessing" |
| 136 | action: "c++-module-compile" |
| 137 | flag_group { |
| 138 | flag: "-DAOS_DEBUG=0" |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | feature { |
| 144 | name: "all_modes" |
| 145 | flag_set { |
| 146 | action: "c-compile" |
| 147 | flag_group { |
| 148 | flag: "-std=gnu99" |
| 149 | } |
| 150 | } |
| 151 | flag_set { |
| 152 | action: "c++-compile" |
| 153 | action: "c++-header-parsing" |
| 154 | action: "c++-header-preprocessing" |
| 155 | action: "c++-module-compile" |
| 156 | flag_group { |
| 157 | flag: "-std=gnu++11" |
| 158 | } |
| 159 | flag_group { |
| 160 | # We always want to compile with -pthread semantics. |
| 161 | flag: "-pthread" |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | # Anticipated future default. |
| 167 | # This makes GCC and Clang do what we want when called through symlinks. |
| 168 | unfiltered_cxx_flag: "-no-canonical-prefixes" |
| 169 | linker_flag: "-no-canonical-prefixes" |
| 170 | |
| 171 | # Things that the code wants defined. |
| 172 | compiler_flag: "-D__STDC_FORMAT_MACROS" |
| 173 | compiler_flag: "-D__STDC_CONSTANT_MACROS" |
| 174 | compiler_flag: "-D__STDC_LIMIT_MACROS" |
| 175 | compiler_flag: "-D_FILE_OFFSET_BITS=64" |
| 176 | # TODO(Brian): Rename this or something. |
| 177 | #compiler_flag: "-DAOS_ARCHITECTURE_arm_frc" |
| 178 | |
| 179 | linker_flag: "-fuse-ld=gold" |
| 180 | |
| 181 | # Temporary escape hatch for the Gyp->Bazel conversion. |
| 182 | # TODO(Brian): Remove this. |
| 183 | compiler_flag: "-DAOS_BAZEL" |
| 184 | |
| 185 | # Make C++ compilation deterministic. Use linkstamping instead of these |
| 186 | # compiler symbols. |
| 187 | unfiltered_cxx_flag: "-Wno-builtin-macro-redefined" |
| 188 | unfiltered_cxx_flag: "-D__DATE__=\"redacted\"" |
| 189 | unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\"" |
| 190 | unfiltered_cxx_flag: "-D__TIME__=\"redacted\"" |
| 191 | |
| 192 | # Security hardening on by default. |
| 193 | # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. |
| 194 | # We need to undef it before redefining it as some distributions now have |
| 195 | # it enabled by default. |
| 196 | compiler_flag: "-U_FORTIFY_SOURCE" |
| 197 | compiler_flag: "-D_FORTIFY_SOURCE=1" |
| 198 | compiler_flag: "-fstack-protector" |
| 199 | compiler_flag: "-fPIE" |
| 200 | linker_flag: "-pie" |
| 201 | linker_flag: "-Wl,-z,relro,-z,now" |
| 202 | |
| 203 | # Pretty much everything needs this, including parts of the glibc STL... |
| 204 | linker_flag: "-lm" |
| 205 | |
| 206 | # Enable coloring even if there's no attached terminal. Bazel removes the |
| 207 | # escape sequences if --nocolor is specified. |
| 208 | compiler_flag: "-fcolor-diagnostics" |
| 209 | |
| 210 | compiler_flag: "-Wall" |
| 211 | compiler_flag: "-Wextra" |
| 212 | compiler_flag: "-Wswitch-enum" |
| 213 | compiler_flag: "-Wpointer-arith" |
| 214 | compiler_flag: "-Wstrict-aliasing=2" |
| 215 | compiler_flag: "-Wcast-qual" |
| 216 | compiler_flag: "-Wcast-align" |
| 217 | compiler_flag: "-Wwrite-strings" |
| 218 | compiler_flag: "-Wtype-limits" |
| 219 | compiler_flag: "-Wsign-compare" |
| 220 | compiler_flag: "-Wformat=2" |
| 221 | compiler_flag: "-Werror" |
| 222 | |
| 223 | # Keep stack frames for debugging, even in opt mode. |
| 224 | compiler_flag: "-fno-omit-frame-pointer" |
| 225 | |
| 226 | # Don't use temp files while compiling. |
| 227 | compiler_flag: "-pipe" |
| 228 | |
| 229 | # Have GCC return the exit code from ld. |
| 230 | #linker_flag: "-pass-exit-codes" |
| 231 | |
| 232 | # Stamp the binary with a unique identifier. |
| 233 | linker_flag: "-Wl,--build-id=md5" |
| 234 | linker_flag: "-Wl,--hash-style=gnu" |
| 235 | linker_flag: "-Wl,--warn-execstack" |
| 236 | linker_flag: "-Wl,--detect-odr-violations" |
| 237 | |
| 238 | compilation_mode_flags { |
| 239 | mode: DBG |
| 240 | # Enable debug symbols. |
| 241 | compiler_flag: "-ggdb3" |
| 242 | } |
| 243 | compilation_mode_flags { |
| 244 | mode: OPT |
| 245 | |
| 246 | # No debug symbols. |
| 247 | # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or |
| 248 | # even generally? However, that can't happen here, as it requires special |
| 249 | # handling in Bazel. |
| 250 | compiler_flag: "-g0" |
| 251 | |
| 252 | compiler_flag: "-Oz" |
| 253 | |
| 254 | # Disable assertions |
| 255 | compiler_flag: "-DNDEBUG" |
| 256 | |
| 257 | # Removal of unused code and data at link time (can this increase binary size in some cases?). |
| 258 | compiler_flag: "-ffunction-sections" |
| 259 | compiler_flag: "-fdata-sections" |
| 260 | linker_flag: "-Wl,--gc-sections" |
| 261 | } |
| 262 | } |