zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 7cd6c25c8fd21bc984814b7051e7fea6fe446cfb (tree)
parent 8a2ab60fca405d97d2d86456c92db1e5606622e4
Author: Sebastien Marie <semarie@users.noreply.github.com>
Date:   Tue, 15 Dec 2020 20:45:48 +0100

openbsd: link with required system libraries (#7380)

* openbsd: use -lpthread when linking

and while compiling zig stage2, use c++ and c++abi too

Diffstat:
Mbuild.zig | 3+++
Msrc/link/Elf.zig | 2+-
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/build.zig b/build.zig @@ -168,6 +168,9 @@ pub fn build(b: *Builder) !void { } else if (exe.target.isFreeBSD()) { try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes); exe.linkSystemLibrary("pthread"); + } else if (exe.target.getOsTag() == .openbsd) { + try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes); + try addCxxKnownPath(b, cfg, exe, "libc++abi.a", null, need_cpp_includes); } else if (exe.target.isDarwin()) { if (addCxxKnownPath(b, cfg, exe, "libgcc_eh.a", "", need_cpp_includes)) { // Compiler is GCC. diff --git a/src/link/Elf.zig b/src/link/Elf.zig @@ -1584,7 +1584,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { try argv.append("-lm"); } - if (target.os.tag == .freebsd or target.os.tag == .netbsd) { + if (target.os.tag == .freebsd or target.os.tag == .netbsd or target.os.tag == .openbsd) { try argv.append("-lpthread"); } } else if (target.isGnuLibC()) {