| author | |
| committer | |
| log | eaca72534c6d57acf85b7f20e76fd31302785a5e |
| tree | e1efe284c266e78b23f6a45f6373a00e67e2c1d1 |
| parent | 209fd8cb9326ed8376bf17e847209ff0598d3aa6 |
2 files changed, 16 insertions(+), 4 deletions(-)
src/link/Elf.zig+15-2| ... | ... | @@ -3585,8 +3585,21 @@ pub fn updateExports( |
| 3585 | 3585 | _ = try self.getOrCreateMetadataForDecl(decl_index); |
| 3586 | 3586 | break :blk self.decls.getPtr(decl_index).?; |
| 3587 | 3587 | }, |
| 3588 | // TODO is it possible to request export before const being lowered? | |
| 3589 | .value => |value| self.anon_decls.getPtr(value).?, | |
| 3588 | .value => |value| self.anon_decls.getPtr(value) orelse blk: { | |
| 3589 | const first_exp = exports[0]; | |
| 3590 | const res = try self.lowerAnonDecl(value, .none, first_exp.getSrcLoc(mod)); | |
| 3591 | switch (res) { | |
| 3592 | .ok => {}, | |
| 3593 | .fail => |em| { | |
| 3594 | // TODO maybe it's enough to return an error here and let Module.processExportsInner | |
| 3595 | // handle the error? | |
| 3596 | try mod.failed_exports.ensureUnusedCapacity(mod.gpa, 1); | |
| 3597 | mod.failed_exports.putAssumeCapacityNoClobber(first_exp, em); | |
| 3598 | return; | |
| 3599 | }, | |
| 3600 | } | |
| 3601 | break :blk self.anon_decls.getPtr(value).?; | |
| 3602 | }, | |
| 3590 | 3603 | }; |
| 3591 | 3604 | const sym_index = metadata.symbol_index; |
| 3592 | 3605 | const esym_index = self.symbol(sym_index).esym_index; |
test/behavior/export_builtin.zig+1-2| ... | ... | @@ -70,8 +70,7 @@ test "exporting comptime-known value" { |
| 70 | 70 | test "exporting comptime var" { |
| 71 | 71 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 72 | 72 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 73 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | |
| 74 | // if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 73 | if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest; | |
| 75 | 74 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 76 | 75 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 77 | 76 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |