summaryrefslogtreecommitdiff
path: root/build/agent.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build/agent.zig')
-rw-r--r--build/agent.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/build/agent.zig b/build/agent.zig
index c1e1dcc..d02880a 100644
--- a/build/agent.zig
+++ b/build/agent.zig
@@ -82,6 +82,15 @@ pub fn add(ctx: Ctx) *Compile {
exe.root_module.linkLibrary(libs[1]);
t.expect("api", "", t.record(exe.getEmittedBin(), false, &.{}, &.{}));
}
+ // Memory behind a protection key: syscalls into it, a thread made after
+ // it, a watch on it and a hook beside it (the target skips itself where
+ // there are no keys).
+ const pkey = ctx.cTarget("agent_pkey", &.{"agent_pkey.c"});
+ pkey.root_module.addIncludePath(b.path("include"));
+ pkey.root_module.linkLibrary(libs[1]);
+ t.expect("pkey", "", t.record(pkey.getEmittedBin(), false, &.{ "--syscalls", "--hook", "reader" }, &.{}));
+ b.installArtifact(pkey);
+
const api_zig = ctx.zigTarget("agent_zig", "targets/agent_zig.zig");
api_zig.root_module.addImport("ztrace-agent", module);
api_zig.use_llvm = true;