aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorLuuk de Gram <luuk@degram.dev>2021-12-22 17:39:44 +0100
committerJakub Konka <kubkon@jakubkonka.com>2021-12-23 01:47:45 +0100
commite061d75cdf6a7994dd50f2d28c9f1ed3ed5ec205 (patch)
tree42c63508ee7ddd3969f343fac3bcc74789ca4960 /lib/std
parent3bd0575cfe685d52be79e1757c883c5f7e26ac0d (diff)
downloadzig-e061d75cdf6a7994dd50f2d28c9f1ed3ed5ec205.tar.gz
zig-e061d75cdf6a7994dd50f2d28c9f1ed3ed5ec205.zip
wasm-linker: Implement symbol names emitting
The linker will now emit names for all function, global and data segment symbols. This increases the ability to debug wasm modules tremendously as tools like wasm2wat can use this information to generate named functions, globals etc, rather than placeholders such as $f1.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/wasm.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/std/wasm.zig b/lib/std/wasm.zig
index f96c1bc1b9..681ac405fc 100644
--- a/lib/std/wasm.zig
+++ b/lib/std/wasm.zig
@@ -406,6 +406,22 @@ pub fn externalKind(val: ExternalKind) u8 {
return @enumToInt(val);
}
+/// Defines the enum values for each subsection id for the "Names" custom section
+/// as described by:
+/// https://webassembly.github.io/spec/core/appendix/custom.html?highlight=name#name-section
+pub const NameSubsection = enum(u8) {
+ module,
+ function,
+ local,
+ label,
+ type,
+ table,
+ memory,
+ global,
+ elem_segment,
+ data_segment,
+};
+
// type constants
pub const element_type: u8 = 0x70;
pub const function_type: u8 = 0x60;