diff options
| author | Luuk de Gram <luuk@degram.dev> | 2022-01-05 20:47:04 +0100 |
|---|---|---|
| committer | Luuk de Gram <luuk@degram.dev> | 2022-01-06 20:19:47 +0100 |
| commit | 6d951aff7e32b1b0252d341e66517a9a9ee98a2d (patch) | |
| tree | d1e775e65de8a2fa91419c8c177a33db181861b2 /src/Compilation.zig | |
| parent | 0772fb0518902e06d1217b24fd11fe9ce40d295d (diff) | |
| download | zig-6d951aff7e32b1b0252d341e66517a9a9ee98a2d.tar.gz zig-6d951aff7e32b1b0252d341e66517a9a9ee98a2d.zip | |
wasm-linker: Only export symbols notated as such
This exposes a function from stage2 to stage1 to append symbols to automatically export them.
This happends under the following conditions:
- Target is wasm
- User has not provided --export/--rdynamic flags themselves.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 40aabcae36..cca07c2a34 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -165,6 +165,10 @@ emit_docs: ?EmitLoc, work_queue_wait_group: WaitGroup, astgen_wait_group: WaitGroup, +/// Exported symbol names. This is only for when the target is wasm. +/// TODO: Remove this when Stage2 becomes the default compiler as it will already have this information. +export_symbol_names: std.ArrayListUnmanaged([]const u8) = .{}, + pub const SemaError = Module.SemaError; pub const CRTFile = struct { @@ -1877,6 +1881,11 @@ pub fn destroy(self: *Compilation) void { self.work_queue_wait_group.deinit(); self.astgen_wait_group.deinit(); + for (self.export_symbol_names.items) |symbol_name| { + self.gpa.free(symbol_name); + } + self.export_symbol_names.deinit(self.gpa); + // This destroys `self`. self.arena_state.promote(gpa).deinit(); } |
