aboutsummaryrefslogtreecommitdiff
path: root/src/link.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-05-15 21:47:15 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-05-15 21:50:56 -0400
commit6b36b756eb4b4c26b98d405310680ebe5679d111 (patch)
tree372ff21670a553664b443e08aae5601187d51bf4 /src/link.cpp
parentb64e6cb8130ca0ef7deca2191a8312edc7f2ce41 (diff)
downloadzig-6b36b756eb4b4c26b98d405310680ebe5679d111.tar.gz
zig-6b36b756eb4b4c26b98d405310680ebe5679d111.zip
fix static builds of zig from requiring c compiler
to be installed when linking libc. When zig links against libc, it requires a dynamic linker path. Usually this can be determined based on the architecture and operating system components of the target. However on some systems this is not correct; because of this zig checks its own dynamic linker. When zig is statically linked, this information is not available, and so it resorts to using cc -print-filename=foo to find the dynamic linker path. Before this commit, Zig incorrectly exited with an error if there was no c compiler installed. Now, Zig falls back to the dynamic linker determined based on the arch and os when no C compiler can be found.
Diffstat (limited to 'src/link.cpp')
-rw-r--r--src/link.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/link.cpp b/src/link.cpp
index 7566838a36..538d663b03 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -34,6 +34,7 @@ static CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, Ou
child_gen->verbose_cimport = parent_gen->verbose_cimport;
child_gen->verbose_cc = parent_gen->verbose_cc;
child_gen->llvm_argv = parent_gen->llvm_argv;
+ child_gen->dynamic_linker_path = parent_gen->dynamic_linker_path;
codegen_set_strip(child_gen, parent_gen->strip_debug_symbols);
child_gen->want_pic = parent_gen->have_pic ? WantPICEnabled : WantPICDisabled;