From bc10382ec1b87da16943907ba2d0fbd267af07f0 Mon Sep 17 00:00:00 2001 From: Maya Rashish Date: Sat, 16 Feb 2019 12:29:12 +0200 Subject: Add NetBSD support Mostly picking the same paths as FreeBSD. We need a little special handling for crt files, as netbsd uses its own (and not GCC's) for those, with slightly different names. --- src/link.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/link.cpp') diff --git a/src/link.cpp b/src/link.cpp index 58221a99ea..956e5b6bfc 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -198,6 +198,9 @@ static Buf *get_dynamic_linker_path(CodeGen *g) { if (g->zig_target.os == OsFreeBSD) { return buf_create_from_str("/libexec/ld-elf.so.1"); } + if (g->zig_target.os == OsNetBSD) { + return buf_create_from_str("/libexec/ld.elf_so"); + } if (g->is_native_target && g->zig_target.arch.arch == ZigLLVM_x86_64) { static const char *ld_names[] = { "ld-linux-x86-64.so.2", @@ -263,10 +266,13 @@ static void construct_linker_job_elf(LinkJob *lj) { if (lj->link_in_crt) { const char *crt1o; const char *crtbegino; - if (g->is_static) { + if (g->zig_target.os == OsNetBSD) { + crt1o = "crt0.o"; + crtbegino = "crtbegin.o"; + } else if (g->is_static) { crt1o = "crt1.o"; crtbegino = "crtbeginT.o"; - } else { + } else { crt1o = "Scrt1.o"; crtbegino = "crtbegin.o"; } -- cgit v1.2.3