authorgravatar for i@mgxm.meMarcio Giaxa <i@mgxm.me> 2018-12-18 00:19:20-02:00
committergravatar for i@mgxm.meMarcio Giaxa <i@mgxm.me> 2018-12-19 18:42:00-02:00
log1fc56b82ad6f1060ec4b2074c16accfe0327a4b7
tree612f85682f05eb5296be5013f6e88769ee8c1215
parent0273fbf710f98854f3331c0810cd2f31f20d2fb5

freebsd: link against libc

Since the stable kernel ABI is through libc #1759

3 files changed, 7 insertions(+), 13 deletions(-)

src/analyze.cpp+1-1
......@@ -6366,7 +6366,7 @@ LinkLib *add_link_lib(CodeGen *g, Buf *name) {
63666366 if (is_libc && g->libc_link_lib != nullptr)
63676367 return g->libc_link_lib;
63686368
6369 if (g->enable_cache && is_libc && g->zig_target.os != OsMacOSX && g->zig_target.os != OsIOS) {
6369 if (g->enable_cache && is_libc && g->zig_target.os != OsMacOSX && g->zig_target.os != OsIOS && g->zig_target.os != OsFreeBSD) {
63706370 fprintf(stderr, "TODO linking against libc is currently incompatible with `--cache on`.\n"
63716371 "Zig is not yet capable of determining whether the libc installation has changed on subsequent builds.\n");
63726372 exit(1);
src/codegen.cpp+2-1
......@@ -178,7 +178,8 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out
178178
179179 // On Darwin/MacOS/iOS, we always link libSystem which contains libc.
180180 if (g->zig_target.os == OsMacOSX ||
181 g->zig_target.os == OsIOS)
181 g->zig_target.os == OsIOS ||
182 g->zig_target.os == OsFreeBSD)
182183 {
183184 g->libc_link_lib = create_link_lib(buf_create_from_str("c"));
184185 g->link_libs_list.append(g->libc_link_lib);
std/special/bootstrap.zig+4-11
......@@ -20,17 +20,10 @@ comptime {
2020
2121nakedcc fn _start() noreturn {
2222 switch (builtin.arch) {
23 builtin.Arch.x86_64 => switch (builtin.os) {
24 builtin.Os.freebsd => {
25 argc_ptr = asm ("lea (%%rdi), %[argc]"
26 : [argc] "=r" (-> [*]usize)
27 );
28 },
29 else => {
30 argc_ptr = asm ("lea (%%rsp), %[argc]"
31 : [argc] "=r" (-> [*]usize)
32 );
33 },
23 builtin.Arch.x86_64 => {
24 argc_ptr = asm ("lea (%%rsp), %[argc]"
25 : [argc] "=r" (-> [*]usize)
26 );
3427 },
3528 builtin.Arch.i386 => {
3629 argc_ptr = asm ("lea (%%esp), %[argc]"