diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-01-15 18:31:44 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-01-15 18:31:44 -0800 |
| commit | 744bb5d16a1acdabb7c078f7a1a30eefeac733cc (patch) | |
| tree | ba6e043f65776159680f703dd48b63da7e94a37e /test | |
| parent | dcb4134835e0c0bb0c130731efec741b41aba522 (diff) | |
| download | zig-744bb5d16a1acdabb7c078f7a1a30eefeac733cc.tar.gz zig-744bb5d16a1acdabb7c078f7a1a30eefeac733cc.zip | |
wasm linker: change rules about symbol visibility
export by default means export, as expected. if you want hidden
visibility then use hidden visibility.
Diffstat (limited to 'test')
| -rw-r--r-- | test/link/wasm/export/build.zig | 4 | ||||
| -rw-r--r-- | test/link/wasm/export/main-hidden.zig | 4 | ||||
| -rw-r--r-- | test/link/wasm/function-table/build.zig | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/test/link/wasm/export/build.zig b/test/link/wasm/export/build.zig index 21b185dac4..cf2c75e3b4 100644 --- a/test/link/wasm/export/build.zig +++ b/test/link/wasm/export/build.zig @@ -11,7 +11,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize const no_export = b.addExecutable(.{ .name = "no-export", .root_module = b.createModule(.{ - .root_source_file = b.path("main.zig"), + .root_source_file = b.path("main-hidden.zig"), .optimize = optimize, .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), }), @@ -36,7 +36,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize const force_export = b.addExecutable(.{ .name = "force", .root_module = b.createModule(.{ - .root_source_file = b.path("main.zig"), + .root_source_file = b.path("main-hidden.zig"), .optimize = optimize, .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), }), diff --git a/test/link/wasm/export/main-hidden.zig b/test/link/wasm/export/main-hidden.zig new file mode 100644 index 0000000000..12589d064c --- /dev/null +++ b/test/link/wasm/export/main-hidden.zig @@ -0,0 +1,4 @@ +fn foo() callconv(.c) void {} +comptime { + @export(&foo, .{ .name = "foo", .visibility = .hidden }); +} diff --git a/test/link/wasm/function-table/build.zig b/test/link/wasm/function-table/build.zig index 38a2bf1e32..f922b06aec 100644 --- a/test/link/wasm/function-table/build.zig +++ b/test/link/wasm/function-table/build.zig @@ -40,7 +40,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize check_export.checkInHeaders(); check_export.checkExact("Section export"); - check_export.checkExact("entries 2"); + check_export.checkExact("entries 3"); check_export.checkExact("name __indirect_function_table"); // as per linker specification check_export.checkExact("kind table"); |
