@@ -1471,7 +1471,12 @@ pub const Object = struct {
1471
1471
try o.used.append(gpa, counters_variable.toConst(&o.builder));
1472
1472
counters_variable.setLinkage(.private, &o.builder);
1473
1473
counters_variable.setAlignment(comptime Builder.Alignment.fromByteUnits(1), &o.builder);
1474
- counters_variable.setSection(try o.builder.string("__sancov_cntrs"), &o.builder);
1474
+
1475
+ if (target.ofmt == .macho) {
1476
+ counters_variable.setSection(try o.builder.string("__DATA,__sancov_cntrs"), &o.builder);
1477
+ } else {
1478
+ counters_variable.setSection(try o.builder.string("__sancov_cntrs"), &o.builder);
1479
+ }
1475
1480
1476
1481
break :f .{
1477
1482
.counters_variable = counters_variable,
@@ -1533,7 +1538,11 @@ pub const Object = struct {
1533
1538
pcs_variable.setLinkage(.private, &o.builder);
1534
1539
pcs_variable.setMutability(.constant, &o.builder);
1535
1540
pcs_variable.setAlignment(Type.usize.abiAlignment(zcu).toLlvm(), &o.builder);
1536
- pcs_variable.setSection(try o.builder.string("__sancov_pcs1"), &o.builder);
1541
+ if (target.ofmt == .macho) {
1542
+ pcs_variable.setSection(try o.builder.string("__DATA,__sancov_pcs1"), &o.builder);
1543
+ } else {
1544
+ pcs_variable.setSection(try o.builder.string("__sancov_pcs1"), &o.builder);
1545
+ }
1537
1546
try pcs_variable.setInitializer(init_val, &o.builder);
1538
1547
}
1539
1548
0 commit comments