diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-01-06 06:40:25 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-01-06 06:40:25 -0700 |
| commit | 5f0bfcac24036e1fff0b2beda643a60dad465213 (patch) | |
| tree | 7576c1acb2245b119c2b8b985cc3b8e2be9845d4 /std/std.zig | |
| parent | 5e64c4d92f109638111d78b6ab97feb645ee0a01 (diff) | |
| download | zig-5f0bfcac24036e1fff0b2beda643a60dad465213.tar.gz zig-5f0bfcac24036e1fff0b2beda643a60dad465213.zip | |
fix undefined reference to memcpy in release mode
when not depending on libc, we generate memcpy and memset
implementations.
Diffstat (limited to 'std/std.zig')
| -rw-r--r-- | std/std.zig | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/std/std.zig b/std/std.zig index ad6acea51d..a53dbb6027 100644 --- a/std/std.zig +++ b/std/std.zig @@ -1,33 +1,4 @@ -const SYS_write : usize = 1; -const SYS_exit : usize = 60; -const SYS_getrandom : usize = 318; - -fn syscall1(number: usize, arg1: usize) -> usize { - asm volatile ("syscall" - : [ret] "={rax}" (-> usize) - : [number] "{rax}" (number), [arg1] "{rdi}" (arg1) - : "rcx", "r11") -} - -fn syscall3(number: usize, arg1: usize, arg2: usize, arg3: usize) -> usize { - asm volatile ("syscall" - : [ret] "={rax}" (-> usize) - : [number] "{rax}" (number), [arg1] "{rdi}" (arg1), [arg2] "{rsi}" (arg2), [arg3] "{rdx}" (arg3) - : "rcx", "r11") -} - -pub fn write(fd: isize, buf: &const u8, count: usize) -> isize { - syscall3(SYS_write, fd as usize, buf as usize, count) as isize -} - -pub fn exit(status: i32) -> unreachable { - syscall1(SYS_exit, status as usize); - unreachable -} - -pub fn getrandom(buf: &u8, count: usize, flags: u32) -> isize { - syscall3(SYS_getrandom, buf as usize, count, flags as usize) as isize -} +use "syscall.zig"; const stdout_fileno : isize = 1; const stderr_fileno : isize = 2; |
