From 27e008eb292038c5a6b9a13b64c7b69d1525f690 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 29 Sep 2020 17:24:21 -0700 Subject: [PATCH] fix not passing std.builtin.link_libc to compiler_rt.zig and c.zig comment reproduced here: This is so that compiler_rt and libc.zig libraries know whether they will eventually be linked with libc. They make different decisions about what to export depending on whether another libc will be linked in. For example, compiler_rt will not export the __chkstk symbol if it knows libc will provide it, and likewise c.zig will not export memcpy. --- src/Compilation.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Compilation.zig b/src/Compilation.zig index d60b323216..1cb02d6f1c 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2842,6 +2842,12 @@ pub fn build_crt_file( .verbose_llvm_cpu_features = comp.verbose_llvm_cpu_features, .clang_passthrough_mode = comp.clang_passthrough_mode, .is_compiler_rt_or_libc = true, + // This is so that compiler_rt and libc.zig libraries know whether they + // will eventually be linked with libc. They make different decisions + // about what to export depending on whether another libc will be linked + // in. For example, compiler_rt will not export the __chkstk symbol if it + // knows libc will provide it, and likewise c.zig will not export memcpy. + .link_libc = comp.bin_file.options.link_libc, }); defer sub_compilation.destroy();