From 5f0bfcac24036e1fff0b2beda643a60dad465213 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 6 Jan 2016 06:40:25 -0700 Subject: fix undefined reference to memcpy in release mode when not depending on libc, we generate memcpy and memset implementations. --- std/std.zig | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'std/std.zig') 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; -- cgit v1.2.3