codegen: make LinkerLoad a common struct shared by backends

This commit is contained in:
Jakub Konka
2022-12-01 16:32:09 +01:00
parent 00016ab6a0
commit 5bffc17c42
4 changed files with 57 additions and 160 deletions

View File

@@ -68,6 +68,19 @@ pub const DebugInfoOutput = union(enum) {
none,
};
/// Helper struct to denote that the value is in memory but requires a linker relocation fixup:
/// * got - the value is referenced indirectly via GOT entry index (the linker emits a got-type reloc)
/// * direct - the value is referenced directly via symbol index index (the linker emits a displacement reloc)
/// * import - the value is referenced indirectly via import entry index (the linker emits an import-type reloc)
pub const LinkerLoad = struct {
type: enum {
got,
direct,
import,
},
sym_index: u32,
};
pub fn generateFunction(
bin_file: *link.File,
src_loc: Module.SrcLoc,