authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-12-03 14:04:59-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-01-15 15:11:35-08:00
log6235cc3da4d2c6ebf7fd31242e8d82d39f5c81cf
tree619bd40a601c199b19bbac7ba25fff93fac4d1d5
parent16180f525a966de10b6fc0822fea107baf1f24f6

remove "FIXME" from codebase

See #363. Please file issues rather than making TODO comments.

4 files changed, 6 insertions(+), 13 deletions(-)

src/link/Dwarf.zig-3
...@@ -23,8 +23,6 @@ debug_str: StringSection,...@@ -23,8 +23,6 @@ debug_str: StringSection,
23pub const UpdateError = error{23pub const UpdateError = error{
24 /// Indicates the error is already reported on `failed_codegen` in the Zcu.24 /// Indicates the error is already reported on `failed_codegen` in the Zcu.
25 CodegenFail,25 CodegenFail,
26 /// Indicates the error is already reported on `link_diags` in the Compilation.
27 LinkFailure,
28 OutOfMemory,26 OutOfMemory,
29};27};
3028
...@@ -443,7 +441,6 @@ pub const Section = struct {...@@ -443,7 +441,6 @@ pub const Section = struct {
443 const zo = elf_file.zigObjectPtr().?;441 const zo = elf_file.zigObjectPtr().?;
444 const atom = zo.symbol(sec.index).atom(elf_file).?;442 const atom = zo.symbol(sec.index).atom(elf_file).?;
445 if (atom.prevAtom(elf_file)) |_| {443 if (atom.prevAtom(elf_file)) |_| {
446 // FIXME:JK trimming/shrinking has to be reworked on ZigObject/Elf level
447 atom.value += len;444 atom.value += len;
448 } else {445 } else {
449 const shdr = &elf_file.sections.items(.shdr)[atom.output_section_index];446 const shdr = &elf_file.sections.items(.shdr)[atom.output_section_index];
src/link/Elf.zig+1-6
...@@ -3127,9 +3127,6 @@ pub fn sortShdrs(...@@ -3127,9 +3127,6 @@ pub fn sortShdrs(
3127 fileLookup(files, ref.file, zig_object_ptr).?.atom(ref.index).?.output_section_index = atom_list.output_section_index;3127 fileLookup(files, ref.file, zig_object_ptr).?.atom(ref.index).?.output_section_index = atom_list.output_section_index;
3128 }3128 }
3129 if (shdr.sh_type == elf.SHT_RELA) {3129 if (shdr.sh_type == elf.SHT_RELA) {
3130 // FIXME:JK we should spin up .symtab potentially earlier, or set all non-dynamic RELA sections
3131 // to point at symtab
3132 // shdr.sh_link = backlinks[shdr.sh_link];
3133 shdr.sh_link = section_indexes.symtab.?;3130 shdr.sh_link = section_indexes.symtab.?;
3134 shdr.sh_info = backlinks[shdr.sh_info];3131 shdr.sh_info = backlinks[shdr.sh_info];
3135 }3132 }
...@@ -3217,7 +3214,7 @@ fn updateSectionSizes(self: *Elf) !void {...@@ -3217,7 +3214,7 @@ fn updateSectionSizes(self: *Elf) !void {
3217 atom_list.dirty = false;3214 atom_list.dirty = false;
3218 }3215 }
32193216
3220 // FIXME:JK this will hopefully not be needed once we create a link from Atom/Thunk to AtomList.3217 // This might not be needed if there was a link from Atom/Thunk to AtomList.
3221 for (self.thunks.items) |*th| {3218 for (self.thunks.items) |*th| {
3222 th.value += slice.items(.atom_list_2)[th.output_section_index].value;3219 th.value += slice.items(.atom_list_2)[th.output_section_index].value;
3223 }3220 }
...@@ -3303,7 +3300,6 @@ fn updateSectionSizes(self: *Elf) !void {...@@ -3303,7 +3300,6 @@ fn updateSectionSizes(self: *Elf) !void {
3303 self.updateShStrtabSize();3300 self.updateShStrtabSize();
3304}3301}
33053302
3306// FIXME:JK this is very much obsolete, remove!
3307pub fn updateShStrtabSize(self: *Elf) void {3303pub fn updateShStrtabSize(self: *Elf) void {
3308 if (self.section_indexes.shstrtab) |index| {3304 if (self.section_indexes.shstrtab) |index| {
3309 self.sections.items(.shdr)[index].sh_size = self.shstrtab.items.len;3305 self.sections.items(.shdr)[index].sh_size = self.shstrtab.items.len;
...@@ -3914,7 +3910,6 @@ fn writeSyntheticSections(self: *Elf) !void {...@@ -3914,7 +3910,6 @@ fn writeSyntheticSections(self: *Elf) !void {
3914 try self.writeShStrtab();3910 try self.writeShStrtab();
3915}3911}
39163912
3917// FIXME:JK again, why is this needed?
3918pub fn writeShStrtab(self: *Elf) !void {3913pub fn writeShStrtab(self: *Elf) !void {
3919 if (self.section_indexes.shstrtab) |index| {3914 if (self.section_indexes.shstrtab) |index| {
3920 const shdr = self.sections.items(.shdr)[index];3915 const shdr = self.sections.items(.shdr)[index];
src/link/Elf/AtomList.zig+3-2
...@@ -58,7 +58,7 @@ pub fn allocate(list: *AtomList, elf_file: *Elf) !void {...@@ -58,7 +58,7 @@ pub fn allocate(list: *AtomList, elf_file: *Elf) !void {
58 if (expand_section) last_atom_ref.* = list.lastAtom(elf_file).ref();58 if (expand_section) last_atom_ref.* = list.lastAtom(elf_file).ref();
59 shdr.sh_addralign = @max(shdr.sh_addralign, list.alignment.toByteUnits().?);59 shdr.sh_addralign = @max(shdr.sh_addralign, list.alignment.toByteUnits().?);
6060
61 // FIXME:JK this currently ignores Thunks as valid chunks.61 // This currently ignores Thunks as valid chunks.
62 {62 {
63 var idx: usize = 0;63 var idx: usize = 0;
64 while (idx < list.atoms.keys().len) : (idx += 1) {64 while (idx < list.atoms.keys().len) : (idx += 1) {
...@@ -78,7 +78,8 @@ pub fn allocate(list: *AtomList, elf_file: *Elf) !void {...@@ -78,7 +78,8 @@ pub fn allocate(list: *AtomList, elf_file: *Elf) !void {
78 placement_atom.next_atom_ref = list.firstAtom(elf_file).ref();78 placement_atom.next_atom_ref = list.firstAtom(elf_file).ref();
79 }79 }
8080
81 // FIXME:JK if we had a link from Atom to parent AtomList we would not need to update Atom's value or osec index81 // If we had a link from Atom to parent AtomList we would not need to
82 // update Atom's value or osec index.
82 for (list.atoms.keys()) |ref| {83 for (list.atoms.keys()) |ref| {
83 const atom_ptr = elf_file.atom(ref).?;84 const atom_ptr = elf_file.atom(ref).?;
84 atom_ptr.output_section_index = list.output_section_index;85 atom_ptr.output_section_index = list.output_section_index;
src/link/Elf/ZigObject.zig+2-2
...@@ -1937,8 +1937,8 @@ pub fn allocateAtom(self: *ZigObject, atom_ptr: *Atom, requires_padding: bool, e...@@ -1937,8 +1937,8 @@ pub fn allocateAtom(self: *ZigObject, atom_ptr: *Atom, requires_padding: bool, e
1937 const shdr = &slice.items(.shdr)[atom_ptr.output_section_index];1937 const shdr = &slice.items(.shdr)[atom_ptr.output_section_index];
1938 const last_atom_ref = &slice.items(.last_atom)[atom_ptr.output_section_index];1938 const last_atom_ref = &slice.items(.last_atom)[atom_ptr.output_section_index];
19391939
1940 // FIXME:JK this only works if this atom is the only atom in the output section1940 // This only works if this atom is the only atom in the output section. In
1941 // In every other case, we need to redo the prev/next links1941 // every other case, we need to redo the prev/next links.
1942 if (last_atom_ref.eql(atom_ptr.ref())) last_atom_ref.* = .{};1942 if (last_atom_ref.eql(atom_ptr.ref())) last_atom_ref.* = .{};
19431943
1944 const alloc_res = try elf_file.allocateChunk(.{1944 const alloc_res = try elf_file.allocateChunk(.{