aboutsummaryrefslogtreecommitdiff
path: root/src/link.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-10-09 13:12:50 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-10-09 13:16:51 -0400
commit81c6f087241b6b7a1c12de72a2061cb02df0f93f (patch)
treef706728a6b853da0b66379539018645df583519b /src/link.cpp
parent05e608a0c72a5da8cc92a50dd6f79bad046fb977 (diff)
downloadzig-81c6f087241b6b7a1c12de72a2061cb02df0f93f.tar.gz
zig-81c6f087241b6b7a1c12de72a2061cb02df0f93f.zip
add workaround for bad LLD macos code
Diffstat (limited to 'src/link.cpp')
-rw-r--r--src/link.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/link.cpp b/src/link.cpp
index ad3e0ef8d0..424b06169e 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -31,8 +31,18 @@ static const char *get_libc_static_file(CodeGen *g, const char *file) {
static Buf *build_a_raw(CodeGen *parent_gen, const char *aname, Buf *full_path) {
ZigTarget *child_target = parent_gen->is_native_target ? nullptr : &parent_gen->zig_target;
- CodeGen *child_gen = codegen_create(full_path, child_target, OutTypeLib, parent_gen->build_mode,
- parent_gen->zig_lib_dir);
+
+ // The Mach-O LLD code is not well maintained, and trips an assertion
+ // when we link compiler_rt and builtin as libraries rather than objects.
+ // Here we workaround this by having compiler_rt and builtin be objects.
+ // TODO write our own linker. https://github.com/ziglang/zig/issues/1535
+ OutType child_out_type = OutTypeLib;
+ if (parent_gen->zig_target.os == OsMacOSX) {
+ child_out_type = OutTypeObj;
+ }
+
+ CodeGen *child_gen = codegen_create(full_path, child_target, child_out_type,
+ parent_gen->build_mode, parent_gen->zig_lib_dir);
child_gen->out_h_path = nullptr;
child_gen->verbose_tokenize = parent_gen->verbose_tokenize;