diff --git a/ci/travis_osx_script b/ci/travis_osx_script index 316c96e4cd..d29a52db9d 100755 --- a/ci/travis_osx_script +++ b/ci/travis_osx_script @@ -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 diff --git a/src/analyze.cpp b/src/analyze.cpp index 82ae972cbf..8275906764 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -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) { diff --git a/std/c/index.zig b/std/c/index.zig index 60b0044db9..1aab8177b9 100644 --- a/std/c/index.zig +++ b/std/c/index.zig @@ -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; diff --git a/std/os/darwin.zig b/std/os/darwin.zig index 708078cdda..b33755c438 100644 --- a/std/os/darwin.zig +++ b/std/os/darwin.zig @@ -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. diff --git a/std/special/compiler_rt/udivmoddi4.zig b/std/special/compiler_rt/udivmoddi4.zig index 23ed5420cb..d6e4c2e01e 100644 --- a/std/special/compiler_rt/udivmoddi4.zig +++ b/std/special/compiler_rt/udivmoddi4.zig @@ -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); } diff --git a/std/special/compiler_rt/udivmodti4.zig b/std/special/compiler_rt/udivmodti4.zig index 8048362bc5..70c023d693 100644 --- a/std/special/compiler_rt/udivmodti4.zig +++ b/std/special/compiler_rt/udivmodti4.zig @@ -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); } diff --git a/std/special/compiler_rt/udivti3.zig b/std/special/compiler_rt/udivti3.zig index 38f297e925..fe388c7870 100644 --- a/std/special/compiler_rt/udivti3.zig +++ b/std/special/compiler_rt/udivti3.zig @@ -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); } diff --git a/std/special/compiler_rt/umodti3.zig b/std/special/compiler_rt/umodti3.zig index 9c0da86447..e868f0e1fd 100644 --- a/std/special/compiler_rt/umodti3.zig +++ b/std/special/compiler_rt/umodti3.zig @@ -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;