This commit is contained in:
allexanderbergmns
2026-08-25 17:07:31 +02:00
parent abe4912074
commit d11f9c8d37
12 changed files with 1215 additions and 47 deletions
+3 -1
View File
@@ -16,6 +16,7 @@ pub fn link(paths []string, out string) ! {
mut symbols := map[string]int{}
mut relocs := []obj.Reloc{}
mut lines := []obj.LineInfo{}
mut locals := []obj.DbgLocal{}
for p in paths {
o := obj.read(p)!
base := code.len
@@ -32,6 +33,7 @@ pub fn link(paths []string, out string) ! {
for l in o.lines {
lines << obj.LineInfo{ off: l.off + u32(base), line: l.line }
}
locals << o.locals
}
// resolve relocations
for r in relocs {
@@ -51,7 +53,7 @@ pub fn link(paths []string, out string) ! {
for name, entry in symbols {
fns << obj.BinFn{ name: name, entry: entry }
}
obj.write_bin(out, obj.Bin{ fns: fns, strings: strings, code: code, lines: lines })!
obj.write_bin(out, obj.Bin{ fns: fns, strings: strings, code: code, lines: lines, locals: locals })!
}
fn intern_str(mut table []string, s string) int {