@@ -37,9 +37,11 @@ pub fn build(b: *std.Build) !void {
37
37
// Common objects
38
38
const performance_obj = b .addObject (.{
39
39
.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
+ }),
43
45
});
44
46
performance_obj .addCSourceFile (.{
45
47
.file = AFLplusplus_src_path .path (b , "afl-performance.c" ),
@@ -50,9 +52,11 @@ pub fn build(b: *std.Build) !void {
50
52
51
53
const forkserver_obj = b .addObject (.{
52
54
.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
+ }),
56
60
});
57
61
forkserver_obj .addCSourceFile (.{
58
62
.file = AFLplusplus_src_path .path (b , "afl-forkserver.c" ),
@@ -63,9 +67,11 @@ pub fn build(b: *std.Build) !void {
63
67
64
68
const sharedmem_obj = b .addObject (.{
65
69
.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
+ }),
69
75
});
70
76
71
77
sharedmem_obj .addCSourceFile (.{
@@ -78,9 +84,11 @@ pub fn build(b: *std.Build) !void {
78
84
79
85
const common_obj = b .addObject (.{
80
86
.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
+ }),
84
92
});
85
93
common_obj .addCSourceFile (.{
86
94
.file = AFLplusplus_src_path .path (b , "afl-common.c" ),
@@ -106,10 +114,12 @@ pub fn build(b: *std.Build) !void {
106
114
107
115
const fuzz_exe = b .addExecutable (.{
108
116
.name = "afl-fuzz" ,
109
- .pic = true ,
110
- .target = target ,
111
117
.version = version ,
112
- .optimize = optimize ,
118
+ .root_module = b .createModule (.{
119
+ .pic = true ,
120
+ .target = target ,
121
+ .optimize = optimize ,
122
+ }),
113
123
});
114
124
fuzz_exe .addCSourceFiles (.{
115
125
.root = AFLplusplus_src_path ,
@@ -132,10 +142,12 @@ pub fn build(b: *std.Build) !void {
132
142
133
143
const showmap_exe = b .addExecutable (.{
134
144
.name = "afl-showmap" ,
135
- .pic = true ,
136
- .target = target ,
137
145
.version = version ,
138
- .optimize = optimize ,
146
+ .root_module = b .createModule (.{
147
+ .pic = true ,
148
+ .target = target ,
149
+ .optimize = optimize ,
150
+ }),
139
151
});
140
152
showmap_exe .addCSourceFiles (.{
141
153
.root = AFLplusplus_src_path ,
@@ -160,10 +172,12 @@ pub fn build(b: *std.Build) !void {
160
172
161
173
const tmin_exe = b .addExecutable (.{
162
174
.name = "afl-tmin" ,
163
- .pic = true ,
164
- .target = target ,
165
175
.version = version ,
166
- .optimize = optimize ,
176
+ .root_module = b .createModule (.{
177
+ .pic = true ,
178
+ .target = target ,
179
+ .optimize = optimize ,
180
+ }),
167
181
});
168
182
tmin_exe .addCSourceFile (.{
169
183
.file = AFLplusplus_src_path .path (b , "afl-tmin.c" ),
@@ -187,10 +201,12 @@ pub fn build(b: *std.Build) !void {
187
201
188
202
const analyze_exe = b .addExecutable (.{
189
203
.name = "afl-analyze" ,
190
- .pic = true ,
191
- .target = target ,
192
204
.version = version ,
193
- .optimize = optimize ,
205
+ .root_module = b .createModule (.{
206
+ .pic = true ,
207
+ .target = target ,
208
+ .optimize = optimize ,
209
+ }),
194
210
});
195
211
analyze_exe .addCSourceFile (.{
196
212
.file = AFLplusplus_src_path .path (b , "afl-analyze.c" ),
@@ -212,10 +228,12 @@ pub fn build(b: *std.Build) !void {
212
228
213
229
const gotcpu_exe = b .addExecutable (.{
214
230
.name = "afl-gotcpu" ,
215
- .pic = true ,
216
- .target = target ,
217
231
.version = version ,
218
- .optimize = optimize ,
232
+ .root_module = b .createModule (.{
233
+ .pic = true ,
234
+ .target = target ,
235
+ .optimize = optimize ,
236
+ }),
219
237
});
220
238
gotcpu_exe .addCSourceFile (.{
221
239
.file = AFLplusplus_src_path .path (b , "afl-gotcpu.c" ),
@@ -234,10 +252,12 @@ pub fn build(b: *std.Build) !void {
234
252
235
253
const as_exe = b .addExecutable (.{
236
254
.name = "afl-as" ,
237
- .pic = true ,
238
- .target = target ,
239
255
.version = version ,
240
- .optimize = optimize ,
256
+ .root_module = b .createModule (.{
257
+ .pic = true ,
258
+ .target = target ,
259
+ .optimize = optimize ,
260
+ }),
241
261
});
242
262
as_exe .addCSourceFile (.{
243
263
.file = AFLplusplus_src_path .path (b , "afl-as.c" ),
@@ -259,12 +279,15 @@ pub fn build(b: *std.Build) !void {
259
279
const util_libs_step = b .step ("util_libs" , "Install utility library suite" );
260
280
261
281
if (! target .result .os .tag .isDarwin ()) {
262
- const dislocator_lib = b .addSharedLibrary (.{
282
+ const dislocator_lib = b .addLibrary (.{
263
283
.name = "dislocator" ,
264
- .pic = true ,
265
- .target = target ,
284
+ .linkage = .dynamic ,
266
285
.version = version ,
267
- .optimize = optimize ,
286
+ .root_module = b .createModule (.{
287
+ .pic = true ,
288
+ .target = target ,
289
+ .optimize = optimize ,
290
+ }),
268
291
});
269
292
dislocator_lib .addCSourceFile (.{
270
293
.file = AFLplusplus_utl_path .path (b , "libdislocator/libdislocator.so.c" ),
@@ -276,12 +299,15 @@ pub fn build(b: *std.Build) !void {
276
299
const dislocator_lib_install = b .addInstallArtifact (dislocator_lib , .{ .dylib_symlinks = false });
277
300
util_libs_step .dependOn (& dislocator_lib_install .step );
278
301
279
- const tokencap_lib = b .addSharedLibrary (.{
302
+ const tokencap_lib = b .addLibrary (.{
280
303
.name = "tokencap" ,
281
- .pic = true ,
282
- .target = target ,
283
304
.version = version ,
284
- .optimize = optimize ,
305
+ .linkage = .dynamic ,
306
+ .root_module = b .createModule (.{
307
+ .pic = true ,
308
+ .target = target ,
309
+ .optimize = optimize ,
310
+ }),
285
311
});
286
312
tokencap_lib .addCSourceFile (.{
287
313
.file = AFLplusplus_utl_path .path (b , "libtokencap/libtokencap.so.c" ),
@@ -298,12 +324,15 @@ pub fn build(b: *std.Build) !void {
298
324
}
299
325
}
300
326
301
- const socketfuzz_lib = b .addSharedLibrary (.{
327
+ const socketfuzz_lib = b .addLibrary (.{
302
328
.name = "socketfuzz" ,
303
- .pic = true ,
304
- .target = target ,
329
+ .linkage = .dynamic ,
305
330
.version = version ,
306
- .optimize = optimize ,
331
+ .root_module = b .createModule (.{
332
+ .pic = true ,
333
+ .target = target ,
334
+ .optimize = optimize ,
335
+ }),
307
336
});
308
337
socketfuzz_lib .addCSourceFile (.{
309
338
.file = AFLplusplus_utl_path .path (b , "socket_fuzzing/socketfuzz.c" ),
@@ -324,12 +353,15 @@ pub fn build(b: *std.Build) !void {
324
353
});
325
354
util_libs_step .dependOn (& socketfuzz_lib_install .step );
326
355
327
- const argvfuzz_lib = b .addSharedLibrary (.{
356
+ const argvfuzz_lib = b .addLibrary (.{
328
357
.name = "argvfuzz" ,
329
- .pic = true ,
330
- .target = target ,
358
+ .linkage = .dynamic ,
331
359
.version = version ,
332
- .optimize = optimize ,
360
+ .root_module = b .createModule (.{
361
+ .pic = true ,
362
+ .target = target ,
363
+ .optimize = optimize ,
364
+ }),
333
365
});
334
366
argvfuzz_lib .addCSourceFile (.{
335
367
.file = AFLplusplus_utl_path .path (b , "argv_fuzzing/argvfuzz.c" ),
@@ -491,9 +523,11 @@ fn setupLLVMTooling(
491
523
};
492
524
const obj = b .addObject (.{
493
525
.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
+ }),
497
531
});
498
532
obj .addCSourceFile (.{
499
533
.file = AFLplusplus_ins_path .path (b , NAME ++ ".o.c" ),
@@ -516,9 +550,11 @@ fn setupLLVMTooling(
516
550
517
551
const llvm_common_obj = b .addObject (.{
518
552
.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
+ }),
522
558
});
523
559
llvm_common_obj .addCSourceFile (.{
524
560
.file = AFLplusplus_ins_path .path (b , "afl-llvm-common.cc" ),
@@ -536,12 +572,15 @@ fn setupLLVMTooling(
536
572
llvm_lib_names .appendSliceAssumeCapacity (& LLVM_LTO_LIB_NAMES );
537
573
}
538
574
for (llvm_lib_names .constSlice ()) | name | {
539
- const lib = b .addSharedLibrary (.{
575
+ const lib = b .addLibrary (.{
576
+ .linkage = .dynamic ,
540
577
.name = name ,
541
- .pic = true ,
542
- .target = target ,
543
578
.version = version ,
544
- .optimize = optimize ,
579
+ .root_module = b .createModule (.{
580
+ .pic = true ,
581
+ .target = target ,
582
+ .optimize = optimize ,
583
+ }),
545
584
});
546
585
const file_name = if (std .mem .startsWith (u8 , name , "cmp" ) or std .mem .startsWith (u8 , name , "inj" ))
547
586
b .fmt ("{s}.cc" , .{name })
@@ -569,9 +608,11 @@ fn setupLLVMTooling(
569
608
570
609
const cc_exe = b .addExecutable (.{
571
610
.name = "afl-cc" ,
572
- .target = target ,
573
611
.version = version ,
574
- .optimize = optimize ,
612
+ .root_module = b .createModule (.{
613
+ .target = target ,
614
+ .optimize = optimize ,
615
+ }),
575
616
});
576
617
cc_exe .addCSourceFile (.{
577
618
.file = AFLplusplus_src_path .path (b , "afl-cc.c" ),
@@ -593,9 +634,11 @@ fn setupLLVMTooling(
593
634
if (enable_lto ) {
594
635
const ld_lto_exe = b .addExecutable (.{
595
636
.name = "afl-ld-lto" ,
596
- .target = target ,
597
637
.version = version ,
598
- .optimize = optimize ,
638
+ .root_module = b .createModule (.{
639
+ .target = target ,
640
+ .optimize = optimize ,
641
+ }),
599
642
});
600
643
ld_lto_exe .addCSourceFile (.{
601
644
.file = AFLplusplus_src_path .path (b , "afl-ld-lto.c" ),
0 commit comments