| ... | @@ -38,6 +38,7 @@ static Buf *build_o(CodeGen *parent_gen, const char *oname) { | ... | @@ -38,6 +38,7 @@ static Buf *build_o(CodeGen *parent_gen, const char *oname) { |
| 38 | ZigTarget *child_target = parent_gen->is_native_target ? nullptr : &parent_gen->zig_target; | 38 | ZigTarget *child_target = parent_gen->is_native_target ? nullptr : &parent_gen->zig_target; |
| 39 | CodeGen *child_gen = codegen_create(std_dir_path, child_target); | 39 | CodeGen *child_gen = codegen_create(std_dir_path, child_target); |
| 40 | child_gen->link_libc = parent_gen->link_libc; | 40 | child_gen->link_libc = parent_gen->link_libc; |
| | 41 | child_gen->want_h_file = false; |
| 41 | | 42 | |
| 42 | codegen_set_is_release(child_gen, parent_gen->is_release_build); | 43 | codegen_set_is_release(child_gen, parent_gen->is_release_build); |
| 43 | | 44 | |
| ... | @@ -793,10 +794,8 @@ void codegen_link(CodeGen *g, const char *out_file) { | ... | @@ -793,10 +794,8 @@ void codegen_link(CodeGen *g, const char *out_file) { |
| 793 | | 794 | |
| 794 | buf_init_from_buf(&lj.out_file_o, &lj.out_file); | 795 | buf_init_from_buf(&lj.out_file_o, &lj.out_file); |
| 795 | | 796 | |
| 796 | if (g->out_type != OutTypeObj) { | 797 | const char *o_ext = get_o_file_extension(g); |
| 797 | const char *o_ext = get_o_file_extension(g); | 798 | buf_append_str(&lj.out_file_o, o_ext); |
| 798 | buf_append_str(&lj.out_file_o, o_ext); | | |
| 799 | } | | |
| 800 | | 799 | |
| 801 | char *err_msg = nullptr; | 800 | char *err_msg = nullptr; |
| 802 | if (LLVMTargetMachineEmitToFile(g->target_machine, g->module, buf_ptr(&lj.out_file_o), | 801 | if (LLVMTargetMachineEmitToFile(g->target_machine, g->module, buf_ptr(&lj.out_file_o), |
| ... | @@ -806,6 +805,9 @@ void codegen_link(CodeGen *g, const char *out_file) { | ... | @@ -806,6 +805,9 @@ void codegen_link(CodeGen *g, const char *out_file) { |
| 806 | } | 805 | } |
| 807 | | 806 | |
| 808 | if (g->out_type == OutTypeObj) { | 807 | if (g->out_type == OutTypeObj) { |
| | 808 | if (g->want_h_file) { |
| | 809 | codegen_generate_h_file(g); |
| | 810 | } |
| 809 | if (g->verbose) { | 811 | if (g->verbose) { |
| 810 | fprintf(stderr, "OK\n"); | 812 | fprintf(stderr, "OK\n"); |
| 811 | } | 813 | } |