| author | |
| committer | |
| log | fd47839064775c0cc956f12a012f0893e1f3a440 |
| tree | 230142a7a89e36ad5e7a6d9a4ef9c1434ec0e8ac |
| parent | 069a6f2432be5fd5e9a3eabd13faa43143001bbd |
4 files changed, 20 insertions(+), 10 deletions(-)
src-self-hosted/Module.zig+3-5| ... | ... | @@ -949,10 +949,8 @@ pub fn update(self: *Module) !void { |
| 949 | 949 | try self.deleteDecl(decl); |
| 950 | 950 | } |
| 951 | 951 | |
| 952 | if (self.totalErrorCount() == 0) { | |
| 953 | // This is needed before reading the error flags. | |
| 954 | try self.bin_file.flush(); | |
| 955 | } | |
| 952 | // This is needed before reading the error flags. | |
| 953 | try self.bin_file.flush(); | |
| 956 | 954 | |
| 957 | 955 | self.link_error_flags = self.bin_file.errorFlags(); |
| 958 | 956 | |
| ... | ... | @@ -2537,7 +2535,7 @@ pub fn coerce(self: *Module, scope: *Scope, dest_type: Type, inst: *Inst) !*Inst |
| 2537 | 2535 | } |
| 2538 | 2536 | } |
| 2539 | 2537 | |
| 2540 | return self.fail(scope, inst.src, "TODO implement type coercion from {} to {}", .{ inst.ty, dest_type }); | |
| 2538 | return self.fail(scope, inst.src, "expected {}, found {}", .{ dest_type, inst.ty }); | |
| 2541 | 2539 | } |
| 2542 | 2540 | |
| 2543 | 2541 | pub fn storePtr(self: *Module, scope: *Scope, src: usize, ptr: *Inst, uncasted_value: *Inst) !*Inst { |
src-self-hosted/link.zig+10-4| ... | ... | @@ -1172,7 +1172,10 @@ pub const File = struct { |
| 1172 | 1172 | |
| 1173 | 1173 | self.debug_aranges_section_dirty = false; |
| 1174 | 1174 | } |
| 1175 | if (self.debug_line_header_dirty) { | |
| 1175 | if (self.debug_line_header_dirty) debug_line: { | |
| 1176 | if (self.dbg_line_fn_first == null) { | |
| 1177 | break :debug_line; // Error in module; leave debug_line_header_dirty=true. | |
| 1178 | } | |
| 1176 | 1179 | const dbg_line_prg_off = self.getDebugLineProgramOff(); |
| 1177 | 1180 | const dbg_line_prg_end = self.getDebugLineProgramEnd(); |
| 1178 | 1181 | assert(dbg_line_prg_end != 0); |
| ... | ... | @@ -1403,18 +1406,21 @@ pub const File = struct { |
| 1403 | 1406 | self.shdr_table_dirty = false; |
| 1404 | 1407 | } |
| 1405 | 1408 | if (self.entry_addr == null and self.base.options.output_mode == .Exe) { |
| 1406 | log.debug(.link, "no_entry_point_found = true\n", .{}); | |
| 1409 | log.debug(.link, "flushing. no_entry_point_found = true\n", .{}); | |
| 1407 | 1410 | self.error_flags.no_entry_point_found = true; |
| 1408 | 1411 | } else { |
| 1412 | log.debug(.link, "flushing. no_entry_point_found = false\n", .{}); | |
| 1409 | 1413 | self.error_flags.no_entry_point_found = false; |
| 1410 | 1414 | try self.writeElfHeader(); |
| 1411 | 1415 | } |
| 1412 | 1416 | |
| 1413 | // The point of flush() is to commit changes, so nothing should be dirty after this. | |
| 1417 | // The point of flush() is to commit changes, so in theory, nothing should | |
| 1418 | // be dirty after this. However, it is possible for some things to remain | |
| 1419 | // dirty because they fail to be written in the event of compile errors, | |
| 1420 | // such as debug_line_header_dirty. | |
| 1414 | 1421 | assert(!self.debug_info_section_dirty); |
| 1415 | 1422 | assert(!self.debug_abbrev_section_dirty); |
| 1416 | 1423 | assert(!self.debug_aranges_section_dirty); |
| 1417 | assert(!self.debug_line_header_dirty); | |
| 1418 | 1424 | assert(!self.phdr_table_dirty); |
| 1419 | 1425 | assert(!self.shdr_table_dirty); |
| 1420 | 1426 | assert(!self.shstrtab_dirty); |
src-self-hosted/main.zig+3| ... | ... | @@ -64,6 +64,9 @@ var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; |
| 64 | 64 | |
| 65 | 65 | pub fn main() !void { |
| 66 | 66 | const gpa = if (std.builtin.link_libc) std.heap.c_allocator else &general_purpose_allocator.allocator; |
| 67 | defer if (!std.builtin.link_libc) { | |
| 68 | _ = general_purpose_allocator.deinit(); | |
| 69 | }; | |
| 67 | 70 | var arena_instance = std.heap.ArenaAllocator.init(gpa); |
| 68 | 71 | defer arena_instance.deinit(); |
| 69 | 72 | const arena = &arena_instance.allocator; |
test/stage2/compare_output.zig+4-1| ... | ... | @@ -23,6 +23,9 @@ pub fn addCases(ctx: *TestContext) !void { |
| 23 | 23 | |
| 24 | 24 | { |
| 25 | 25 | var case = ctx.exe("hello world with updates", linux_x64); |
| 26 | ||
| 27 | case.addError("", &[_][]const u8{":1:1: error: no entry point found"}); | |
| 28 | ||
| 26 | 29 | // Regular old hello world |
| 27 | 30 | case.addCompareOutput( |
| 28 | 31 | \\export fn _start() noreturn { |
| ... | ... | @@ -123,7 +126,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 123 | 126 | \\ |
| 124 | 127 | ); |
| 125 | 128 | } |
| 126 | ||
| 129 | ||
| 127 | 130 | { |
| 128 | 131 | var case = ctx.exe("hello world", linux_riscv64); |
| 129 | 132 | // Regular old hello world |