authorgravatar for mattnite@protonmail.comMatt Knight <mattnite@protonmail.com> 2022-12-25 17:19:50-08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-12-25 20:19:50-05:00
logcf822c6ddd7e56b248ab217d38907aad38935b2f
treec92c28d8305ba760f3f661fd1685d904c97f1c4c
parentf5b6019646fe76678c993596130f03116989eb12
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

@export() with linksection option (#14035)


1 files changed, 8 insertions(+), 7 deletions(-)

src/Sema.zig+8-7
......@@ -20328,8 +20328,13 @@ fn resolveExportOptions(
2032820328 const linkage_val = try sema.resolveConstValue(block, linkage_src, linkage_operand, "linkage of exported value must be comptime-known");
2032920329 const linkage = linkage_val.toEnum(std.builtin.GlobalLinkage);
2033020330
20331 const section = try sema.fieldVal(block, src, options, "section", section_src);
20332 const section_val = try sema.resolveConstValue(block, section_src, section, "linksection of exported value must be comptime-known");
20331 const section_operand = try sema.fieldVal(block, src, options, "section", section_src);
20332 const section_opt_val = try sema.resolveConstValue(block, section_src, section_operand, "linksection of exported value must be comptime-known");
20333 const section_ty = Type.initTag(.const_slice_u8);
20334 const section = if (section_opt_val.optionalValue()) |section_val|
20335 try section_val.toAllocatedBytes(section_ty, sema.arena, sema.mod)
20336 else
20337 null;
2033320338
2033420339 const visibility_operand = try sema.fieldVal(block, src, options, "visibility", visibility_src);
2033520340 const visibility_val = try sema.resolveConstValue(block, visibility_src, visibility_operand, "visibility of exported value must be comptime-known");
......@@ -20345,14 +20350,10 @@ fn resolveExportOptions(
2034520350 });
2034620351 }
2034720352
20348 if (!section_val.isNull()) {
20349 return sema.fail(block, section_src, "TODO: implement exporting with linksection", .{});
20350 }
20351
2035220353 return std.builtin.ExportOptions{
2035320354 .name = name,
2035420355 .linkage = linkage,
20355 .section = null, // TODO
20356 .section = section,
2035620357 .visibility = visibility,
2035720358 };
2035820359}