| author | |
| committer | |
| log | 373ae980c0c7cf66f61c33def3a4fef06c1d95b7 |
| tree | bede5cbbe539e4596d61dcdc2aefbbef1d6b7d6f |
| parent | b8d78661939aac548cbac28873836b697eb0e4f3 |
2 files changed, 28 insertions(+), 3 deletions(-)
src/link/Elf/ZigObject.zig+8-3| ... | ... | @@ -1937,9 +1937,14 @@ pub fn allocateAtom(self: *ZigObject, atom_ptr: *Atom, requires_padding: bool, e |
| 1937 | 1937 | const shdr = &slice.items(.shdr)[atom_ptr.output_section_index]; |
| 1938 | 1938 | const last_atom_ref = &slice.items(.last_atom)[atom_ptr.output_section_index]; |
| 1939 | 1939 | |
| 1940 | // This only works if this atom is the only atom in the output section. In | |
| 1941 | // every other case, we need to redo the prev/next links. | |
| 1942 | if (last_atom_ref.eql(atom_ptr.ref())) last_atom_ref.* = .{}; | |
| 1940 | if (last_atom_ref.eql(atom_ptr.ref())) { | |
| 1941 | if (atom_ptr.prevAtom(elf_file)) |prev_atom| { | |
| 1942 | prev_atom.next_atom_ref = .{}; | |
| 1943 | last_atom_ref.* = prev_atom.ref(); | |
| 1944 | } else { | |
| 1945 | last_atom_ref.* = .{}; | |
| 1946 | } | |
| 1947 | } | |
| 1943 | 1948 | |
| 1944 | 1949 | const alloc_res = try elf_file.allocateChunk(.{ |
| 1945 | 1950 | .shndx = atom_ptr.output_section_index, |
test/incremental/no_change_preserves_tag_names created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | #target=x86_64-linux-selfhosted | |
| 2 | #target=x86_64-linux-cbe | |
| 3 | #target=x86_64-windows-cbe | |
| 4 | //#target=wasm32-wasi-selfhosted | |
| 5 | #update=initial version | |
| 6 | #file=main.zig | |
| 7 | const std = @import("std"); | |
| 8 | var some_enum: enum { first, second } = .first; | |
| 9 | pub fn main() !void { | |
| 10 | try std.io.getStdOut().writeAll(@tagName(some_enum)); | |
| 11 | } | |
| 12 | #expect_stdout="first" | |
| 13 | #update=no change | |
| 14 | #file=main.zig | |
| 15 | const std = @import("std"); | |
| 16 | var some_enum: enum { first, second } = .first; | |
| 17 | pub fn main() !void { | |
| 18 | try std.io.getStdOut().writeAll(@tagName(some_enum)); | |
| 19 | } | |
| 20 | #expect_stdout="first" |