blob: baa91b7f130c3b6da87564f54ad0b9f0a05101d3 [file] [log] [blame]
Brian Silverman12b3fc52015-10-11 19:38:33 -04001major_version: "local"
2minor_version: ""
3default_target_cpu: "same_as_host"
4
5default_toolchain {
6 cpu: "k8"
7 toolchain_identifier: "local_linux"
8}
9
10default_toolchain {
11 cpu: "armeabi-v7a"
12 toolchain_identifier: "stub_armeabi-v7a"
13}
14
15
16toolchain {
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
49toolchain {
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 }
Brian Silverman23a1b342015-10-11 23:44:09 -0400159 }
160 flag_set {
161 action: "preprocess-assemble"
162 action: "c-compile"
163 action: "c++-compile"
164 action: "c++-header-parsing"
165 action: "c++-header-preprocessing"
166 action: "c++-module-compile"
Brian Silverman12b3fc52015-10-11 19:38:33 -0400167 flag_group {
168 # We always want to compile with -pthread semantics.
169 flag: "-pthread"
170 }
171 }
172 }
173
174 # Anticipated future default.
175 # This makes GCC and Clang do what we want when called through symlinks.
176 unfiltered_cxx_flag: "-no-canonical-prefixes"
177 linker_flag: "-no-canonical-prefixes"
178
179 # Things that the code wants defined.
180 compiler_flag: "-D__STDC_FORMAT_MACROS"
181 compiler_flag: "-D__STDC_CONSTANT_MACROS"
182 compiler_flag: "-D__STDC_LIMIT_MACROS"
183 compiler_flag: "-D_FILE_OFFSET_BITS=64"
184 # TODO(Brian): Rename this or something.
185 #compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
186
187 linker_flag: "-fuse-ld=gold"
188
189 # Temporary escape hatch for the Gyp->Bazel conversion.
190 # TODO(Brian): Remove this.
191 compiler_flag: "-DAOS_BAZEL"
192
193 # Make C++ compilation deterministic. Use linkstamping instead of these
194 # compiler symbols.
195 unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
196 unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
197 unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
198 unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
199
200 # Security hardening on by default.
201 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
202 # We need to undef it before redefining it as some distributions now have
203 # it enabled by default.
204 compiler_flag: "-U_FORTIFY_SOURCE"
205 compiler_flag: "-D_FORTIFY_SOURCE=1"
206 compiler_flag: "-fstack-protector"
207 compiler_flag: "-fPIE"
208 linker_flag: "-pie"
209 linker_flag: "-Wl,-z,relro,-z,now"
210
211 # Pretty much everything needs this, including parts of the glibc STL...
212 linker_flag: "-lm"
213
214 # Enable coloring even if there's no attached terminal. Bazel removes the
215 # escape sequences if --nocolor is specified.
216 compiler_flag: "-fcolor-diagnostics"
217
218 compiler_flag: "-Wall"
219 compiler_flag: "-Wextra"
220 compiler_flag: "-Wswitch-enum"
221 compiler_flag: "-Wpointer-arith"
222 compiler_flag: "-Wstrict-aliasing=2"
223 compiler_flag: "-Wcast-qual"
224 compiler_flag: "-Wcast-align"
225 compiler_flag: "-Wwrite-strings"
226 compiler_flag: "-Wtype-limits"
227 compiler_flag: "-Wsign-compare"
228 compiler_flag: "-Wformat=2"
229 compiler_flag: "-Werror"
230
231 # Keep stack frames for debugging, even in opt mode.
232 compiler_flag: "-fno-omit-frame-pointer"
233
234 # Don't use temp files while compiling.
235 compiler_flag: "-pipe"
236
237 # Have GCC return the exit code from ld.
238 #linker_flag: "-pass-exit-codes"
239
240 # Stamp the binary with a unique identifier.
241 linker_flag: "-Wl,--build-id=md5"
242 linker_flag: "-Wl,--hash-style=gnu"
243 linker_flag: "-Wl,--warn-execstack"
244 linker_flag: "-Wl,--detect-odr-violations"
245
246 compilation_mode_flags {
247 mode: DBG
248 # Enable debug symbols.
249 compiler_flag: "-ggdb3"
250 }
251 compilation_mode_flags {
252 mode: OPT
253
254 # No debug symbols.
255 # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt or
256 # even generally? However, that can't happen here, as it requires special
257 # handling in Bazel.
258 compiler_flag: "-g0"
259
260 compiler_flag: "-Oz"
261
262 # Disable assertions
263 compiler_flag: "-DNDEBUG"
264
265 # Removal of unused code and data at link time (can this increase binary size in some cases?).
266 compiler_flag: "-ffunction-sections"
267 compiler_flag: "-fdata-sections"
268 linker_flag: "-Wl,--gc-sections"
269 }
270}