| author | |
| committer | |
| log | fbdcb2289b3fed28792474579625a977feca0ed1 |
| tree | 0d1a71aecb870f00948a211f8bee5412e68191ec |
| parent | 0dd0ebb6e2b9030b30a4333b3e79b88500fa6aff |
3 files changed, 32 insertions(+), 10 deletions(-)
src/link/Wasm/Flush.zig+7-6| ... | ... | @@ -154,14 +154,15 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 154 | 154 | if (nav_export.name.toOptional() == entry_name) |
| 155 | 155 | wasm.entry_resolution = .fromIpNav(wasm, nav_export.nav_index); |
| 156 | 156 | } else { |
| 157 | try wasm.global_exports.append(gpa, .{ | |
| 158 | .name = nav_export.name, | |
| 159 | .global_index = Wasm.GlobalIndex.fromIpNav(wasm, nav_export.nav_index).?, | |
| 160 | }); | |
| 157 | // This is a data export because Zcu currently has no way to | |
| 158 | // export wasm globals. | |
| 161 | 159 | _ = f.missing_exports.swapRemove(nav_export.name); |
| 162 | 160 | _ = f.data_imports.swapRemove(nav_export.name); |
| 163 | // `f.global_imports` is ignored because Zcu has no way to | |
| 164 | // export wasm globals. | |
| 161 | if (!is_obj) { | |
| 162 | diags.addError("unable to export data symbol '{s}'; not emitting a relocatable", .{ | |
| 163 | nav_export.name.slice(wasm), | |
| 164 | }); | |
| 165 | } | |
| 165 | 166 | } |
| 166 | 167 | } |
| 167 | 168 |
test/behavior.zig+10-3| ... | ... | @@ -31,8 +31,6 @@ test { |
| 31 | 31 | _ = @import("behavior/error.zig"); |
| 32 | 32 | _ = @import("behavior/eval.zig"); |
| 33 | 33 | _ = @import("behavior/export_builtin.zig"); |
| 34 | _ = @import("behavior/export_self_referential_type_info.zig"); | |
| 35 | _ = @import("behavior/extern.zig"); | |
| 36 | 34 | _ = @import("behavior/field_parent_ptr.zig"); |
| 37 | 35 | _ = @import("behavior/floatop.zig"); |
| 38 | 36 | _ = @import("behavior/fn.zig"); |
| ... | ... | @@ -45,7 +43,6 @@ test { |
| 45 | 43 | _ = @import("behavior/hasfield.zig"); |
| 46 | 44 | _ = @import("behavior/if.zig"); |
| 47 | 45 | _ = @import("behavior/import.zig"); |
| 48 | _ = @import("behavior/import_c_keywords.zig"); | |
| 49 | 46 | _ = @import("behavior/incomplete_struct_param_tld.zig"); |
| 50 | 47 | _ = @import("behavior/inline_switch.zig"); |
| 51 | 48 | _ = @import("behavior/int128.zig"); |
| ... | ... | @@ -127,6 +124,16 @@ test { |
| 127 | 124 | { |
| 128 | 125 | _ = @import("behavior/export_keyword.zig"); |
| 129 | 126 | } |
| 127 | ||
| 128 | if (!builtin.cpu.arch.isWasm()) { | |
| 129 | // Due to lack of import/export of global support | |
| 130 | // (https://github.com/ziglang/zig/issues/4866), these tests correctly | |
| 131 | // cause linker errors, since a data symbol cannot be exported when | |
| 132 | // building an executable. | |
| 133 | _ = @import("behavior/export_self_referential_type_info.zig"); | |
| 134 | _ = @import("behavior/extern.zig"); | |
| 135 | _ = @import("behavior/import_c_keywords.zig"); | |
| 136 | } | |
| 130 | 137 | } |
| 131 | 138 | |
| 132 | 139 | // This bug only repros in the root file |
test/behavior/export_builtin.zig+15-1| ... | ... | @@ -6,6 +6,11 @@ test "exporting enum value" { |
| 6 | 6 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 7 | 7 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 8 | 8 | |
| 9 | if (builtin.cpu.arch.isWasm()) { | |
| 10 | // https://github.com/ziglang/zig/issues/4866 | |
| 11 | return error.SkipZigTest; | |
| 12 | } | |
| 13 | ||
| 9 | 14 | const S = struct { |
| 10 | 15 | const E = enum(c_int) { one, two }; |
| 11 | 16 | const e: E = .two; |
| ... | ... | @@ -33,6 +38,11 @@ test "exporting using namespace access" { |
| 33 | 38 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 34 | 39 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 35 | 40 | |
| 41 | if (builtin.cpu.arch.isWasm()) { | |
| 42 | // https://github.com/ziglang/zig/issues/4866 | |
| 43 | return error.SkipZigTest; | |
| 44 | } | |
| 45 | ||
| 36 | 46 | const S = struct { |
| 37 | 47 | const Inner = struct { |
| 38 | 48 | const x: u32 = 5; |
| ... | ... | @@ -46,7 +56,6 @@ test "exporting using namespace access" { |
| 46 | 56 | } |
| 47 | 57 | |
| 48 | 58 | test "exporting comptime-known value" { |
| 49 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | |
| 50 | 59 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 51 | 60 | if (builtin.zig_backend == .stage2_x86_64 and |
| 52 | 61 | (builtin.target.ofmt != .elf and |
| ... | ... | @@ -56,6 +65,11 @@ test "exporting comptime-known value" { |
| 56 | 65 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 57 | 66 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 58 | 67 | |
| 68 | if (builtin.cpu.arch.isWasm()) { | |
| 69 | // https://github.com/ziglang/zig/issues/4866 | |
| 70 | return error.SkipZigTest; | |
| 71 | } | |
| 72 | ||
| 59 | 73 | const x: u32 = 10; |
| 60 | 74 | @export(&x, .{ .name = "exporting_comptime_known_value_foo" }); |
| 61 | 75 | const S = struct { |