zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit eb7963e4c7a0731c1ade884b9c6ae0d818bccafe (tree)
parent 34644511bb6d83aa6575641ef79e5eefb495e3e1
Author: Jacob Young <jacobly0@users.noreply.github.com>
Date:   Sun,  9 Feb 2025 09:52:26 -0500

cbe: emit linksection for `@export`

Closes #21490

Diffstat:
Msrc/codegen/c.zig | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/codegen/c.zig b/src/codegen/c.zig @@ -3093,6 +3093,9 @@ pub fn genExports(dg: *DeclGen, exported: Zcu.Exported, export_indices: []const const @"export" = export_index.ptr(zcu); try fwd.writeAll("zig_extern "); 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 is_mangled = isMangledIdent(extern_name, true); const is_export = @"export".opts.name != main_name;