authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-09-21 17:40:50-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-09-21 17:40:50-04:00
log7aeca9bfed654f7f5d0e4b9775459b878f4726ed
treef883943fdfb3cbad4807e0e774e444de2ac7c499
parent3f8f0b9bba5407ed5f7279bfdb7d22afaa126674

fix incorrect linking from previous commit


2 files changed, 21 insertions(+), 15 deletions(-)

src/link.cpp+20-14
......@@ -31,6 +31,14 @@ static const char *get_libc_static_file(CodeGen *g, const char *file) {
3131 return buf_ptr(out_buf);
3232}
3333
34static const char *get_o_file_extension(CodeGen *g) {
35 if (g->zig_target.env_type == ZigLLVM_MSVC) {
36 return ".obj";
37 } else {
38 return ".o";
39 }
40}
41
3442static Buf *build_o(CodeGen *parent_gen, const char *oname) {
3543 Buf *source_basename = buf_sprintf("%s.zig", oname);
3644 Buf *std_dir_path = parent_gen->zig_std_dir;
......@@ -62,20 +70,13 @@ static Buf *build_o(CodeGen *parent_gen, const char *oname) {
6270 }
6371
6472 codegen_add_root_code(child_gen, std_dir_path, source_basename, &source_code);
65 Buf *o_out = buf_sprintf("%s.o", oname);
73 const char *o_ext = get_o_file_extension(child_gen);
74 Buf *o_out = buf_sprintf("%s%s", oname, o_ext);
6675 codegen_link(child_gen, buf_ptr(o_out));
6776
6877 return o_out;
6978}
7079
71static const char *get_o_file_extension(CodeGen *g) {
72 if (g->zig_target.env_type == ZigLLVM_MSVC) {
73 return ".obj";
74 } else {
75 return ".o";
76 }
77}
78
7980static const char *get_exe_file_extension(CodeGen *g) {
8081 if (g->zig_target.os == ZigLLVM_Win32) {
8182 return ".exe";
......@@ -786,16 +787,21 @@ void codegen_link(CodeGen *g, const char *out_file) {
786787 fprintf(stderr, "-------\n");
787788 }
788789
789 if (buf_len(&lj.out_file) == 0) {
790 bool override_out_file = (buf_len(&lj.out_file) != 0);
791 if (!override_out_file) {
790792 assert(g->root_out_name);
793
791794 buf_init_from_buf(&lj.out_file, g->root_out_name);
792 buf_append_str(&lj.out_file, get_exe_file_extension(g));
795 if (g->out_type == OutTypeExe) {
796 buf_append_str(&lj.out_file, get_exe_file_extension(g));
797 }
793798 }
794
795799 buf_init_from_buf(&lj.out_file_o, &lj.out_file);
796800
797 const char *o_ext = get_o_file_extension(g);
798 buf_append_str(&lj.out_file_o, o_ext);
801 if (g->out_type != OutTypeObj || !override_out_file) {
802 const char *o_ext = get_o_file_extension(g);
803 buf_append_str(&lj.out_file_o, o_ext);
804 }
799805
800806 char *err_msg = nullptr;
801807 if (LLVMTargetMachineEmitToFile(g->target_machine, g->module, buf_ptr(&lj.out_file_o),
std/debug.zig+1-1
......@@ -196,7 +196,7 @@ fn parseFormValue(in_stream: &io.InStream, form_id: u64, is_64: bool) -> %FormVa
196196 const child_form_id = %return readULeb128(in_stream);
197197 parseFormValue(in_stream, child_form_id, is_64)
198198 },
199 else => return error.InvalidDebugInfo,
199 else => error.InvalidDebugInfo,
200200 }
201201}
202202