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) {...@@ -6366,7 +6366,7 @@ LinkLib *add_link_lib(CodeGen *g, Buf *name) {
6366 if (is_libc && g->libc_link_lib != nullptr)6366 if (is_libc && g->libc_link_lib != nullptr)
6367 return g->libc_link_lib;6367 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) {
6370 fprintf(stderr, "TODO linking against libc is currently incompatible with `--cache on`.\n"6370 fprintf(stderr, "TODO linking against libc is currently incompatible with `--cache on`.\n"
6371 "Zig is not yet capable of determining whether the libc installation has changed on subsequent builds.\n");6371 "Zig is not yet capable of determining whether the libc installation has changed on subsequent builds.\n");
6372 exit(1);6372 exit(1);
src/codegen.cpp+2-1
...@@ -178,7 +178,8 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out...@@ -178,7 +178,8 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out
178178
179 // On Darwin/MacOS/iOS, we always link libSystem which contains libc.179 // On Darwin/MacOS/iOS, we always link libSystem which contains libc.
180 if (g->zig_target.os == OsMacOSX ||180 if (g->zig_target.os == OsMacOSX ||
181 g->zig_target.os == OsIOS)181 g->zig_target.os == OsIOS ||
182 g->zig_target.os == OsFreeBSD)
182 {183 {
183 g->libc_link_lib = create_link_lib(buf_create_from_str("c"));184 g->libc_link_lib = create_link_lib(buf_create_from_str("c"));
184 g->link_libs_list.append(g->libc_link_lib);185 g->link_libs_list.append(g->libc_link_lib);
std/special/bootstrap.zig+4-11
...@@ -20,17 +20,10 @@ comptime {...@@ -20,17 +20,10 @@ comptime {
2020
21nakedcc fn _start() noreturn {21nakedcc fn _start() noreturn {
22 switch (builtin.arch) {22 switch (builtin.arch) {
23 builtin.Arch.x86_64 => switch (builtin.os) {23 builtin.Arch.x86_64 => {
24 builtin.Os.freebsd => {24 argc_ptr = asm ("lea (%%rsp), %[argc]"
25 argc_ptr = asm ("lea (%%rdi), %[argc]"25 : [argc] "=r" (-> [*]usize)
26 : [argc] "=r" (-> [*]usize)26 );
27 );
28 },
29 else => {
30 argc_ptr = asm ("lea (%%rsp), %[argc]"
31 : [argc] "=r" (-> [*]usize)
32 );
33 },
34 },27 },
35 builtin.Arch.i386 => {28 builtin.Arch.i386 => {
36 argc_ptr = asm ("lea (%%esp), %[argc]"29 argc_ptr = asm ("lea (%%esp), %[argc]"