cbe: emit linksection for @export

Closes #21490
This commit is contained in:
Jacob Young 2025-02-09 09:52:26 -05:00 committed by Andrew Kelley
parent 34644511bb
commit eb7963e4c7

View File

@ -3093,6 +3093,9 @@ pub fn genExports(dg: *DeclGen, exported: Zcu.Exported, export_indices: []const
const @"export" = export_index.ptr(zcu); const @"export" = export_index.ptr(zcu);
try fwd.writeAll("zig_extern "); try fwd.writeAll("zig_extern ");
if (@"export".opts.linkage == .weak) try fwd.writeAll("zig_weak_linkage "); if (@"export".opts.linkage == .weak) try fwd.writeAll("zig_weak_linkage ");
if (@"export".opts.section.toSlice(ip)) |s| try fwd.print("zig_linksection({s}) ", .{
fmtStringLiteral(s, null),
});
const extern_name = @"export".opts.name.toSlice(ip); const extern_name = @"export".opts.name.toSlice(ip);
const is_mangled = isMangledIdent(extern_name, true); const is_mangled = isMangledIdent(extern_name, true);
const is_export = @"export".opts.name != main_name; const is_export = @"export".opts.name != main_name;