authorgravatar for semarie@users.noreply.github.comSebastien Marie <semarie@users.noreply.github.com> 2020-12-15 20:45:48+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-12-15 14:45:48-05:00
log7cd6c25c8fd21bc984814b7051e7fea6fe446cfb
tree3cb22838007e304499b0d428f46f1e08f2d63003
parent8a2ab60fca405d97d2d86456c92db1e5606622e4
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

openbsd: link with required system libraries (#7380)

* openbsd: use -lpthread when linking and while compiling zig stage2, use c++ and c++abi too

2 files changed, 4 insertions(+), 1 deletions(-)

build.zig+3
...@@ -168,6 +168,9 @@ pub fn build(b: *Builder) !void {...@@ -168,6 +168,9 @@ pub fn build(b: *Builder) !void {
168 } else if (exe.target.isFreeBSD()) {168 } else if (exe.target.isFreeBSD()) {
169 try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes);169 try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes);
170 exe.linkSystemLibrary("pthread");170 exe.linkSystemLibrary("pthread");
171 } else if (exe.target.getOsTag() == .openbsd) {
172 try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes);
173 try addCxxKnownPath(b, cfg, exe, "libc++abi.a", null, need_cpp_includes);
171 } else if (exe.target.isDarwin()) {174 } else if (exe.target.isDarwin()) {
172 if (addCxxKnownPath(b, cfg, exe, "libgcc_eh.a", "", need_cpp_includes)) {175 if (addCxxKnownPath(b, cfg, exe, "libgcc_eh.a", "", need_cpp_includes)) {
173 // Compiler is GCC.176 // Compiler is GCC.
src/link/Elf.zig+1-1
...@@ -1584,7 +1584,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {...@@ -1584,7 +1584,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
1584 try argv.append("-lm");1584 try argv.append("-lm");
1585 }1585 }
15861586
1587 if (target.os.tag == .freebsd or target.os.tag == .netbsd) {1587 if (target.os.tag == .freebsd or target.os.tag == .netbsd or target.os.tag == .openbsd) {
1588 try argv.append("-lpthread");1588 try argv.append("-lpthread");
1589 }1589 }
1590 } else if (target.isGnuLibC()) {1590 } else if (target.isGnuLibC()) {