Skip to content

Commit

Permalink
link/Coff: simplify file structure by collapsing all files into Coff.…
Browse files Browse the repository at this point in the history
…zig (#21761)

* coff: collapse Coff/lld.zig logic into Coff.zig

* coff: rename std.coff uses to coff_util

* coff: rename self to coff for *Coff references

* coff: collapse Coff/Atom.zig logic into Coff.zig

* coff: collapse Coff/Relocation.zig logic into Coff.zig

* coff: collapse Coff/ImportTable.zig logic into Coff.zig

* coff: remove unused Coff/Object.zig

* link/Coff: fix rebase gone wrong
  • Loading branch information
kubkon authored Oct 24, 2024
1 parent 9ffee5a commit 56996a2
Show file tree
Hide file tree
Showing 9 changed files with 1,636 additions and 1,708 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,6 @@ set(ZIG_STAGE2_SOURCES
src/link.zig
src/link/C.zig
src/link/Coff.zig
src/link/Coff/Atom.zig
src/link/Coff/ImportTable.zig
src/link/Coff/Object.zig
src/link/Coff/Relocation.zig
src/link/Coff/lld.zig
src/link/Dwarf.zig
src/link/Elf.zig
src/link/Elf/Archive.zig
Expand Down
4 changes: 2 additions & 2 deletions src/arch/aarch64/Emit.zig
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void {
.load_memory_import => coff_file.getGlobalByIndex(data.sym_index),
else => unreachable,
};
try link.File.Coff.Atom.addRelocation(coff_file, atom_index, .{
try coff_file.addRelocation(atom_index, .{
.target = target,
.offset = offset,
.addend = 0,
Expand All @@ -959,7 +959,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void {
else => unreachable,
},
});
try link.File.Coff.Atom.addRelocation(coff_file, atom_index, .{
try coff_file.addRelocation(atom_index, .{
.target = target,
.offset = offset + 4,
.addend = 0,
Expand Down
4 changes: 2 additions & 2 deletions src/arch/x86_64/Emit.zig
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub fn emitMir(emit: *Emit) Error!void {
coff_file.getGlobalByIndex(link.File.Coff.global_symbol_mask & sym_index)
else
link.File.Coff.SymbolWithLoc{ .sym_index = sym_index, .file = null };
try link.File.Coff.Atom.addRelocation(coff_file, atom_index, .{
try coff_file.addRelocation(atom_index, .{
.type = .direct,
.target = target,
.offset = end_offset - 4,
Expand Down Expand Up @@ -230,7 +230,7 @@ pub fn emitMir(emit: *Emit) Error!void {
coff_file.getGlobalByIndex(link.File.Coff.global_symbol_mask & sym_index)
else
link.File.Coff.SymbolWithLoc{ .sym_index = sym_index, .file = null };
try link.File.Coff.Atom.addRelocation(coff_file, atom_index, .{
try coff_file.addRelocation(atom_index, .{
.type = switch (lowered_relocs[0].target) {
.linker_got => .got,
.linker_direct => .direct,
Expand Down
Loading

0 comments on commit 56996a2

Please sign in to comment.