@@ -37,9 +37,11 @@ pub fn build(b: *std.Build) !void {
3737 // Common objects
3838 const performance_obj = b .addObject (.{
3939 .name = "afl-performance" ,
40- .pic = true ,
41- .target = target ,
42- .optimize = optimize ,
40+ .root_module = b .createModule (.{
41+ .pic = true ,
42+ .target = target ,
43+ .optimize = optimize ,
44+ }),
4345 });
4446 performance_obj .addCSourceFile (.{
4547 .file = AFLplusplus_src_path .path (b , "afl-performance.c" ),
@@ -50,9 +52,11 @@ pub fn build(b: *std.Build) !void {
5052
5153 const forkserver_obj = b .addObject (.{
5254 .name = "afl-forkserver" ,
53- .pic = true ,
54- .target = target ,
55- .optimize = optimize ,
55+ .root_module = b .createModule (.{
56+ .pic = true ,
57+ .target = target ,
58+ .optimize = optimize ,
59+ }),
5660 });
5761 forkserver_obj .addCSourceFile (.{
5862 .file = AFLplusplus_src_path .path (b , "afl-forkserver.c" ),
@@ -63,9 +67,11 @@ pub fn build(b: *std.Build) !void {
6367
6468 const sharedmem_obj = b .addObject (.{
6569 .name = "afl-sharedmem" ,
66- .pic = true ,
67- .target = target ,
68- .optimize = optimize ,
70+ .root_module = b .createModule (.{
71+ .pic = true ,
72+ .target = target ,
73+ .optimize = optimize ,
74+ }),
6975 });
7076
7177 sharedmem_obj .addCSourceFile (.{
@@ -78,9 +84,11 @@ pub fn build(b: *std.Build) !void {
7884
7985 const common_obj = b .addObject (.{
8086 .name = "afl-common" ,
81- .pic = true ,
82- .target = target ,
83- .optimize = optimize ,
87+ .root_module = b .createModule (.{
88+ .pic = true ,
89+ .target = target ,
90+ .optimize = optimize ,
91+ }),
8492 });
8593 common_obj .addCSourceFile (.{
8694 .file = AFLplusplus_src_path .path (b , "afl-common.c" ),
@@ -106,10 +114,12 @@ pub fn build(b: *std.Build) !void {
106114
107115 const fuzz_exe = b .addExecutable (.{
108116 .name = "afl-fuzz" ,
109- .pic = true ,
110- .target = target ,
111117 .version = version ,
112- .optimize = optimize ,
118+ .root_module = b .createModule (.{
119+ .pic = true ,
120+ .target = target ,
121+ .optimize = optimize ,
122+ }),
113123 });
114124 fuzz_exe .addCSourceFiles (.{
115125 .root = AFLplusplus_src_path ,
@@ -132,10 +142,12 @@ pub fn build(b: *std.Build) !void {
132142
133143 const showmap_exe = b .addExecutable (.{
134144 .name = "afl-showmap" ,
135- .pic = true ,
136- .target = target ,
137145 .version = version ,
138- .optimize = optimize ,
146+ .root_module = b .createModule (.{
147+ .pic = true ,
148+ .target = target ,
149+ .optimize = optimize ,
150+ }),
139151 });
140152 showmap_exe .addCSourceFiles (.{
141153 .root = AFLplusplus_src_path ,
@@ -160,10 +172,12 @@ pub fn build(b: *std.Build) !void {
160172
161173 const tmin_exe = b .addExecutable (.{
162174 .name = "afl-tmin" ,
163- .pic = true ,
164- .target = target ,
165175 .version = version ,
166- .optimize = optimize ,
176+ .root_module = b .createModule (.{
177+ .pic = true ,
178+ .target = target ,
179+ .optimize = optimize ,
180+ }),
167181 });
168182 tmin_exe .addCSourceFile (.{
169183 .file = AFLplusplus_src_path .path (b , "afl-tmin.c" ),
@@ -187,10 +201,12 @@ pub fn build(b: *std.Build) !void {
187201
188202 const analyze_exe = b .addExecutable (.{
189203 .name = "afl-analyze" ,
190- .pic = true ,
191- .target = target ,
192204 .version = version ,
193- .optimize = optimize ,
205+ .root_module = b .createModule (.{
206+ .pic = true ,
207+ .target = target ,
208+ .optimize = optimize ,
209+ }),
194210 });
195211 analyze_exe .addCSourceFile (.{
196212 .file = AFLplusplus_src_path .path (b , "afl-analyze.c" ),
@@ -212,10 +228,12 @@ pub fn build(b: *std.Build) !void {
212228
213229 const gotcpu_exe = b .addExecutable (.{
214230 .name = "afl-gotcpu" ,
215- .pic = true ,
216- .target = target ,
217231 .version = version ,
218- .optimize = optimize ,
232+ .root_module = b .createModule (.{
233+ .pic = true ,
234+ .target = target ,
235+ .optimize = optimize ,
236+ }),
219237 });
220238 gotcpu_exe .addCSourceFile (.{
221239 .file = AFLplusplus_src_path .path (b , "afl-gotcpu.c" ),
@@ -234,10 +252,12 @@ pub fn build(b: *std.Build) !void {
234252
235253 const as_exe = b .addExecutable (.{
236254 .name = "afl-as" ,
237- .pic = true ,
238- .target = target ,
239255 .version = version ,
240- .optimize = optimize ,
256+ .root_module = b .createModule (.{
257+ .pic = true ,
258+ .target = target ,
259+ .optimize = optimize ,
260+ }),
241261 });
242262 as_exe .addCSourceFile (.{
243263 .file = AFLplusplus_src_path .path (b , "afl-as.c" ),
@@ -259,12 +279,15 @@ pub fn build(b: *std.Build) !void {
259279 const util_libs_step = b .step ("util_libs" , "Install utility library suite" );
260280
261281 if (! target .result .os .tag .isDarwin ()) {
262- const dislocator_lib = b .addSharedLibrary (.{
282+ const dislocator_lib = b .addLibrary (.{
263283 .name = "dislocator" ,
264- .pic = true ,
265- .target = target ,
284+ .linkage = .dynamic ,
266285 .version = version ,
267- .optimize = optimize ,
286+ .root_module = b .createModule (.{
287+ .pic = true ,
288+ .target = target ,
289+ .optimize = optimize ,
290+ }),
268291 });
269292 dislocator_lib .addCSourceFile (.{
270293 .file = AFLplusplus_utl_path .path (b , "libdislocator/libdislocator.so.c" ),
@@ -276,12 +299,15 @@ pub fn build(b: *std.Build) !void {
276299 const dislocator_lib_install = b .addInstallArtifact (dislocator_lib , .{ .dylib_symlinks = false });
277300 util_libs_step .dependOn (& dislocator_lib_install .step );
278301
279- const tokencap_lib = b .addSharedLibrary (.{
302+ const tokencap_lib = b .addLibrary (.{
280303 .name = "tokencap" ,
281- .pic = true ,
282- .target = target ,
283304 .version = version ,
284- .optimize = optimize ,
305+ .linkage = .dynamic ,
306+ .root_module = b .createModule (.{
307+ .pic = true ,
308+ .target = target ,
309+ .optimize = optimize ,
310+ }),
285311 });
286312 tokencap_lib .addCSourceFile (.{
287313 .file = AFLplusplus_utl_path .path (b , "libtokencap/libtokencap.so.c" ),
@@ -298,12 +324,15 @@ pub fn build(b: *std.Build) !void {
298324 }
299325 }
300326
301- const socketfuzz_lib = b .addSharedLibrary (.{
327+ const socketfuzz_lib = b .addLibrary (.{
302328 .name = "socketfuzz" ,
303- .pic = true ,
304- .target = target ,
329+ .linkage = .dynamic ,
305330 .version = version ,
306- .optimize = optimize ,
331+ .root_module = b .createModule (.{
332+ .pic = true ,
333+ .target = target ,
334+ .optimize = optimize ,
335+ }),
307336 });
308337 socketfuzz_lib .addCSourceFile (.{
309338 .file = AFLplusplus_utl_path .path (b , "socket_fuzzing/socketfuzz.c" ),
@@ -324,12 +353,15 @@ pub fn build(b: *std.Build) !void {
324353 });
325354 util_libs_step .dependOn (& socketfuzz_lib_install .step );
326355
327- const argvfuzz_lib = b .addSharedLibrary (.{
356+ const argvfuzz_lib = b .addLibrary (.{
328357 .name = "argvfuzz" ,
329- .pic = true ,
330- .target = target ,
358+ .linkage = .dynamic ,
331359 .version = version ,
332- .optimize = optimize ,
360+ .root_module = b .createModule (.{
361+ .pic = true ,
362+ .target = target ,
363+ .optimize = optimize ,
364+ }),
333365 });
334366 argvfuzz_lib .addCSourceFile (.{
335367 .file = AFLplusplus_utl_path .path (b , "argv_fuzzing/argvfuzz.c" ),
@@ -491,9 +523,11 @@ fn setupLLVMTooling(
491523 };
492524 const obj = b .addObject (.{
493525 .name = NAME ,
494- .pic = true ,
495- .target = target ,
496- .optimize = optimize ,
526+ .root_module = b .createModule (.{
527+ .pic = true ,
528+ .target = target ,
529+ .optimize = optimize ,
530+ }),
497531 });
498532 obj .addCSourceFile (.{
499533 .file = AFLplusplus_ins_path .path (b , NAME ++ ".o.c" ),
@@ -516,9 +550,11 @@ fn setupLLVMTooling(
516550
517551 const llvm_common_obj = b .addObject (.{
518552 .name = "afl-llvm-common" ,
519- .pic = true ,
520- .target = target ,
521- .optimize = optimize ,
553+ .root_module = b .createModule (.{
554+ .pic = true ,
555+ .target = target ,
556+ .optimize = optimize ,
557+ }),
522558 });
523559 llvm_common_obj .addCSourceFile (.{
524560 .file = AFLplusplus_ins_path .path (b , "afl-llvm-common.cc" ),
@@ -536,12 +572,15 @@ fn setupLLVMTooling(
536572 llvm_lib_names .appendSliceAssumeCapacity (& LLVM_LTO_LIB_NAMES );
537573 }
538574 for (llvm_lib_names .constSlice ()) | name | {
539- const lib = b .addSharedLibrary (.{
575+ const lib = b .addLibrary (.{
576+ .linkage = .dynamic ,
540577 .name = name ,
541- .pic = true ,
542- .target = target ,
543578 .version = version ,
544- .optimize = optimize ,
579+ .root_module = b .createModule (.{
580+ .pic = true ,
581+ .target = target ,
582+ .optimize = optimize ,
583+ }),
545584 });
546585 const file_name = if (std .mem .startsWith (u8 , name , "cmp" ) or std .mem .startsWith (u8 , name , "inj" ))
547586 b .fmt ("{s}.cc" , .{name })
@@ -569,9 +608,11 @@ fn setupLLVMTooling(
569608
570609 const cc_exe = b .addExecutable (.{
571610 .name = "afl-cc" ,
572- .target = target ,
573611 .version = version ,
574- .optimize = optimize ,
612+ .root_module = b .createModule (.{
613+ .target = target ,
614+ .optimize = optimize ,
615+ }),
575616 });
576617 cc_exe .addCSourceFile (.{
577618 .file = AFLplusplus_src_path .path (b , "afl-cc.c" ),
@@ -593,9 +634,11 @@ fn setupLLVMTooling(
593634 if (enable_lto ) {
594635 const ld_lto_exe = b .addExecutable (.{
595636 .name = "afl-ld-lto" ,
596- .target = target ,
597637 .version = version ,
598- .optimize = optimize ,
638+ .root_module = b .createModule (.{
639+ .target = target ,
640+ .optimize = optimize ,
641+ }),
599642 });
600643 ld_lto_exe .addCSourceFile (.{
601644 .file = AFLplusplus_src_path .path (b , "afl-ld-lto.c" ),
0 commit comments