Skip to content
/ rust Public
forked from rust-lang/rust

Commit 881d67f

Browse files
committed
Compile rustc for wasm15 with llvm
1 parent 29fc7ad commit 881d67f

File tree

12 files changed

+303
-19
lines changed

12 files changed

+303
-19
lines changed

.gitmodules

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
path = src/doc/edition-guide
3131
url = https://github.com/rust-lang/edition-guide.git
3232
shallow = true
33-
[submodule "src/llvm-project"]
34-
path = src/llvm-project
35-
url = https://github.com/rust-lang/llvm-project.git
36-
branch = rustc/18.0-2024-02-13
37-
shallow = true
3833
[submodule "src/doc/embedded-book"]
3934
path = src/doc/embedded-book
4035
url = https://github.com/rust-embedded/book.git
@@ -43,3 +38,8 @@
4338
path = library/backtrace
4439
url = https://github.com/rust-lang/backtrace-rs.git
4540
shallow = true
41+
[submodule "src/llvm-project"]
42+
path = src/llvm-project
43+
url = https://github.com/YoWASP/llvm-project
44+
branch = main+wasm
45+
shallow = true

Cargo.lock

+5-2
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,12 @@ version = "0.1.0"
475475

476476
[[package]]
477477
name = "cc"
478-
version = "1.0.90"
478+
version = "1.1.15"
479479
source = "registry+https://github.com/rust-lang/crates.io-index"
480-
checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5"
480+
checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6"
481+
dependencies = [
482+
"shlex",
483+
]
481484

482485
[[package]]
483486
name = "cfg-if"

comment.txt

+24-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Got a new version up. This time all logic to handle using different codegen back
22

33
* Make sure you are running on Linux.
44
* Clone https://github.com/bjorn3/rust
5-
* Checkout the `compile_rustc_for_wasm10` branch
6-
* Download and extract https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz into the rust checkout.
5+
* Checkout the `compile_rustc_for_wasm15` branch
6+
* Download and extract https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0-linux.tar.gz into the rust checkout.
77
* Run `./x.py install` to build the compiler and install it into the dist dir.
88
* Use `wasmtime run --dir tmp::/ --dir dist dist/bin/rustc.wasm --sysroot dist --target x86_64-unknown-linux-gnu` to run rustc.
99

@@ -16,3 +16,25 @@ $ gcc -fuse-ld=lld tmp/rmeta*/lib.rmeta tmp/rust_out.* dist/lib/rustlib/x86_64-u
1616
$ ./rust_out
1717
Hello World!
1818
```
19+
20+
use LLVM
21+
Install example:
22+
WASI_SDK_PATH=`pwd`/wasi-sdk-22.0 WASI_SYSROOT=`pwd`/wasi-sdk-22.0/share/wasi-sysroot WASI_CLANG_WRAPPER_LINKER="`pwd`/wrapper_linker_clang++.sh" ./x.py install
23+
24+
If you just want to run it, https://github.com/oligamiq/rust_wasm/tree/main/rustc_llvm
25+
```
26+
$ mkdir tmp
27+
$ echo 'fn main() { println!("Hello World!"); }' | wasmtime run -Sthreads=y -Spreview2=n --dir tmp::/ --dir dist --env RUST_MIN_STACK=16777216 dist/bin/rustc.wasm - --sysroot dist --target wasm32-wasip1-threads -Csave-temps
28+
$ gcc -fuse-ld=lld tmp/rmeta*/lib.rmeta tmp/rust_out.*.o dist/lib/rustlib/x86_64-unknown-linux-gnu/lib/lib*.rlib -o rust_out
29+
$ ./rust_out
30+
Hello World!
31+
```
32+
33+
to Wasi
34+
```
35+
$ mkdir tmp
36+
$ echo 'fn main() { println!("Hello World!"); }' | wasmtime run -Sthreads=y -Spreview2=n --dir tmp::/ --dir dist --env RUST_MIN_STACK=16777216 dist/bin/rustc.wasm - --sysroot dist --target wasm32-wasip1-threads -Csave-temps
37+
$ wasi-sdk-22.0/bin/wasm-ld --shared-memory --max-memory=1073741824 --import-memory --export __main_void -z stack-size=1048576 --stack-first --allow-undefined --no-demangle --import-memory --export-memory --shared-memory dist/lib/rustlib/wasm32-wasip1-threads/lib/self-contained/crt1-command.o tmp/rust_out.*.o dist/lib/rustlib/wasm32-wasip1-threads/lib/lib*.rlib -L dist/lib/rustlib/wasm32-wasip1-threads/lib/self-contained -lc -o rust_out.wasm
38+
$ wasmtime run -Sthreads=y rust_out.wasm
39+
Hello World!
40+
```

compiler/rustc_fs_util/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(absolute_path)]
22

3-
#[cfg(any(unix, windows))]
3+
#[cfg(any(unix, windows, target_os = "wasi"))]
44
use std::ffi::CString;
55
use std::fs;
66
use std::io;
@@ -87,7 +87,7 @@ pub fn path_to_c_string(p: &Path) -> CString {
8787
let p: &OsStr = p.as_ref();
8888
CString::new(p.as_bytes()).unwrap()
8989
}
90-
#[cfg(windows)]
90+
#[cfg(any(windows, target_os = "wasi"))]
9191
pub fn path_to_c_string(p: &Path) -> CString {
9292
CString::new(p.to_str().unwrap()).unwrap()
9393
}

compiler/rustc_llvm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ libc = "0.2.73"
1010

1111
[build-dependencies]
1212
# tidy-alphabetical-start
13-
cc = "1.0.90"
13+
cc = "1.1.15"
1414
# tidy-alphabetical-end

compiler/rustc_llvm/build.rs

+14
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ fn output(cmd: &mut Command) -> String {
101101
}
102102

103103
fn main() {
104+
if env::var("TARGET").expect("TARGET was not set").contains("wasi") {
105+
std::env::var("WASI_SYSROOT").expect("WASI_SYSROOT not set");
106+
}
107+
104108
for component in REQUIRED_COMPONENTS.iter().chain(OPTIONAL_COMPONENTS.iter()) {
105109
println!("cargo:rustc-check-cfg=cfg(llvm_component,values(\"{component}\"))");
106110
}
@@ -201,6 +205,16 @@ fn main() {
201205
cfg.debug(false);
202206
}
203207

208+
209+
if target.contains("wasi") {
210+
// ref src/bootstrap/src/core/build_steps/llvm.rs
211+
212+
let wasi_sysroot = env::var("WASI_SYSROOT").expect("WASI_SYSROOT not set");
213+
cfg.compiler(format!("{wasi_sysroot}/../../bin/{target}-clang++"));
214+
cfg.flag("-pthread");
215+
cfg.flag("-D_WASI_EMULATED_MMAN");
216+
}
217+
204218
rerun_if_changed_anything_in_dir(Path::new("llvm-wrapper"));
205219
cfg.file("llvm-wrapper/PassWrapper.cpp")
206220
.file("llvm-wrapper/RustWrapper.cpp")

compiler/rustc_target/src/target_features.rs

-2
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,9 @@ const X86_ALLOWED_FEATURES: &[(&str, Stability)] = &[
199199
("avx512bw", Unstable(sym::avx512_target_feature)),
200200
("avx512cd", Unstable(sym::avx512_target_feature)),
201201
("avx512dq", Unstable(sym::avx512_target_feature)),
202-
("avx512er", Unstable(sym::avx512_target_feature)),
203202
("avx512f", Unstable(sym::avx512_target_feature)),
204203
("avx512fp16", Unstable(sym::avx512_target_feature)),
205204
("avx512ifma", Unstable(sym::avx512_target_feature)),
206-
("avx512pf", Unstable(sym::avx512_target_feature)),
207205
("avx512vbmi", Unstable(sym::avx512_target_feature)),
208206
("avx512vbmi2", Unstable(sym::avx512_target_feature)),
209207
("avx512vl", Unstable(sym::avx512_target_feature)),

config.llvm.toml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Includes one of the default files in src/bootstrap/defaults
2+
profile = "compiler"
3+
change-id = 9999999
4+
5+
[rust]
6+
codegen-backends = ["llvm"]
7+
deny-warnings = false
8+
llvm-bitcode-linker = false
9+
10+
[llvm]
11+
cflags = "-march=native"
12+
cxxflags = "-march=native"
13+
static-libstdcpp = true
14+
ninja = false
15+
download-ci-llvm = false
16+
link-shared = false
17+
# thin-lto = true
18+
19+
[build]
20+
docs = false
21+
extended = false
22+
tools = []
23+
# host = ["wasm32-wasip1-threads", "x86_64-unknown-linux-gnu"]
24+
host = ["wasm32-wasip1-threads"]
25+
target = ["x86_64-unknown-linux-gnu", "wasm32-wasip1-threads"]
26+
# target = ["wasm32-wasip1-threads"]
27+
cargo-native-static = true
28+
29+
[install]
30+
prefix = "dist"
31+
sysconfdir = "etc"
32+
33+
[target.'wasm32-wasip1-threads']
34+
wasi-root = "wasi-sdk-22.0/share/wasi-sysroot"
35+
# linker = "wasi-sdk-22.0/bin/wasm-ld"
36+
linker = "./wrapper_linker_clang.sh"
37+
# codegen-backends = ["cranelift"]
38+
codegen-backends = ["llvm"]
39+
40+
[target.'x86_64-unknown-linux-gnu']
41+
cc = "gcc"

config.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ prefix = "dist"
1919
sysconfdir = "etc"
2020

2121
[target.'wasm32-wasi']
22-
wasi-root = "wasi-sdk-20.0/share/wasi-sysroot"
23-
linker = "wasi-sdk-20.0/bin/clang"
22+
wasi-root = "wasi-sdk-22.0/share/wasi-sysroot"
23+
linker = "wasi-sdk-22.0/bin/clang"
2424
codegen-backends = ["cranelift"]
2525

2626
[target.'wasm32-wasip1-threads']
27-
wasi-root = "wasi-sdk-20.0/share/wasi-sysroot"
28-
linker = "wasi-sdk-20.0/bin/clang"
27+
wasi-root = "wasi-sdk-22.0/share/wasi-sysroot"
28+
linker = "wasi-sdk-22.0/bin/clang"
2929
codegen-backends = ["cranelift"]
3030

3131
[target.'x86_64-unknown-linux-gnu']

src/bootstrap/src/core/build_steps/llvm.rs

+172
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,178 @@ impl Step for Llvm {
501501
return res;
502502
}
503503

504+
if target.contains("wasi") {
505+
let wasi_sysroot = env::var("WASI_SYSROOT").expect("WASI_SYSROOT not set");
506+
let wasi_sdk_path = std::path::Path::new(&wasi_sysroot).join("../../").canonicalize().expect("invalid WASI_SYSROOT");
507+
let wasi_sysroot = format!("--sysroot={wasi_sysroot}");
508+
let wasi_sdk_path = wasi_sdk_path.to_str().expect("invalid WASI_SYSROOT");
509+
let wasi_target = target.triple.to_string();
510+
let wasi_cflags = String::from("");
511+
let wasi_ldflags = String::from("");
512+
let wasi_target_llvm = target.triple.to_string();
513+
let wasi_cflags_llvm = format!("{wasi_cflags} -pthread");
514+
let wasi_ldflags_llvm = wasi_ldflags;
515+
// LLVM has some (unreachable in our configuration) calls to mmap.
516+
let wasi_cflags_llvm = format!("{wasi_cflags_llvm} -D_WASI_EMULATED_MMAN");
517+
let wasi_ldflags_llvm = format!("{wasi_ldflags_llvm} -lwasi-emulated-mman");
518+
// Depending on the code being compiled, both Clang and LLD can consume unbounded amounts of memory.
519+
let wasi_ldflags_llvm = format!("{wasi_ldflags_llvm} -Wl,--max-memory=4294967296");
520+
// Compiling C++ code requires a lot of stack space and can overflow and corrupt the heap.
521+
// (For example, `#include <iostream>` alone does it in a build with the default stack size.)
522+
let wasi_ldflags_llvm = format!("{wasi_ldflags_llvm} -Wl,-z,stack-size=1048576 -Wl,--stack-first");
523+
// Some of the host APIs that are statically required by LLVM (notably threading) are dynamically
524+
// never used. An LTO build removes imports of these APIs, simplifying deployment
525+
let wasi_cflags_llvm = format!("{wasi_cflags_llvm} -flto");
526+
let wasi_ldflags_llvm = format!("{wasi_ldflags_llvm} -flto -Wl,--strip-all");
527+
528+
// We need two toolchain files: one for the compiler itself (which needs threads at the moment since
529+
// -DLLVM_ENABLE_THREADS=OFF is kind of broken), and one for the runtime libs.
530+
cfg.define("WASI", "TRUE")
531+
.define("CMAKE_SYSTEM_NAME", "Generic")
532+
.define("CMAKE_SYSTEM_VERSION", "1")
533+
.define("CMAKE_SYSTEM_PROCESSOR", "wasm32")
534+
.define("CMAKE_EXECUTABLE_SUFFIX", ".wasm")
535+
.define("CMAKE_FIND_ROOT_PATH_MODE_PROGRAM", "NEVER")
536+
.define("CMAKE_FIND_ROOT_PATH_MODE_LIBRARY", "ONLY")
537+
.define("CMAKE_FIND_ROOT_PATH_MODE_INCLUDE", "ONLY")
538+
.define("CMAKE_FIND_ROOT_PATH_MODE_PACKAGE", "ONLY")
539+
.define("CMAKE_C_COMPILER", format!("{wasi_sdk_path}/bin/{wasi_target}-clang"))
540+
.define("CMAKE_CXX_COMPILER", format!("{wasi_sdk_path}/bin/{wasi_target}-clang++"))
541+
.define("CMAKE_LINKER", format!("{wasi_sdk_path}/bin/wasm-ld"))
542+
.define("CMAKE_AR", format!("{wasi_sdk_path}/bin/ar"))
543+
.define("CMAKE_RANLIB", format!("{wasi_sdk_path}/bin/ranlib"))
544+
.define("CMAKE_C_COMPILER_TARGET", &wasi_target_llvm)
545+
.define("CMAKE_CXX_COMPILER_TARGET", &wasi_target_llvm)
546+
.define("CMAKE_C_FLAGS", format!("{wasi_sysroot} {wasi_cflags_llvm}"))
547+
.define("CMAKE_CXX_FLAGS", format!("{wasi_sysroot} {wasi_cflags_llvm}"))
548+
.define("CMAKE_EXE_LINKER_FLAGS", wasi_ldflags_llvm)
549+
.define("LLVM_BUILD_SHARED_LIBS", "OFF")
550+
.define("LLVM_ENABLE_PIC", "OFF")
551+
.define("LLVM_BUILD_STATIC", "ON")
552+
// .define("LLVM_ENABLE_THREADS", "OFF")
553+
.define("LLVM_ENABLE_THREADS", "ON")
554+
.define("LLVM_BUILD_RUNTIME", "OFF")
555+
.define("LLVM_BUILD_TOOLS", "OFF")
556+
.define("LLVM_INCLUDE_UTILS", "OFF")
557+
.define("LLVM_BUILD_UTILS", "OFF")
558+
.define("LLVM_INCLUDE_RUNTIMES", "OFF")
559+
.define("LLVM_INCLUDE_EXAMPLES", "OFF")
560+
.define("LLVM_INCLUDE_TESTS", "OFF")
561+
.define("LLVM_INCLUDE_BENCHMARKS", "OFF")
562+
.define("LLVM_INCLUDE_DOCS", "OFF")
563+
.define("LLVM_TOOL_BUGPOINT_BUILD", "OFF")
564+
.define("LLVM_TOOL_BUGPOINT_PASSES_BUILD", "OFF")
565+
.define("LLVM_TOOL_DSYMUTIL_BUILD", "OFF")
566+
.define("LLVM_TOOL_DXIL_DIS_BUILD", "OFF")
567+
.define("LLVM_TOOL_GOLD_BUILD", "OFF")
568+
.define("LLVM_TOOL_LLC_BUILD", "OFF")
569+
.define("LLVM_TOOL_LLI_BUILD", "OFF")
570+
// .define("LLVM_TOOL_LLVM_AR_BUILD", "ON")
571+
// .define("LLVM_TOOL_LLVM_AS_BUILD", "ON")
572+
.define("LLVM_TOOL_LLVM_AS_FUZZER_BUILD", "OFF")
573+
.define("LLVM_TOOL_LLVM_BCANALYZER_BUILD", "OFF")
574+
.define("LLVM_TOOL_LLVM_CAT_BUILD", "OFF")
575+
.define("LLVM_TOOL_LLVM_CFI_VERIFY_BUILD", "OFF")
576+
.define("LLVM_TOOL_LLVM_CONFIG_BUILD", "OFF")
577+
// .define("LLVM_TOOL_LLVM_COV_BUILD", "ON")
578+
.define("LLVM_TOOL_LLVM_CVTRES_BUILD", "OFF")
579+
.define("LLVM_TOOL_LLVM_CXXDUMP_BUILD", "OFF")
580+
// .define("LLVM_TOOL_LLVM_CXXFILT_BUILD", "ON")
581+
.define("LLVM_TOOL_LLVM_CXXMAP_BUILD", "OFF")
582+
.define("LLVM_TOOL_LLVM_C_TEST_BUILD", "OFF")
583+
.define("LLVM_TOOL_LLVM_DEBUGINFOD_BUILD", "OFF")
584+
.define("LLVM_TOOL_LLVM_DEBUGINFOD_FIND_BUILD", "OFF")
585+
.define("LLVM_TOOL_LLVM_DEBUGINFO_ANALYZER_BUILD", "OFF")
586+
.define("LLVM_TOOL_LLVM_DIFF_BUILD", "OFF")
587+
.define("LLVM_TOOL_LLVM_DIS_BUILD", "OFF")
588+
.define("LLVM_TOOL_LLVM_DIS_FUZZER_BUILD", "OFF")
589+
.define("LLVM_TOOL_LLVM_DLANG_DEMANGLE_FUZZER_BUILD", "OFF")
590+
// .define("LLVM_TOOL_LLVM_DRIVER_BUILD", "ON")
591+
// .define("LLVM_TOOL_LLVM_DWARFDUMP_BUILD", "ON")
592+
.define("LLVM_TOOL_LLVM_DWARFUTIL_BUILD", "OFF")
593+
.define("LLVM_TOOL_LLVM_DWP_BUILD", "OFF")
594+
.define("LLVM_TOOL_LLVM_EXEGESIS_BUILD", "OFF")
595+
.define("LLVM_TOOL_LLVM_EXTRACT_BUILD", "OFF")
596+
.define("LLVM_TOOL_LLVM_GSYMUTIL_BUILD", "OFF")
597+
.define("LLVM_TOOL_LLVM_IFS_BUILD", "OFF")
598+
.define("LLVM_TOOL_LLVM_ISEL_FUZZER_BUILD", "OFF")
599+
.define("LLVM_TOOL_LLVM_ITANIUM_DEMANGLE_FUZZER_BUILD", "OFF")
600+
.define("LLVM_TOOL_LLVM_JITLINK_BUILD", "OFF")
601+
.define("LLVM_TOOL_LLVM_JITLISTENER_BUILD", "OFF")
602+
.define("LLVM_TOOL_LLVM_LIBTOOL_DARWIN_BUILD", "OFF")
603+
.define("LLVM_TOOL_LLVM_LINK_BUILD", "ON")
604+
.define("LLVM_TOOL_LLVM_LIPO_BUILD", "OFF")
605+
.define("LLVM_TOOL_LLVM_LTO2_BUILD", "OFF")
606+
.define("LLVM_TOOL_LLVM_LTO_BUILD", "OFF")
607+
.define("LLVM_TOOL_LLVM_MCA_BUILD", "OFF")
608+
.define("LLVM_TOOL_LLVM_MC_ASSEMBLE_FUZZER_BUILD", "OFF")
609+
.define("LLVM_TOOL_LLVM_MC_BUILD", "OFF")
610+
.define("LLVM_TOOL_LLVM_MC_DISASSEMBLE_FUZZER_BUILD", "OFF")
611+
.define("LLVM_TOOL_LLVM_MICROSOFT_DEMANGLE_FUZZER_BUILD", "OFF")
612+
.define("LLVM_TOOL_LLVM_ML_BUILD", "OFF")
613+
.define("LLVM_TOOL_LLVM_MODEXTRACT_BUILD", "OFF")
614+
.define("LLVM_TOOL_LLVM_MT_BUILD", "OFF")
615+
.define("LLVM_TOOL_LLVM_NM_BUILD", "OFF")
616+
// .define("LLVM_TOOL_LLVM_OBJCOPY_BUILD", "ON")
617+
// .define("LLVM_TOOL_LLVM_OBJDUMP_BUILD", "ON")
618+
.define("LLVM_TOOL_LLVM_OPT_FUZZER_BUILD", "OFF")
619+
.define("LLVM_TOOL_LLVM_OPT_REPORT_BUILD", "OFF")
620+
.define("LLVM_TOOL_LLVM_PDBUTIL_BUILD", "OFF")
621+
.define("LLVM_TOOL_LLVM_PROFDATA_BUILD", "OFF")
622+
.define("LLVM_TOOL_LLVM_PROFGEN_BUILD", "OFF")
623+
.define("LLVM_TOOL_LLVM_RC_BUILD", "OFF")
624+
.define("LLVM_TOOL_LLVM_READOBJ_BUILD", "OFF")
625+
.define("LLVM_TOOL_LLVM_READTAPI_BUILD", "OFF")
626+
.define("LLVM_TOOL_LLVM_REDUCE_BUILD", "OFF")
627+
.define("LLVM_TOOL_LLVM_REMARKUTIL_BUILD", "OFF")
628+
.define("LLVM_TOOL_LLVM_RTDYLD_BUILD", "OFF")
629+
.define("LLVM_TOOL_LLVM_RUST_DEMANGLE_FUZZER_BUILD", "OFF")
630+
.define("LLVM_TOOL_LLVM_SHLIB_BUILD", "OFF")
631+
.define("LLVM_TOOL_LLVM_SIM_BUILD", "OFF")
632+
.define("LLVM_TOOL_LLVM_SIZE_BUILD", "OFF")
633+
.define("LLVM_TOOL_LLVM_SPECIAL_CASE_LIST_FUZZER_BUILD", "OFF")
634+
.define("LLVM_TOOL_LLVM_SPLIT_BUILD", "OFF")
635+
.define("LLVM_TOOL_LLVM_STRESS_BUILD", "OFF")
636+
.define("LLVM_TOOL_LLVM_STRINGS_BUILD", "OFF")
637+
.define("LLVM_TOOL_LLVM_SYMBOLIZER_BUILD", "ON")
638+
.define("LLVM_TOOL_LLVM_TLI_CHECKER_BUILD", "OFF")
639+
.define("LLVM_TOOL_LLVM_UNDNAME_BUILD", "OFF")
640+
.define("LLVM_TOOL_LLVM_XRAY_BUILD", "OFF")
641+
.define("LLVM_TOOL_LLVM_YAML_NUMERIC_PARSER_FUZZER_BUILD", "OFF")
642+
.define("LLVM_TOOL_LLVM_YAML_PARSER_FUZZER_BUILD", "OFF")
643+
.define("LLVM_TOOL_LTO_BUILD", "OFF")
644+
.define("LLVM_TOOL_OBJ2YAML_BUILD", "OFF")
645+
.define("LLVM_TOOL_OPT_BUILD", "OFF")
646+
.define("LLVM_TOOL_OPT_VIEWER_BUILD", "OFF")
647+
.define("LLVM_TOOL_REDUCE_CHUNK_LIST_BUILD", "OFF")
648+
.define("LLVM_TOOL_REMARKS_SHLIB_BUILD", "OFF")
649+
.define("LLVM_TOOL_SANCOV_BUILD", "OFF")
650+
.define("LLVM_TOOL_SANSTATS_BUILD", "OFF")
651+
.define("LLVM_TOOL_SPIRV_TOOLS_BUILD", "OFF")
652+
.define("LLVM_TOOL_VERIFY_USELISTORDER_BUILD", "OFF")
653+
.define("LLVM_TOOL_VFABI_DEMANGLE_FUZZER_BUILD", "OFF")
654+
.define("LLVM_TOOL_XCODE_TOOLCHAIN_BUILD", "OFF")
655+
.define("LLVM_TOOL_YAML2OBJ_BUILD", "OFF")
656+
// .define("LLVM_ENABLE_PROJECTS", "clang;lld")
657+
.define("LLVM_ENABLE_PROJECTS", "")
658+
// .define("CLANG_ENABLE_ARCMT", "OFF")
659+
// .define("CLANG_ENABLE_STATIC_ANALYZER", "OFF")
660+
// .define("CLANG_INCLUDE_TESTS", "OFF")
661+
// .define("CLANG_BUILD_TOOLS", "OFF")
662+
// .define("CLANG_TOOL_CLANG_SCAN_DEPS_BUILD", "OFF")
663+
// .define("CLANG_TOOL_CLANG_INSTALLAPI_BUILD", "OFF")
664+
// .define("CLANG_BUILD_EXAMPLES", "OFF")
665+
// .define("CLANG_INCLUDE_DOCS", "OFF")
666+
// .define("CLANG_LINKS_TO_CREATE", "clang;clang++")
667+
// .define("CLANG_LINKS_TO_CREATE", "")
668+
.define("LLD_BUILD_TOOLS", "OFF")
669+
.define("CMAKE_BUILD_TYPE", "MinSizeRel")
670+
.define("HAVE_DLOPEN", "");
671+
} else {
672+
cfg.define("LLVM_TOOL_LLVM_CONFIG_BUILD", "ON")
673+
.define("LLVM_BUILD_TOOLS", "ON");
674+
}
675+
504676
cfg.build();
505677

506678
// Helper to find the name of LLVM's shared library on darwin and linux.

src/llvm-project

0 commit comments

Comments
 (0)