From bfeefd0cbdbdd7e2b1712253ac81e3e8ba09283b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 8 Jun 2026 22:36:33 -0300 Subject: fixing 0.16 errors and cleanup --- build.zig | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'build.zig') 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 }, }; -- cgit v1.3