Skip to content

Commit 352b39d

Browse files
committed
fix macho linker integration with libfuzzer
1 parent 3c6ac5e commit 352b39d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/link/MachO.zig

+4-5
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,6 @@ pub fn flushModule(self: *MachO, arena: Allocator, tid: Zcu.PerThread.Id, prog_n
465465
};
466466
}
467467

468-
if (comp.fuzzer_lib) |fuzzer_lib| {
469-
_ = fuzzer_lib.full_object_path;
470-
log.err("TODO macho linking code for adding libfuzzer", .{});
471-
}
472-
473468
// Finally, link against compiler_rt.
474469
const compiler_rt_path: ?[]const u8 = blk: {
475470
if (comp.compiler_rt_lib) |x| break :blk x.full_object_path;
@@ -767,6 +762,10 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void {
767762
try argv.appendSlice(&.{ "-rpath", std.fs.path.dirname(path) orelse "." });
768763
}
769764

765+
if (comp.config.any_fuzz) {
766+
try argv.append(comp.fuzzer_lib.?.full_object_path);
767+
}
768+
770769
for (self.lib_dirs) |lib_dir| {
771770
const arg = try std.fmt.allocPrint(arena, "-L{s}", .{lib_dir});
772771
try argv.append(arg);

0 commit comments

Comments
 (0)