Skip to content

Commit

Permalink
use int instead if long long for libc exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
simvux committed Oct 1, 2024
1 parent 96bb16d commit 6167176
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lumina-compiler/src/backend/cranelift/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl<'a> Context<'a> {
AbiParam::new(types::I32), // argc
AbiParam::new(self.isa.pointer_type()), // **argv
];
builder.func.signature.returns = vec![AbiParam::new(types::I64)]; // exit code
builder.func.signature.returns = vec![AbiParam::new(types::I32)]; // exit code
builder.append_block_params_for_function_params(entryblock);
let id = self
.objmodule
Expand All @@ -270,7 +270,7 @@ impl<'a> Context<'a> {
// Call the lumina main function
builder.ins().call(lumina_main, &[]);

let exit_code = builder.ins().iconst(types::I64, 0);
let exit_code = builder.ins().iconst(types::I32, 0);
builder.ins().return_(&[exit_code]);

info!("main:\n{}", builder.func);
Expand Down
2 changes: 1 addition & 1 deletion luminapath/std/libc/lib.lm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn errno_location as *i32
pub fn getenv as *u8 -> *u8

@[extern "exit", platform ["linux-gnu", "linux-musl"]]
pub fn exit code as int -> ()
pub fn exit code as i32 -> ()

@[extern "write", platform ["linux-gnu", "linux-musl"]]
pub fn write as i32, *u8, int -> int
Expand Down

0 comments on commit 6167176

Please sign in to comment.