diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-12-17 21:12:01 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-01-15 15:11:35 -0800 |
| commit | 458f658b427c26ede2776a04113ba00a3a491793 (patch) | |
| tree | 0dcb397bb124a786d35697a93265305f800da7f1 /src/codegen.zig | |
| parent | 761387dc556e065e39d021bf96fb4d4c8873a145 (diff) | |
| download | zig-458f658b427c26ede2776a04113ba00a3a491793.tar.gz zig-458f658b427c26ede2776a04113ba00a3a491793.zip | |
wasm linker: implement missing logic
fix some compilation errors for reworked Emit now that it's actually
referenced
introduce DataSegment.Id for sorting data both from object files and
from the Zcu.
introduce optimization: data segment sorting includes a descending sort
on reference count so that references to data can be smaller integers
leading to better LEB encodings. this optimization is skipped for object
files.
implement uav address access function which is based on only 1 hash
table lookup to find out the offset after sorting.
Diffstat (limited to 'src/codegen.zig')
| -rw-r--r-- | src/codegen.zig | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/codegen.zig b/src/codegen.zig index f0dee770e5..df88682466 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -590,7 +590,7 @@ fn lowerPtr( const ptr = zcu.intern_pool.indexToKey(ptr_val).ptr; const offset: u64 = prev_offset + ptr.byte_offset; return switch (ptr.base_addr) { - .nav => |nav| try lowerNavRef(bin_file, pt, src_loc, nav, code, reloc_parent, offset), + .nav => |nav| try lowerNavRef(bin_file, pt, nav, code, reloc_parent, offset), .uav => |uav| try lowerUavRef(bin_file, pt, src_loc, uav, code, reloc_parent, offset), .int => try generateSymbol(bin_file, pt, src_loc, try pt.intValue(Type.usize, offset), code, reloc_parent), .eu_payload => |eu_ptr| try lowerPtr( @@ -708,13 +708,11 @@ fn lowerUavRef( fn lowerNavRef( lf: *link.File, pt: Zcu.PerThread, - src_loc: Zcu.LazySrcLoc, nav_index: InternPool.Nav.Index, code: *std.ArrayListUnmanaged(u8), reloc_parent: link.File.RelocInfo.Parent, offset: u64, ) GenerateSymbolError!void { - _ = src_loc; const zcu = pt.zcu; const gpa = zcu.gpa; const ip = &zcu.intern_pool; |
