File tree Expand file tree Collapse file tree 7 files changed +29
-13
lines changed Expand file tree Collapse file tree 7 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,13 @@ if (host_os == "mac") {
244
244
}
245
245
}
246
246
247
+ stage2_unix_toolchain (" stage2_baremetal_aarch64" ) {
248
+ toolchain_args = {
249
+ current_os = " baremetal"
250
+ current_cpu = " arm64"
251
+ }
252
+ }
253
+
247
254
template (" win_toolchain" ) {
248
255
toolchain (target_name ) {
249
256
# https://groups.google.com/a/chromium.org/d/msg/gn-dev/F_lv5T-tNDM
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ if (current_os == "android") {
42
42
" x86_64" ,
43
43
]
44
44
}
45
+ } else if (current_os == " baremetal" ) {
46
+ target_flags += [ " --target=$llvm_current_triple " ]
45
47
}
46
48
47
49
if (current_cpu == " x86" ) {
Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ if (current_os == "win") {
12
12
supported_toolchains = [ " //llvm/utils/gn/build/toolchain:stage2_unix" ]
13
13
}
14
14
supported_toolchains += supported_android_toolchains
15
+ if (llvm_build_AArch64 ) {
16
+ supported_toolchains += [ " //llvm/utils/gn/build/toolchain:stage2_baremetal_aarch64" ]
17
+ }
15
18
group (" compiler-rt" ) {
16
19
deps = [ " //compiler-rt/include($host_toolchain )" ]
17
20
foreach (toolchain , supported_toolchains ) {
Original file line number Diff line number Diff line change @@ -2,21 +2,23 @@ group("lib") {
2
2
deps = [
3
3
" //compiler-rt/lib/asan:ignorelist($host_toolchain )" ,
4
4
" //compiler-rt/lib/cfi:ignorelist($host_toolchain )" ,
5
- " //compiler-rt/lib/profile" ,
6
5
]
7
6
if (current_os == " linux" ) {
8
7
deps += [ " //compiler-rt/lib/msan" ]
9
8
}
10
9
if (current_os == " linux" || current_os == " android" ) {
11
10
deps += [ " //compiler-rt/lib/ubsan_minimal" ]
12
11
}
13
- if (current_os != " win" ) {
14
- deps += [
15
- " //compiler-rt/lib/asan" ,
16
- " //compiler-rt/lib/builtins" ,
17
- ]
12
+ if (current_os != " win" && current_os != " baremetal" ) {
13
+ deps += [ " //compiler-rt/lib/asan" ]
18
14
if (current_cpu == " x64" || current_cpu == " arm64" ) {
19
15
deps += [ " //compiler-rt/lib/tsan/rtl" ]
20
16
}
21
17
}
18
+ if (current_os != " win" ) {
19
+ deps += [ " //compiler-rt/lib/builtins" ]
20
+ }
21
+ if (current_os != " baremetal" ) {
22
+ deps += [ " //compiler-rt/lib/profile" ]
23
+ }
22
24
}
Original file line number Diff line number Diff line change @@ -4,9 +4,6 @@ import("//llvm/utils/gn/build/buildflags.gni")
4
4
declare_args () {
5
5
# Skip the atomic builtin (should normally be provided by a shared library).
6
6
compiler_rt_exclude_atomic_builtin = true
7
-
8
- # Compile builtins for baremetal.
9
- compiler_rt_baremetal_build = false
10
7
}
11
8
12
9
static_library (" builtins" ) {
@@ -170,17 +167,17 @@ static_library("builtins") {
170
167
]
171
168
172
169
if (current_os != " fuchsia" ) {
170
+ sources += [ " clear_cache.c" ]
171
+ }
172
+
173
+ if (current_os != " fuchsia" && current_os != " baremetal" ) {
173
174
sources += [
174
175
" emutls.c" ,
175
176
" enable_execute_stack.c" ,
176
177
" eprintf.c" ,
177
178
]
178
179
}
179
180
180
- if (current_os != " fuchsia" && ! compiler_rt_baremetal_build ) {
181
- sources += [ " clear_cache.c" ]
182
- }
183
-
184
181
if (current_os == " mac" || current_os == " ios" ) {
185
182
sources += [
186
183
" atomic_flag_clear.c" ,
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ if (clang_enable_per_target_runtime_dir) {
28
28
}
29
29
} else if (current_os == " ios" || current_os == " mac" ) {
30
30
crt_current_out_dir = " $clang_resource_dir /lib/darwin"
31
+ } else if (current_os == " baremetal" ) {
32
+ crt_current_out_dir = " $clang_resource_dir /lib/baremetal"
33
+ crt_current_target_suffix = " -$crt_current_target_arch "
31
34
} else if (current_os == " win" ) {
32
35
crt_current_out_dir = " $clang_resource_dir /lib/windows"
33
36
crt_current_target_suffix = " -$crt_current_target_arch "
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ if (current_cpu == "x86") {
23
23
llvm_current_triple = " aarch64-linux-android29"
24
24
} else if (current_os == " ios" || current_os == " mac" ) {
25
25
llvm_current_triple = " arm64-apple-darwin"
26
+ } else if (current_os == " baremetal" ) {
27
+ llvm_current_triple = " aarch64-elf"
26
28
} else if (current_os == " linux" ) {
27
29
llvm_current_triple = " aarch64-unknown-linux-gnu"
28
30
}
You can’t perform that action at this time.
0 commit comments