mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
parent
ff2c794612
commit
5fd579a51c
@ -12,7 +12,4 @@ cd build
|
||||
cmake .. -DCMAKE_PREFIX_PATH=$PREFIX_DIR -DCMAKE_INSTALL_PREFIX=$(pwd) -DZIG_LIBC_LIB_DIR=$(dirname $($CC -print-file-name=crt1.o)) -DZIG_LIBC_INCLUDE_DIR=$(echo -n | $CC -E -x c - -v 2>&1 | grep -B1 "End of search list." | head -n1 | cut -c 2- | sed "s/ .*//") -DZIG_LIBC_STATIC_LIB_DIR=$(dirname $($CC -print-file-name=crtbegin.o))
|
||||
make VERBOSE=1
|
||||
make install
|
||||
# TODO get full test suite passing on macos
|
||||
./zig test ../test/behavior.zig
|
||||
./zig test ../test/behavior.zig --release-fast
|
||||
# ./zig build --build-file ../build.zig test
|
||||
./zig build --build-file ../build.zig test-behavior test-std test-compiler-rt test-compare-output test-compile-errors test-asm-link test-debug-safety test-parseh
|
||||
|
@ -1968,7 +1968,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) {
|
||||
if (buf_eql_str(&fn_table_entry->symbol_name, "main")) {
|
||||
g->main_fn = fn_table_entry;
|
||||
|
||||
if (g->libc_link_lib == nullptr && tld_fn->base.visib_mod != VisibModExport) {
|
||||
if (tld_fn->base.visib_mod != VisibModExport) {
|
||||
TypeTableEntry *err_void = get_error_type(g, g->builtin_types.entry_void);
|
||||
TypeTableEntry *actual_return_type = fn_table_entry->type_entry->data.fn.fn_type_id.return_type;
|
||||
if (actual_return_type != err_void) {
|
||||
|
@ -36,3 +36,4 @@ pub extern "c" fn execve(path: &const u8, argv: &const ?&const u8,
|
||||
envp: &const ?&const u8) -> c_int;
|
||||
pub extern "c" fn dup(fd: c_int) -> c_int;
|
||||
pub extern "c" fn dup2(old_fd: c_int, new_fd: c_int) -> c_int;
|
||||
pub extern "c" fn readlink(noalias path: &const u8, noalias buf: &u8, bufsize: usize) -> isize;
|
||||
|
@ -23,6 +23,7 @@ pub const MAP_NORESERVE = 0x0040; /// don't reserve needed swap area
|
||||
pub const MAP_FAILED = @maxValue(usize);
|
||||
|
||||
pub const O_LARGEFILE = 0x0000;
|
||||
pub const O_PATH = 0x0000;
|
||||
|
||||
pub const O_RDONLY = 0x0000; /// open for reading only
|
||||
pub const O_WRONLY = 0x0001; /// open for writing only
|
||||
@ -198,6 +199,10 @@ pub fn dup2(old: i32, new: i32) -> usize {
|
||||
errnoWrap(c.dup2(old, new))
|
||||
}
|
||||
|
||||
pub fn readlink(noalias path: &const u8, noalias buf_ptr: &u8, buf_len: usize) -> usize {
|
||||
errnoWrap(c.readlink(path, buf_ptr, buf_len))
|
||||
}
|
||||
|
||||
/// Takes the return value from a syscall and formats it back in the way
|
||||
/// that the kernel represents it to libc. Errno was a mistake, let's make
|
||||
/// it go away forever.
|
||||
|
@ -1,6 +1,9 @@
|
||||
const udivmod = @import("udivmod.zig").udivmod;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
export fn __udivmoddi4(a: u64, b: u64, maybe_rem: ?&u64) -> u64 {
|
||||
@setDebugSafety(this, builtin.is_test);
|
||||
@setGlobalLinkage(__udivmoddi4, builtin.GlobalLinkage.LinkOnce);
|
||||
return udivmod(u64, a, b, maybe_rem);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
const udivmod = @import("udivmod.zig").udivmod;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
export fn __udivmodti4(a: u128, b: u128, maybe_rem: ?&u128) -> u128 {
|
||||
@setDebugSafety(this, builtin.is_test);
|
||||
@setGlobalLinkage(__udivmodti4, builtin.GlobalLinkage.LinkOnce);
|
||||
return udivmod(u128, a, b, maybe_rem);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
const __udivmodti4 = @import("udivmodti4.zig").__udivmodti4;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
export fn __udivti3(a: u128, b: u128) -> u128 {
|
||||
@setDebugSafety(this, builtin.is_test);
|
||||
@setGlobalLinkage(__udivti3, builtin.GlobalLinkage.LinkOnce);
|
||||
return __udivmodti4(a, b, null);
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
const __udivmodti4 = @import("udivmodti4.zig").__udivmodti4;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
export fn __umodti3(a: u128, b: u128) -> u128 {
|
||||
@setDebugSafety(this, builtin.is_test);
|
||||
@setGlobalLinkage(__umodti3, builtin.GlobalLinkage.LinkOnce);
|
||||
var r: u128 = undefined;
|
||||
_ = __udivmodti4(a, b, &r);
|
||||
return r;
|
||||
|
Loading…
Reference in New Issue
Block a user