authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-08-27 05:44:03-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-08-27 05:44:03-04:00
log5fd579a51c44c31b99cf34d9e8ada3b7692b4c43
tree635d1974a3e7f3de08c9ff20298a2d954adaad08
parentff2c7946128fac8488e393655e1a3371983b7620

macos passing all tests except for building a shared library

see #273

8 files changed, 20 insertions(+), 5 deletions(-)

ci/travis_osx_script+1-4
......@@ -12,7 +12,4 @@ cd build
1212cmake .. -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))
1313make VERBOSE=1
1414make install
15# TODO get full test suite passing on macos
16./zig test ../test/behavior.zig
17./zig test ../test/behavior.zig --release-fast
18# ./zig build --build-file ../build.zig test
15./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
src/analyze.cpp+1-1
......@@ -1968,7 +1968,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) {
19681968 if (buf_eql_str(&fn_table_entry->symbol_name, "main")) {
19691969 g->main_fn = fn_table_entry;
19701970
1971 if (g->libc_link_lib == nullptr && tld_fn->base.visib_mod != VisibModExport) {
1971 if (tld_fn->base.visib_mod != VisibModExport) {
19721972 TypeTableEntry *err_void = get_error_type(g, g->builtin_types.entry_void);
19731973 TypeTableEntry *actual_return_type = fn_table_entry->type_entry->data.fn.fn_type_id.return_type;
19741974 if (actual_return_type != err_void) {
std/c/index.zig+1
......@@ -36,3 +36,4 @@ pub extern "c" fn execve(path: &const u8, argv: &const ?&const u8,
3636 envp: &const ?&const u8) -> c_int;
3737pub extern "c" fn dup(fd: c_int) -> c_int;
3838pub extern "c" fn dup2(old_fd: c_int, new_fd: c_int) -> c_int;
39pub extern "c" fn readlink(noalias path: &const u8, noalias buf: &u8, bufsize: usize) -> isize;
std/os/darwin.zig+5
......@@ -23,6 +23,7 @@ pub const MAP_NORESERVE = 0x0040; /// don't reserve needed swap area
2323pub const MAP_FAILED = @maxValue(usize);
2424
2525pub const O_LARGEFILE = 0x0000;
26pub const O_PATH = 0x0000;
2627
2728pub const O_RDONLY = 0x0000; /// open for reading only
2829pub const O_WRONLY = 0x0001; /// open for writing only
......@@ -198,6 +199,10 @@ pub fn dup2(old: i32, new: i32) -> usize {
198199 errnoWrap(c.dup2(old, new))
199200}
200201
202pub fn readlink(noalias path: &const u8, noalias buf_ptr: &u8, buf_len: usize) -> usize {
203 errnoWrap(c.readlink(path, buf_ptr, buf_len))
204}
205
201206/// Takes the return value from a syscall and formats it back in the way
202207/// that the kernel represents it to libc. Errno was a mistake, let's make
203208/// it go away forever.
std/special/compiler_rt/udivmoddi4.zig+3
......@@ -1,6 +1,9 @@
11const udivmod = @import("udivmod.zig").udivmod;
2const builtin = @import("builtin");
23
34export fn __udivmoddi4(a: u64, b: u64, maybe_rem: ?&u64) -> u64 {
5 @setDebugSafety(this, builtin.is_test);
6 @setGlobalLinkage(__udivmoddi4, builtin.GlobalLinkage.LinkOnce);
47 return udivmod(u64, a, b, maybe_rem);
58}
69
std/special/compiler_rt/udivmodti4.zig+3
......@@ -1,6 +1,9 @@
11const udivmod = @import("udivmod.zig").udivmod;
2const builtin = @import("builtin");
23
34export fn __udivmodti4(a: u128, b: u128, maybe_rem: ?&u128) -> u128 {
5 @setDebugSafety(this, builtin.is_test);
6 @setGlobalLinkage(__udivmodti4, builtin.GlobalLinkage.LinkOnce);
47 return udivmod(u128, a, b, maybe_rem);
58}
69
std/special/compiler_rt/udivti3.zig+3
......@@ -1,5 +1,8 @@
11const __udivmodti4 = @import("udivmodti4.zig").__udivmodti4;
2const builtin = @import("builtin");
23
34export fn __udivti3(a: u128, b: u128) -> u128 {
5 @setDebugSafety(this, builtin.is_test);
6 @setGlobalLinkage(__udivti3, builtin.GlobalLinkage.LinkOnce);
47 return __udivmodti4(a, b, null);
58}
std/special/compiler_rt/umodti3.zig+3
......@@ -1,6 +1,9 @@
11const __udivmodti4 = @import("udivmodti4.zig").__udivmodti4;
2const builtin = @import("builtin");
23
34export fn __umodti3(a: u128, b: u128) -> u128 {
5 @setDebugSafety(this, builtin.is_test);
6 @setGlobalLinkage(__umodti3, builtin.GlobalLinkage.LinkOnce);
47 var r: u128 = undefined;
58 _ = __udivmodti4(a, b, &r);
69 return r;