aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-12-01 16:32:09 +0100
committerJakub Konka <kubkon@jakubkonka.com>2022-12-01 16:32:09 +0100
commit5bffc17c42bb6eacd0cc09a61954e98ccf912fa4 (patch)
tree410cb2ab56760fd80ed04d8706fceef3fba00fdd /src/codegen.zig
parent00016ab6a0bd31bed77c86074a6666822b8d0f20 (diff)
downloadzig-5bffc17c42bb6eacd0cc09a61954e98ccf912fa4.tar.gz
zig-5bffc17c42bb6eacd0cc09a61954e98ccf912fa4.zip
codegen: make LinkerLoad a common struct shared by backends
Diffstat (limited to 'src/codegen.zig')
-rw-r--r--src/codegen.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/codegen.zig b/src/codegen.zig
index 5a28ce1860..d6b2ed7d93 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -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,