| author | |
| committer | |
| log | 5771bd805ee48aca5d56088fb8a1449bb7c3760d |
| tree | aa78925c06bbcf47cca8b1fb3a6e3aeb220cb931 |
| parent | 1141e4f5b262f7490fe554cd4334ec6b1c886c5f |
3 files changed, 13 insertions(+), 14 deletions(-)
src/all_types.hpp+1-1| ... | ... | @@ -1061,9 +1061,9 @@ struct CodeGen { |
| 1061 | 1061 | LLVMZigDICompileUnit *compile_unit; |
| 1062 | 1062 | |
| 1063 | 1063 | ZigList<Buf *> lib_search_paths; |
| 1064 | ZigList<Buf *> link_libs; | |
| 1064 | 1065 | |
| 1065 | 1066 | // reminder: hash tables must be initialized before use |
| 1066 | HashMap<Buf *, bool, buf_hash, buf_eql_buf> link_table; | |
| 1067 | 1067 | HashMap<Buf *, ImportTableEntry *, buf_hash, buf_eql_buf> import_table; |
| 1068 | 1068 | HashMap<Buf *, BuiltinFnEntry *, buf_hash, buf_eql_buf> builtin_fn_table; |
| 1069 | 1069 | HashMap<Buf *, TypeTableEntry *, buf_hash, buf_eql_buf> primitive_type_table; |
src/codegen.cpp+2-2| ... | ... | @@ -24,7 +24,6 @@ |
| 24 | 24 | |
| 25 | 25 | CodeGen *codegen_create(Buf *root_source_dir, const ZigTarget *target) { |
| 26 | 26 | CodeGen *g = allocate<CodeGen>(1); |
| 27 | g->link_table.init(32); | |
| 28 | 27 | g->import_table.init(32); |
| 29 | 28 | g->builtin_fn_table.init(32); |
| 30 | 29 | g->primitive_type_table.init(32); |
| ... | ... | @@ -3831,9 +3830,10 @@ static ImportTableEntry *codegen_add_code(CodeGen *g, Buf *abs_full_path, |
| 3831 | 3830 | if (buf_eql_str(name, "version")) { |
| 3832 | 3831 | set_root_export_version(g, param, directive_node); |
| 3833 | 3832 | } else if (buf_eql_str(name, "link")) { |
| 3834 | g->link_table.put(param, true); | |
| 3835 | 3833 | if (buf_eql_str(param, "c")) { |
| 3836 | 3834 | g->link_libc = true; |
| 3835 | } else { | |
| 3836 | g->link_libs.append(param); | |
| 3837 | 3837 | } |
| 3838 | 3838 | } else { |
| 3839 | 3839 | add_node_error(g, directive_node, |
src/link.cpp+10-11| ... | ... | @@ -210,17 +210,10 @@ static void construct_linker_job_linux(LinkJob *lj) { |
| 210 | 210 | lj->args.append(buf_ptr(compiler_rt_o_path)); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | auto it = g->link_table.entry_iterator(); | |
| 214 | for (;;) { | |
| 215 | auto *entry = it.next(); | |
| 216 | if (!entry) | |
| 217 | break; | |
| 218 | ||
| 219 | // we handle libc explicitly, don't do it here | |
| 220 | if (!buf_eql_str(entry->key, "c")) { | |
| 221 | Buf *arg = buf_sprintf("-l%s", buf_ptr(entry->key)); | |
| 222 | lj->args.append(buf_ptr(arg)); | |
| 223 | } | |
| 213 | for (int i = 0; i < g->link_libs.length; i += 1) { | |
| 214 | Buf *link_lib = g->link_libs.at(i); | |
| 215 | Buf *arg = buf_sprintf("-l%s", buf_ptr(link_lib)); | |
| 216 | lj->args.append(buf_ptr(arg)); | |
| 224 | 217 | } |
| 225 | 218 | |
| 226 | 219 | |
| ... | ... | @@ -333,6 +326,12 @@ static void construct_linker_job_mingw(LinkJob *lj) { |
| 333 | 326 | |
| 334 | 327 | lj->args.append((const char *)buf_ptr(&lj->out_file_o)); |
| 335 | 328 | |
| 329 | for (int i = 0; i < g->link_libs.length; i += 1) { | |
| 330 | Buf *link_lib = g->link_libs.at(i); | |
| 331 | Buf *arg = buf_sprintf("-l%s", buf_ptr(link_lib)); | |
| 332 | lj->args.append(buf_ptr(arg)); | |
| 333 | } | |
| 334 | ||
| 336 | 335 | if (g->link_libc) { |
| 337 | 336 | if (g->is_static) { |
| 338 | 337 | lj->args.append("--start-group"); |