Use rust-analyzer for riscv64 and loongarch64 target
This commit is contained in:
parent
f8e4aefcca
commit
3b0666449f
|
|
@ -12,6 +12,10 @@
|
||||||
"kernel/Cargo.toml",
|
"kernel/Cargo.toml",
|
||||||
"--target",
|
"--target",
|
||||||
"x86_64-unknown-none",
|
"x86_64-unknown-none",
|
||||||
|
"--target",
|
||||||
|
"riscv64imac-unknown-none-elf",
|
||||||
|
"--target",
|
||||||
|
"loongarch64-unknown-none-softfloat",
|
||||||
"-Zbuild-std=core,alloc,compiler_builtins",
|
"-Zbuild-std=core,alloc,compiler_builtins",
|
||||||
"-Zbuild-std-features=compiler-builtins-mem"
|
"-Zbuild-std-features=compiler-builtins-mem"
|
||||||
],
|
],
|
||||||
|
|
@ -30,4 +34,4 @@
|
||||||
"**/CVS": false,
|
"**/CVS": false,
|
||||||
"**/Thumbs.db": false
|
"**/Thumbs.db": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,23 +7,27 @@ fn main() {
|
||||||
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
||||||
|
|
||||||
let target_arch = std::env::var("TARGET").unwrap();
|
let target_arch = std::env::var("TARGET").unwrap();
|
||||||
let lds = source_dir.join("src/x86/linker.ld");
|
if target_arch.starts_with("x86_64") {
|
||||||
let def = match target_arch.as_str() {
|
let lds = source_dir.join("src/x86/linker.ld");
|
||||||
"x86_64-unknown-none" => "-DCFG_TARGET_ARCH_X86_64=1",
|
let def = match target_arch.as_str() {
|
||||||
"x86_64-i386_pm-none" => "-DCFG_TARGET_ARCH_X86_64=0",
|
"x86_64-unknown-none" => "-DCFG_TARGET_ARCH_X86_64=1",
|
||||||
other => panic!("unsupported target: {}", other),
|
"x86_64-i386_pm-none" => "-DCFG_TARGET_ARCH_X86_64=0",
|
||||||
};
|
other => panic!("unsupported x86_64 target: {}", other),
|
||||||
|
};
|
||||||
|
|
||||||
let out_lds = out_dir.join("linker.ld");
|
let out_lds = out_dir.join("linker.ld");
|
||||||
let status = Command::new("cpp")
|
let status = Command::new("cpp")
|
||||||
.arg("-o")
|
.arg("-o")
|
||||||
.arg(&out_lds)
|
.arg(&out_lds)
|
||||||
.arg(def)
|
.arg(def)
|
||||||
.arg(&lds)
|
.arg(&lds)
|
||||||
.status()
|
.status()
|
||||||
.expect("failed to run the preprocessor");
|
.expect("failed to run the preprocessor");
|
||||||
assert!(status.success(), "the preprocessor exits with failure");
|
assert!(status.success(), "the preprocessor exits with failure");
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed={}", lds.display());
|
println!("cargo:rerun-if-changed={}", lds.display());
|
||||||
println!("cargo:rustc-link-arg=-T{}", out_lds.display());
|
println!("cargo:rustc-link-arg=-T{}", out_lds.display());
|
||||||
|
} else {
|
||||||
|
println!("cargo:warning=Unsupported target: {}", target_arch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue