mirror of
https://github.com/ziglang/zig.git
synced 2026-02-17 14:59:14 +00:00
freebsd: link against libc
Since the stable kernel ABI is through libc #1759
This commit is contained in:
parent
0273fbf710
commit
1fc56b82ad
@ -6366,7 +6366,7 @@ LinkLib *add_link_lib(CodeGen *g, Buf *name) {
|
||||
if (is_libc && g->libc_link_lib != nullptr)
|
||||
return g->libc_link_lib;
|
||||
|
||||
if (g->enable_cache && is_libc && g->zig_target.os != OsMacOSX && g->zig_target.os != OsIOS) {
|
||||
if (g->enable_cache && is_libc && g->zig_target.os != OsMacOSX && g->zig_target.os != OsIOS && g->zig_target.os != OsFreeBSD) {
|
||||
fprintf(stderr, "TODO linking against libc is currently incompatible with `--cache on`.\n"
|
||||
"Zig is not yet capable of determining whether the libc installation has changed on subsequent builds.\n");
|
||||
exit(1);
|
||||
|
||||
@ -178,7 +178,8 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out
|
||||
|
||||
// On Darwin/MacOS/iOS, we always link libSystem which contains libc.
|
||||
if (g->zig_target.os == OsMacOSX ||
|
||||
g->zig_target.os == OsIOS)
|
||||
g->zig_target.os == OsIOS ||
|
||||
g->zig_target.os == OsFreeBSD)
|
||||
{
|
||||
g->libc_link_lib = create_link_lib(buf_create_from_str("c"));
|
||||
g->link_libs_list.append(g->libc_link_lib);
|
||||
|
||||
@ -20,17 +20,10 @@ comptime {
|
||||
|
||||
nakedcc fn _start() noreturn {
|
||||
switch (builtin.arch) {
|
||||
builtin.Arch.x86_64 => switch (builtin.os) {
|
||||
builtin.Os.freebsd => {
|
||||
argc_ptr = asm ("lea (%%rdi), %[argc]"
|
||||
: [argc] "=r" (-> [*]usize)
|
||||
);
|
||||
},
|
||||
else => {
|
||||
argc_ptr = asm ("lea (%%rsp), %[argc]"
|
||||
: [argc] "=r" (-> [*]usize)
|
||||
);
|
||||
},
|
||||
builtin.Arch.x86_64 => {
|
||||
argc_ptr = asm ("lea (%%rsp), %[argc]"
|
||||
: [argc] "=r" (-> [*]usize)
|
||||
);
|
||||
},
|
||||
builtin.Arch.i386 => {
|
||||
argc_ptr = asm ("lea (%%esp), %[argc]"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user