From e29a3b1d2a74732c6e6e4a1f10a02b45797fe4e2 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 9 Oct 2018 13:02:01 -0400 Subject: [PATCH] stage1 link: compiler_rt and builtin libs know ... ...whether they will be linked with libc --- src/link.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/link.cpp b/src/link.cpp index 6166584353b7379663493fe3112fa62dd0c8ca94..ad3e0ef8d0c5cb73f6dbbcb40b73a5a66cdcf1da 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -53,6 +53,14 @@ static Buf *build_a_raw(CodeGen *parent_gen, const char *aname, Buf *full_path) codegen_set_mmacosx_version_min(child_gen, parent_gen->mmacosx_version_min); codegen_set_mios_version_min(child_gen, parent_gen->mios_version_min); + // This is so that compiler_rt and builtin libraries know whether they + // will eventually be linked with libc. They make different decisions + // about what to export depending on whether libc is linked. + if (parent_gen->libc_link_lib != nullptr) { + LinkLib *new_link_lib = codegen_add_link_lib(child_gen, parent_gen->libc_link_lib->name); + new_link_lib->provided_explicitly = parent_gen->libc_link_lib->provided_explicitly; + } + child_gen->enable_cache = true; codegen_build_and_link(child_gen); return &child_gen->output_file_path; -- 2.54.0