1
0
forked from Rust/Core

NASM to FASM

This commit is contained in:
Gleb Zaharov 2023-06-19 22:47:51 +03:00
parent 76ac2daa98
commit b7031863c2
2 changed files with 25 additions and 11 deletions

View File

@ -1,5 +1,19 @@
use std::{process::Command, env};
fn main() {
println!("cargo:rerun-if-changed=src/syscalls.S");
nasm_rs::compile_library_args("libsyscalls.a", &["src/syscalls.S"], &["-f elf32"])
.expect("failed to compile assembly");
let out_dir = env::var("OUT_DIR").unwrap();
Command::new("fasm")
.arg("src/syscalls.S")
.arg(&format!("{}/libsyscalls.a", out_dir))
.status().unwrap();
Command::new("ar")
.arg("crus")
.arg(&format!("{}/libsyscalls.a", out_dir))
.arg(&format!("{}/libsyscalls.o", out_dir))
.status().unwrap();
println!("cargo:rustc-link-search={}", out_dir)
}

View File

@ -1,13 +1,13 @@
BITS 32
format ELF
section .text
global _exit
global _start_window_draw
global _end_window_draw
global _define_window
global _display_message
global _wait_event
global _pressed_key
section '.text'
public _exit
public _start_window_draw
public _end_window_draw
public _define_window
public _display_message
public _wait_event
public _pressed_key
_exit:
mov eax, -1