authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-10-09 13:12:50-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-10-09 13:16:51-04:00
log81c6f087241b6b7a1c12de72a2061cb02df0f93f
treef706728a6b853da0b66379539018645df583519b
parent05e608a0c72a5da8cc92a50dd6f79bad046fb977
signature Commit is signed but in an unrecognized format.

add workaround for bad LLD macos code


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

src/link.cpp+12-2
...@@ -31,8 +31,18 @@ static const char *get_libc_static_file(CodeGen *g, const char *file) {...@@ -31,8 +31,18 @@ static const char *get_libc_static_file(CodeGen *g, const char *file) {
3131
32static Buf *build_a_raw(CodeGen *parent_gen, const char *aname, Buf *full_path) {32static Buf *build_a_raw(CodeGen *parent_gen, const char *aname, Buf *full_path) {
33 ZigTarget *child_target = parent_gen->is_native_target ? nullptr : &parent_gen->zig_target;33 ZigTarget *child_target = parent_gen->is_native_target ? nullptr : &parent_gen->zig_target;
34 CodeGen *child_gen = codegen_create(full_path, child_target, OutTypeLib, parent_gen->build_mode,34
35 parent_gen->zig_lib_dir);35 // The Mach-O LLD code is not well maintained, and trips an assertion
36 // when we link compiler_rt and builtin as libraries rather than objects.
37 // Here we workaround this by having compiler_rt and builtin be objects.
38 // TODO write our own linker. https://github.com/ziglang/zig/issues/1535
39 OutType child_out_type = OutTypeLib;
40 if (parent_gen->zig_target.os == OsMacOSX) {
41 child_out_type = OutTypeObj;
42 }
43
44 CodeGen *child_gen = codegen_create(full_path, child_target, child_out_type,
45 parent_gen->build_mode, parent_gen->zig_lib_dir);
3646
37 child_gen->out_h_path = nullptr;47 child_gen->out_h_path = nullptr;
38 child_gen->verbose_tokenize = parent_gen->verbose_tokenize;48 child_gen->verbose_tokenize = parent_gen->verbose_tokenize;