|
@@ -7,6 +7,18 @@ fn read_dependent_script(script: &str) -> Result<String, Box<dyn std::error::Err
|
|
|
Ok(content)
|
|
Ok(content)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+fn process_ldscript_riscv64(script: &mut String) -> Result<(), Box<dyn std::error::Error>> {
|
|
|
|
|
+ println!("cargo:extra-link-args= --no-check-sections");
|
|
|
|
|
+
|
|
|
|
|
+ let memory = read_dependent_script("src/arch/riscv64/memory.x")?;
|
|
|
|
|
+ let link = read_dependent_script("src/arch/riscv64/link.x")?;
|
|
|
|
|
+
|
|
|
|
|
+ *script = memory + script;
|
|
|
|
|
+ script.push_str(&link);
|
|
|
|
|
+
|
|
|
|
|
+ Ok(())
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
fn process_ldscript_x86(script: &mut String) -> Result<(), Box<dyn std::error::Error>> {
|
|
fn process_ldscript_x86(script: &mut String) -> Result<(), Box<dyn std::error::Error>> {
|
|
|
// Otherwise `bootstrap.rs` might be ignored and not linked in.
|
|
// Otherwise `bootstrap.rs` might be ignored and not linked in.
|
|
|
println!("cargo:extra-link-args=--undefined=move_mbr --no-check-sections");
|
|
println!("cargo:extra-link-args=--undefined=move_mbr --no-check-sections");
|
|
@@ -28,6 +40,9 @@ fn process_ldscript_arch(
|
|
|
"x86_64" => {
|
|
"x86_64" => {
|
|
|
process_ldscript_x86(script)?;
|
|
process_ldscript_x86(script)?;
|
|
|
}
|
|
}
|
|
|
|
|
+ "riscv64" => {
|
|
|
|
|
+ process_ldscript_riscv64(script)?;
|
|
|
|
|
+ }
|
|
|
_ => panic!("Unsupported architecture: {}", arch),
|
|
_ => panic!("Unsupported architecture: {}", arch),
|
|
|
}
|
|
}
|
|
|
|
|
|