link in the prelude object
This commit is contained in:
1 parent
559a4275ba
commit
e20030fbc3
4 files changed
+60
-19
No files matched your search
+17
-10
@@ -20,24 +20,31 @@ fn main() {
|
||||
}
|
||||
|
||||
fn emit_link_args() {
|
||||
println!("cargo::rustc-link-arg=-Tlink.ld");
|
||||
let linker_script_path = "link.ld";
|
||||
println!("cargo::rustc-link-arg=-T{}", linker_script_path);
|
||||
rerun_if_changed(linker_script_path.as_ref());
|
||||
}
|
||||
|
||||
fn rerun_if_changed(path: &Path) {
|
||||
if let Some(path_str) = path.to_str() {
|
||||
println!("cargo::rerun-if-changed={}", path_str);
|
||||
}
|
||||
else {
|
||||
eprintln!("invalid unicode file path");
|
||||
}
|
||||
let path_str = path.to_str()
|
||||
.expect("expected path to be valid utf8");
|
||||
println!("cargo::rerun-if-changed={}", path_str);
|
||||
}
|
||||
|
||||
fn link_obj(path: &Path) {
|
||||
let path_str = path.to_str()
|
||||
.expect("expected path to be valid utf8");
|
||||
println!("cargo::rustc-link-arg={}", path_str);
|
||||
}
|
||||
|
||||
fn build_asm(nasm: &Nasm, out_dir: &Path) {
|
||||
let prelude_obj_path = out_dir.join("prelude.o");
|
||||
nasm.assemble(
|
||||
&out_dir.join("prelude.bin"),
|
||||
&prelude_obj_path,
|
||||
&["asm/prelude.s".as_ref()],
|
||||
&["../include".as_ref()],
|
||||
).unwrap();
|
||||
link_obj(&prelude_obj_path);
|
||||
}
|
||||
|
||||
struct Nasm {
|
||||
@@ -57,9 +64,9 @@ impl Nasm {
|
||||
|
||||
let mut cmd = Command::new(&self.bin_path);
|
||||
cmd
|
||||
.arg("-Werror")
|
||||
.arg("-f")
|
||||
.arg("bin")
|
||||
.arg("-Werror");
|
||||
.arg("elf");
|
||||
|
||||
for include in includes {
|
||||
let mut buf = OsString::new();
|
||||
|
||||
Reference in new issue
Block a user