aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/pkg/afl++
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/pkg/afl++
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/pkg/afl++')
-rw-r--r--vendor/libghostty-vt/pkg/afl++/build.zig24
1 files changed, 19 insertions, 5 deletions
diff --git a/vendor/libghostty-vt/pkg/afl++/build.zig b/vendor/libghostty-vt/pkg/afl++/build.zig
index 9f6f70e9..42e514a0 100644
--- a/vendor/libghostty-vt/pkg/afl++/build.zig
+++ b/vendor/libghostty-vt/pkg/afl++/build.zig
@@ -9,11 +9,6 @@ pub fn addInstrumentedExe(
b: *std.Build,
obj: *std.Build.Step.Compile,
) std.Build.LazyPath {
- // Force the build system to produce the binary artifact even though we
- // only consume the LLVM bitcode below. Without this, the dependency
- // tracking doesn't wire up correctly.
- _ = obj.getEmittedBin();
-
const pkg = b.dependencyFromBuildZig(
@This(),
.{},
@@ -34,6 +29,25 @@ pub fn addInstrumentedExe(
const fuzz_exe = afl_cc.addOutputFileArg(obj.name);
afl_cc.addFileArg(pkg.path("afl.c"));
afl_cc.addFileArg(obj.getEmittedLlvmBc());
+
+ // The LLVM bitcode only contains the Zig code in the compilation.
+ // C source files in the module graph are compiled to native objects
+ // that live only in the static archive, so link the archive after
+ // the bitcode to resolve those symbols. The archive members holding
+ // the Zig code are never pulled in (and so can't conflict) because
+ // the bitcode object already defines every symbol they provide.
+ // Those C objects are built with UBSan in debug modes and we link
+ // with an external compiler that doesn't provide Zig's ubsan
+ // runtime, so it must be bundled. The ubsan runtime uses f128
+ // conversion builtins that the external compiler's runtime may not
+ // provide (e.g. Apple's), so Zig's compiler-rt must be bundled too.
+ // The archive members must also be built as PIC since external
+ // compilers typically default to PIE executables.
+ obj.bundle_ubsan_rt = true;
+ obj.bundle_compiler_rt = true;
+ obj.root_module.pic = true;
+ afl_cc.addFileArg(obj.getEmittedBin());
+
return fuzz_exe;
}