1
1
load ("@rules_cc//cc:defs.bzl" , "cc_toolchain" , "cc_toolchain_suite" )
2
+ load (":aarch64_cc_toolchain_config.bzl" , aarch64_cc_toolchain_config = "cc_toolchain_config" )
2
3
load (":armeabi_cc_toolchain_config.bzl" , "armeabi_cc_toolchain_config" )
3
4
load (":cc_toolchain_config.bzl" , "cc_toolchain_config" )
4
5
@@ -44,6 +45,14 @@ filegroup(
44
45
) + [":builtin_include_directory_paths" ],
45
46
)
46
47
48
+ filegroup (
49
+ name = "compiler_deps_aarch64" ,
50
+ srcs = glob (
51
+ ["extra_tools/**" ],
52
+ allow_empty = True ,
53
+ ) + [":builtin_include_directory_paths_aarch64" ],
54
+ )
55
+
47
56
# This is the entry point for --crosstool_top. Toolchains are found
48
57
# by lopping off the name of --crosstool_top and searching for
49
58
# the "${CPU}" entry in the toolchains attribute.
@@ -54,6 +63,8 @@ cc_toolchain_suite(
54
63
"k8" : ":cc-compiler-k8" ,
55
64
"armeabi-v7a|compiler" : ":cc-compiler-armeabi-v7a" ,
56
65
"armeabi-v7a" : ":cc-compiler-armeabi-v7a" ,
66
+ "aarch64|clang" : ":cc-compiler-aarch64" ,
67
+ "aarch64" : ":cc-compiler-aarch64" ,
57
68
},
58
69
)
59
70
@@ -172,3 +183,102 @@ cc_toolchain(
172
183
)
173
184
174
185
armeabi_cc_toolchain_config (name = "stub_armeabi-v7a" )
186
+
187
+ aarch64_cc_toolchain_config (
188
+ name = "arm64-local" ,
189
+ abi_libc_version = "arm64-local" ,
190
+ abi_version = "arm64-local" ,
191
+ compile_flags = [
192
+ "-fstack-protector" ,
193
+ "-Wall" ,
194
+ "-Wthread-safety" ,
195
+ "-Wself-assign" ,
196
+ "-Wunused-but-set-parameter" ,
197
+ "-Wno-free-nonheap-object" ,
198
+ "-fcolor-diagnostics" ,
199
+ "-fno-omit-frame-pointer" ,
200
+ ],
201
+ compiler = "clang" ,
202
+ coverage_compile_flags = [
203
+ "-fprofile-instr-generate" ,
204
+ "-fcoverage-mapping" ,
205
+ ],
206
+ coverage_link_flags = ["-fprofile-instr-generate" ],
207
+ cpu = "aarch64" ,
208
+ cxx_builtin_include_directories = [
209
+ "/opt/llvm/lib/clang/14.0.0/include" ,
210
+ "/usr/local/include" ,
211
+ "/usr/include/aarch64-linux-gnu" ,
212
+ "/usr/include" ,
213
+ "/opt/llvm/lib/clang/14.0.0/share" ,
214
+ # "/opt/llvm/include/aarch64-unknown-linux-gnu/c++/v1",
215
+ "/opt/llvm/include/c++/v1" ,
216
+ ],
217
+
218
+ cxx_flags = ["-stdlib=libc++" ],
219
+ dbg_compile_flags = ["-g" ],
220
+ host_system_name = "local" ,
221
+ link_flags = [
222
+ "-fuse-ld=/opt/llvm/bin/ld.lld" ,
223
+ "-Wl,-no-as-needed" ,
224
+ "-Wl,-z,relro,-z,now" ,
225
+ "-B/opt/llvm/bin" ,
226
+ "-lm" ,
227
+ "-pthread" ,
228
+ "-fuse-ld=lld" ,
229
+ ],
230
+ link_libs = [
231
+ "-l:libc++.a" ,
232
+ "-l:libc++abi.a" ,
233
+ ],
234
+ opt_compile_flags = [
235
+ "-g0" ,
236
+ "-O2" ,
237
+ "-D_FORTIFY_SOURCE=1" ,
238
+ "-DNDEBUG" ,
239
+ "-ffunction-sections" ,
240
+ "-fdata-sections" ,
241
+ ],
242
+ opt_link_flags = ["-Wl,--gc-sections" ],
243
+ supports_start_end_lib = True ,
244
+ target_libc = "local" ,
245
+ target_system_name = "local" ,
246
+ tool_paths = {
247
+ "ar" : "/usr/bin/ar" ,
248
+ "ld" : "/usr/bin/ld" ,
249
+ "llvm-cov" : "/opt/llvm/bin/llvm-cov" ,
250
+ "llvm-profdata" : "/opt/llvm/bin/llvm-profdata" ,
251
+ "cpp" : "/usr/bin/cpp" ,
252
+ "gcc" : "/opt/llvm/bin/clang-14" ,
253
+ "dwp" : "/usr/bin/dwp" ,
254
+ "gcov" : "/opt/llvm/bin/llvm-profdata" ,
255
+ "nm" : "/usr/bin/nm" ,
256
+ "objcopy" : "/usr/bin/objcopy" ,
257
+ "objdump" : "/usr/bin/objdump" ,
258
+ "strip" : "/usr/bin/strip" ,
259
+ },
260
+ toolchain_identifier = "local" ,
261
+ unfiltered_compile_flags = [
262
+ "-no-canonical-prefixes" ,
263
+ "-Wno-builtin-macro-redefined" ,
264
+ "-D__DATE__=\" redacted\" " ,
265
+ "-D__TIMESTAMP__=\" redacted\" " ,
266
+ "-D__TIME__=\" redacted\" " ,
267
+ ],
268
+ )
269
+
270
+ cc_toolchain (
271
+ name = "cc-compiler-aarch64" ,
272
+ all_files = ":compiler_deps_aarch64" ,
273
+ ar_files = ":compiler_deps_aarch64" ,
274
+ as_files = ":compiler_deps_aarch64" ,
275
+ compiler_files = ":compiler_deps_aarch64" ,
276
+ dwp_files = ":empty" ,
277
+ linker_files = ":compiler_deps_aarch64" ,
278
+ module_map = ":arm64.module.modulemap" ,
279
+ objcopy_files = ":empty" ,
280
+ strip_files = ":empty" ,
281
+ supports_param_files = 1 ,
282
+ toolchain_config = ":arm64-local" ,
283
+ toolchain_identifier = "arm64-local" ,
284
+ )
0 commit comments