Skip to content

Commit

Permalink
remove "FIXME" from codebase
Browse files Browse the repository at this point in the history
See #363. Please file issues rather than making TODO comments.
  • Loading branch information
andrewrk committed Jan 14, 2025
1 parent 2d9292d commit 836fa02
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
3 changes: 0 additions & 3 deletions src/link/Dwarf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ debug_str: StringSection,
pub const UpdateError = error{
/// Indicates the error is already reported on `failed_codegen` in the Zcu.
CodegenFail,
/// Indicates the error is already reported on `link_diags` in the Compilation.
LinkFailure,
OutOfMemory,
};

Expand Down Expand Up @@ -443,7 +441,6 @@ pub const Section = struct {
const zo = elf_file.zigObjectPtr().?;
const atom = zo.symbol(sec.index).atom(elf_file).?;
if (atom.prevAtom(elf_file)) |_| {
// FIXME:JK trimming/shrinking has to be reworked on ZigObject/Elf level
atom.value += len;
} else {
const shdr = &elf_file.sections.items(.shdr)[atom.output_section_index];
Expand Down
7 changes: 1 addition & 6 deletions src/link/Elf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3127,9 +3127,6 @@ pub fn sortShdrs(
fileLookup(files, ref.file, zig_object_ptr).?.atom(ref.index).?.output_section_index = atom_list.output_section_index;
}
if (shdr.sh_type == elf.SHT_RELA) {
// FIXME:JK we should spin up .symtab potentially earlier, or set all non-dynamic RELA sections
// to point at symtab
// shdr.sh_link = backlinks[shdr.sh_link];
shdr.sh_link = section_indexes.symtab.?;
shdr.sh_info = backlinks[shdr.sh_info];
}
Expand Down Expand Up @@ -3217,7 +3214,7 @@ fn updateSectionSizes(self: *Elf) !void {
atom_list.dirty = false;
}

// FIXME:JK this will hopefully not be needed once we create a link from Atom/Thunk to AtomList.
// This might not be needed if there was a link from Atom/Thunk to AtomList.
for (self.thunks.items) |*th| {
th.value += slice.items(.atom_list_2)[th.output_section_index].value;
}
Expand Down Expand Up @@ -3303,7 +3300,6 @@ fn updateSectionSizes(self: *Elf) !void {
self.updateShStrtabSize();
}

// FIXME:JK this is very much obsolete, remove!
pub fn updateShStrtabSize(self: *Elf) void {
if (self.section_indexes.shstrtab) |index| {
self.sections.items(.shdr)[index].sh_size = self.shstrtab.items.len;
Expand Down Expand Up @@ -3914,7 +3910,6 @@ fn writeSyntheticSections(self: *Elf) !void {
try self.writeShStrtab();
}

// FIXME:JK again, why is this needed?
pub fn writeShStrtab(self: *Elf) !void {
if (self.section_indexes.shstrtab) |index| {
const shdr = self.sections.items(.shdr)[index];
Expand Down
5 changes: 3 additions & 2 deletions src/link/Elf/AtomList.zig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub fn allocate(list: *AtomList, elf_file: *Elf) !void {
if (expand_section) last_atom_ref.* = list.lastAtom(elf_file).ref();
shdr.sh_addralign = @max(shdr.sh_addralign, list.alignment.toByteUnits().?);

// FIXME:JK this currently ignores Thunks as valid chunks.
// This currently ignores Thunks as valid chunks.
{
var idx: usize = 0;
while (idx < list.atoms.keys().len) : (idx += 1) {
Expand All @@ -78,7 +78,8 @@ pub fn allocate(list: *AtomList, elf_file: *Elf) !void {
placement_atom.next_atom_ref = list.firstAtom(elf_file).ref();
}

// FIXME:JK if we had a link from Atom to parent AtomList we would not need to update Atom's value or osec index
// If we had a link from Atom to parent AtomList we would not need to
// update Atom's value or osec index.
for (list.atoms.keys()) |ref| {
const atom_ptr = elf_file.atom(ref).?;
atom_ptr.output_section_index = list.output_section_index;
Expand Down
4 changes: 2 additions & 2 deletions src/link/Elf/ZigObject.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1937,8 +1937,8 @@ pub fn allocateAtom(self: *ZigObject, atom_ptr: *Atom, requires_padding: bool, e
const shdr = &slice.items(.shdr)[atom_ptr.output_section_index];
const last_atom_ref = &slice.items(.last_atom)[atom_ptr.output_section_index];

// FIXME:JK this only works if this atom is the only atom in the output section
// In every other case, we need to redo the prev/next links
// This only works if this atom is the only atom in the output section. In
// every other case, we need to redo the prev/next links.
if (last_atom_ref.eql(atom_ptr.ref())) last_atom_ref.* = .{};

const alloc_res = try elf_file.allocateChunk(.{
Expand Down

0 comments on commit 836fa02

Please sign in to comment.