mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
add libfuzzer to linking
This commit is contained in:
parent
7802cf9814
commit
b9225aea78
@ -460,6 +460,10 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_no
|
||||
try argv.append(comp.libunwind_static_lib.?.full_object_path);
|
||||
}
|
||||
|
||||
if (comp.config.any_fuzz) {
|
||||
try argv.append(comp.fuzzer_lib.?.full_object_path);
|
||||
}
|
||||
|
||||
if (is_exe_or_dyn_lib and !comp.skip_linker_dependencies) {
|
||||
if (!comp.config.link_libc) {
|
||||
if (comp.libc_static_lib) |lib| {
|
||||
|
||||
@ -1144,11 +1144,14 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod
|
||||
_ = try rpath_table.put(rpath, {});
|
||||
}
|
||||
|
||||
// TSAN
|
||||
if (comp.config.any_sanitize_thread) {
|
||||
try positionals.append(.{ .path = comp.tsan_lib.?.full_object_path });
|
||||
}
|
||||
|
||||
if (comp.config.any_fuzz) {
|
||||
try positionals.append(.{ .path = comp.fuzzer_lib.?.full_object_path });
|
||||
}
|
||||
|
||||
// libc
|
||||
if (!comp.skip_linker_dependencies and !comp.config.link_libc) {
|
||||
if (comp.libc_static_lib) |lib| {
|
||||
@ -1607,6 +1610,10 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
|
||||
try argv.append(comp.tsan_lib.?.full_object_path);
|
||||
}
|
||||
|
||||
if (comp.config.any_fuzz) {
|
||||
try argv.append(comp.fuzzer_lib.?.full_object_path);
|
||||
}
|
||||
|
||||
// libc
|
||||
if (!comp.skip_linker_dependencies and !comp.config.link_libc) {
|
||||
if (comp.libc_static_lib) |lib| {
|
||||
@ -2272,6 +2279,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s
|
||||
man.hash.add(self.bind_global_refs_locally);
|
||||
man.hash.add(self.compress_debug_sections);
|
||||
man.hash.add(comp.config.any_sanitize_thread);
|
||||
man.hash.add(comp.config.any_fuzz);
|
||||
man.hash.addOptionalBytes(comp.sysroot);
|
||||
|
||||
// We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
|
||||
@ -2616,6 +2624,10 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s
|
||||
try argv.append(comp.tsan_lib.?.full_object_path);
|
||||
}
|
||||
|
||||
if (comp.config.any_fuzz) {
|
||||
try argv.append(comp.fuzzer_lib.?.full_object_path);
|
||||
}
|
||||
|
||||
// libc
|
||||
if (is_exe_or_dyn_lib and
|
||||
!comp.skip_linker_dependencies and
|
||||
|
||||
@ -389,11 +389,14 @@ pub fn flushModule(self: *MachO, arena: Allocator, tid: Zcu.PerThread.Id, prog_n
|
||||
|
||||
if (module_obj_path) |path| try positionals.append(.{ .path = path });
|
||||
|
||||
// TSAN
|
||||
if (comp.config.any_sanitize_thread) {
|
||||
try positionals.append(.{ .path = comp.tsan_lib.?.full_object_path });
|
||||
}
|
||||
|
||||
if (comp.config.any_fuzz) {
|
||||
try positionals.append(.{ .path = comp.fuzzer_lib.?.full_object_path });
|
||||
}
|
||||
|
||||
for (positionals.items) |obj| {
|
||||
self.parsePositional(obj.path, obj.must_link) catch |err| switch (err) {
|
||||
error.MalformedObject,
|
||||
@ -462,6 +465,11 @@ pub fn flushModule(self: *MachO, arena: Allocator, tid: Zcu.PerThread.Id, prog_n
|
||||
};
|
||||
}
|
||||
|
||||
if (comp.fuzzer_lib) |fuzzer_lib| {
|
||||
_ = fuzzer_lib.full_object_path;
|
||||
log.err("TODO macho linking code for adding libfuzzer", .{});
|
||||
}
|
||||
|
||||
// Finally, link against compiler_rt.
|
||||
const compiler_rt_path: ?[]const u8 = blk: {
|
||||
if (comp.compiler_rt_lib) |x| break :blk x.full_object_path;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user