| ... | ... | @@ -115,6 +115,15 @@ CodeGen *codegen_create(Buf *root_source_dir, const ZigTarget *target) { |
| 115 | 115 | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | // On Darwin/MacOS/iOS, we always link libSystem which contains libc. |
| 119 | if (g->zig_target.os == ZigLLVM_Darwin || |
| 120 | g->zig_target.os == ZigLLVM_MacOSX || |
| 121 | g->zig_target.os == ZigLLVM_IOS) |
| 122 | { |
| 123 | g->link_libc = true; |
| 124 | g->link_libs.append(buf_create_from_str("c")); |
| 125 | } |
| 126 | |
| 118 | 127 | return g; |
| 119 | 128 | } |
| 120 | 129 | |
| ... | ... | @@ -191,6 +200,8 @@ void codegen_add_rpath(CodeGen *g, const char *name) { |
| 191 | 200 | |
| 192 | 201 | void codegen_add_link_lib(CodeGen *g, const char *lib) { |
| 193 | 202 | if (strcmp(lib, "c") == 0) { |
| 203 | if (g->link_libc) |
| 204 | return; |
| 194 | 205 | g->link_libc = true; |
| 195 | 206 | } |
| 196 | 207 | g->link_libs.append(buf_create_from_str(lib)); |