summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-06-08 22:36:33 -0300
committerGabriel Schneider <[email protected]>2026-06-08 23:05:25 -0300
commitbfeefd0cbdbdd7e2b1712253ac81e3e8ba09283b (patch)
tree7687391929b1cc90000c00d8e64d06c22387a10e /build.zig
parent34de4c7fa3a740eed14bd58b778728942bf0b005 (diff)
downloadcodenomicon-main.tar.gz
codenomicon-main.zip
fixing 0.16 errors and cleanupHEADmain
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig35
1 files changed, 10 insertions, 25 deletions
diff --git a/build.zig b/build.zig
index d147c28..95afa3b 100644
--- a/build.zig
+++ b/build.zig
@@ -1,20 +1,21 @@
const std = @import("std");
-const frida = @import("build/frida-gum.zig");
const capstone = @import("build/capstone.zig").capstone;
pub fn build(b: *std.Build) !void {
- const target = b.standardTargetOptions(.{});
+ // A plain native build links against the host's glibc CRT objects
+ // (/usr/lib/crt1.o). Recent toolchains emit `.sframe` unwind sections whose
+ // R_X86_64_PC64 relocations Zig 0.16's self-hosted ELF linker cannot yet
+ // handle, producing "unhandled relocation type" link errors. By defaulting
+ // to an explicit-ABI (but otherwise native) target, Zig builds and links
+ // its own bundled CRT instead, sidestepping the issue while keeping native
+ // CPU/OS tuning. An explicit `-Dtarget=` still overrides this default.
+ const target = b.standardTargetOptions(.{
+ .default_target = .{ .abi = b.graph.host.result.abi },
+ });
const optimize = b.standardOptimizeOption(.{});
const vaxis_dep = b.dependency("vaxis", .{});
- const gloves_module = b.createModule(.{
- .root_source_file = b.path("src/gloves.zig"),
- .target = target,
- .optimize = optimize,
- .link_libc = true,
- });
-
const elfo = b.addExecutable(.{
.name = "elfo",
.root_module = b.createModule(.{
@@ -42,27 +43,12 @@ pub fn build(b: *std.Build) !void {
.target = target,
});
- const frida_lib = frida.gum_stalker(b, .{
- .optimize = optimize,
- .target = target,
- });
-
- frida_lib.step.dependOn(&capstone_lib.step);
- frida_lib.root_module.linkLibrary(capstone_lib);
-
b.installArtifact(capstone_lib);
- b.installArtifact(frida_lib);
elfo.root_module.linkLibrary(capstone_lib);
elfo.root_module.addImport("capstone", capstone_lib.root_module);
- const gloves = b.addExecutable(.{
- .name = "gloves",
- .root_module = gloves_module,
- });
-
b.installArtifact(elfo);
- b.installArtifact(gloves);
const opt_gdb = b.option(bool, "gdb", "Run executable under gdb") orelse false;
const comp_opts = b.addOptions();
@@ -130,7 +116,6 @@ pub fn build(b: *std.Build) !void {
const run_steps = [_]struct { *std.Build.Step, *std.Build.Step.Compile }{
.{ test_step, unit_tests },
.{ b.step("elfo", "See the pretty elfo!"), elfo },
- .{ b.step("gloves", "See the pretty gloves!"), gloves },
.{ b.step("shock", "SHOCK something!"), shock },
};