aboutsummaryrefslogtreecommitdiff
path: root/src/link.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-05-08 22:43:11 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-05-08 22:45:49 -0400
commita7346ea49f4d9b1af2d0babf67354b234a87fe42 (patch)
tree18fe76c5f8958d1cf2533fb5136311d855346f4a /src/link.cpp
parent4b9e12be50a8d075d06b127712573b531d068837 (diff)
downloadzig-a7346ea49f4d9b1af2d0babf67354b234a87fe42.tar.gz
zig-a7346ea49f4d9b1af2d0babf67354b234a87fe42.zip
fix build on macOS
Sadly due to a workaround for LLD linker limitations on macOS we cannot put libuserland into an .a file; instead we have to use object files. Again due to linker limitations, bundling compiler_rt.o into another relocatable object also doesn't work. So we're left with disabling stack probing on macOS for the stage1 self-hosted code. These workarounds could all be removed if the macos support in the LLD linker improved, or if Zig project had its own linker that did not have these issues.
Diffstat (limited to 'src/link.cpp')
-rw-r--r--src/link.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/link.cpp b/src/link.cpp
index 810f6072ad..8900d0351b 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -25,6 +25,7 @@ static CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, Ou
CodeGen *child_gen = codegen_create(nullptr, root_src_path, parent_gen->zig_target, out_type,
parent_gen->build_mode, parent_gen->zig_lib_dir, parent_gen->zig_std_dir, libc, get_stage1_cache_path());
child_gen->disable_gen_h = true;
+ child_gen->disable_stack_probing = true;
child_gen->verbose_tokenize = parent_gen->verbose_tokenize;
child_gen->verbose_ast = parent_gen->verbose_ast;
child_gen->verbose_link = parent_gen->verbose_link;
@@ -1653,6 +1654,11 @@ static void construct_linker_job(LinkJob *lj) {
}
}
+void zig_link_add_compiler_rt(CodeGen *g) {
+ Buf *compiler_rt_o_path = build_compiler_rt(g, OutTypeObj);
+ g->link_objects.append(compiler_rt_o_path);
+}
+
void codegen_link(CodeGen *g) {
codegen_add_time_event(g, "Build Dependencies");
@@ -1681,10 +1687,6 @@ void codegen_link(CodeGen *g) {
for (size_t i = 0; i < g->link_objects.length; i += 1) {
file_names.append(buf_ptr(g->link_objects.at(i)));
}
- if (g->bundle_compiler_rt) {
- Buf *compiler_rt_o_path = build_compiler_rt(g, OutTypeObj);
- file_names.append(buf_ptr(compiler_rt_o_path));
- }
ZigLLVM_OSType os_type = get_llvm_os_type(g->zig_target->os);
codegen_add_time_event(g, "LLVM Link");
if (g->verbose_link) {