authorgravatar for 19855629+SuperAuguste@users.noreply.github.comSuperAuguste <19855629+SuperAuguste@users.noreply.github.com> 2025-04-08 02:26:23-04:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-09 15:03:17+02:00
log4ab34b142ef53ecb5e469b0494e5ab8ff322769c
tree5da0b1e5f62afcfbceea03935d5a40cba9f6a83f
parentfbb297fd2a666eca9c89b2afce7464abcc7daeec
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

Fix mach-o naming for sancov sections


1 files changed, 11 insertions(+), 2 deletions(-)

src/codegen/llvm.zig+11-2
......@@ -1769,7 +1769,12 @@ pub const Object = struct {
17691769 try o.used.append(gpa, counters_variable.toConst(&o.builder));
17701770 counters_variable.setLinkage(.private, &o.builder);
17711771 counters_variable.setAlignment(comptime Builder.Alignment.fromByteUnits(1), &o.builder);
1772 counters_variable.setSection(try o.builder.string("__sancov_cntrs"), &o.builder);
1772
1773 if (target.ofmt == .macho) {
1774 counters_variable.setSection(try o.builder.string("__DATA,__sancov_cntrs"), &o.builder);
1775 } else {
1776 counters_variable.setSection(try o.builder.string("__sancov_cntrs"), &o.builder);
1777 }
17731778
17741779 break :f .{
17751780 .counters_variable = counters_variable,
......@@ -1831,7 +1836,11 @@ pub const Object = struct {
18311836 pcs_variable.setLinkage(.private, &o.builder);
18321837 pcs_variable.setMutability(.constant, &o.builder);
18331838 pcs_variable.setAlignment(Type.usize.abiAlignment(zcu).toLlvm(), &o.builder);
1834 pcs_variable.setSection(try o.builder.string("__sancov_pcs1"), &o.builder);
1839 if (target.ofmt == .macho) {
1840 pcs_variable.setSection(try o.builder.string("__DATA,__sancov_pcs1"), &o.builder);
1841 } else {
1842 pcs_variable.setSection(try o.builder.string("__sancov_pcs1"), &o.builder);
1843 }
18351844 try pcs_variable.setInitializer(init_val, &o.builder);
18361845 }
18371846