mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
elf: implement exporting anon decls
This commit is contained in:
parent
209fd8cb93
commit
eaca72534c
@ -3585,8 +3585,21 @@ pub fn updateExports(
|
||||
_ = try self.getOrCreateMetadataForDecl(decl_index);
|
||||
break :blk self.decls.getPtr(decl_index).?;
|
||||
},
|
||||
// TODO is it possible to request export before const being lowered?
|
||||
.value => |value| self.anon_decls.getPtr(value).?,
|
||||
.value => |value| self.anon_decls.getPtr(value) orelse blk: {
|
||||
const first_exp = exports[0];
|
||||
const res = try self.lowerAnonDecl(value, .none, first_exp.getSrcLoc(mod));
|
||||
switch (res) {
|
||||
.ok => {},
|
||||
.fail => |em| {
|
||||
// TODO maybe it's enough to return an error here and let Module.processExportsInner
|
||||
// handle the error?
|
||||
try mod.failed_exports.ensureUnusedCapacity(mod.gpa, 1);
|
||||
mod.failed_exports.putAssumeCapacityNoClobber(first_exp, em);
|
||||
return;
|
||||
},
|
||||
}
|
||||
break :blk self.anon_decls.getPtr(value).?;
|
||||
},
|
||||
};
|
||||
const sym_index = metadata.symbol_index;
|
||||
const esym_index = self.symbol(sym_index).esym_index;
|
||||
|
||||
@ -70,8 +70,7 @@ test "exporting comptime-known value" {
|
||||
test "exporting comptime var" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
// if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user