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 04:48:39+02:00
log227788e6d5025933d6d70086fb939dcf487fee0a
tree768b54387f1fb5d1b004d50b38481d56a9e525ca
parent9bbac4288697f056f0cdb0c6ac597e9b1b18ea12

Fix mach-o naming for sancov sections


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

src/codegen/llvm.zig+11-2
...@@ -1471,7 +1471,12 @@ pub const Object = struct {...@@ -1471,7 +1471,12 @@ pub const Object = struct {
1471 try o.used.append(gpa, counters_variable.toConst(&o.builder));1471 try o.used.append(gpa, counters_variable.toConst(&o.builder));
1472 counters_variable.setLinkage(.private, &o.builder);1472 counters_variable.setLinkage(.private, &o.builder);
1473 counters_variable.setAlignment(comptime Builder.Alignment.fromByteUnits(1), &o.builder);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 }
14751480
1476 break :f .{1481 break :f .{
1477 .counters_variable = counters_variable,1482 .counters_variable = counters_variable,
...@@ -1533,7 +1538,11 @@ pub const Object = struct {...@@ -1533,7 +1538,11 @@ pub const Object = struct {
1533 pcs_variable.setLinkage(.private, &o.builder);1538 pcs_variable.setLinkage(.private, &o.builder);
1534 pcs_variable.setMutability(.constant, &o.builder);1539 pcs_variable.setMutability(.constant, &o.builder);
1535 pcs_variable.setAlignment(Type.usize.abiAlignment(zcu).toLlvm(), &o.builder);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 try pcs_variable.setInitializer(init_val, &o.builder);1546 try pcs_variable.setInitializer(init_val, &o.builder);
1538 }1547 }
15391548