From 49ae70ec2c6dbc4a52e8464d7e4b64314b655d79 Mon Sep 17 00:00:00 2001 From: Pascal Zittlau Date: Mon, 8 Dec 2025 09:56:00 +0100 Subject: [PATCH] try other allocation for relocation overflow --- src/Patcher.zig | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Patcher.zig b/src/Patcher.zig index d25d96e..6464f8c 100644 --- a/src/Patcher.zig +++ b/src/Patcher.zig @@ -623,18 +623,21 @@ fn attemptNeighborEviction( .old_addr = @intFromPtr(request.bytes.ptr), }; } - try commitTrampoline( + commitTrampoline( trampoline, patch_flicken.bytes, reloc_info, @intFromPtr(request.bytes.ptr) + request.size, - ); + ) catch |err| switch (err) { + error.RelocationOverflow => continue, + else => return err, + }; } // 2. Write Victim Trampoline (J_Victim target) { const trampoline: [*]u8 = @ptrFromInt(victim_range.getStart(u64)); - try commitTrampoline( + commitTrampoline( trampoline, victim_orig_bytes[0..victim_size], .{ @@ -642,7 +645,10 @@ fn attemptNeighborEviction( .old_addr = @intFromPtr(victim_bytes_all.ptr), }, @intFromPtr(victim_bytes_all.ptr) + victim_size, - ); + ) catch |err| switch (err) { + error.RelocationOverflow => continue, + else => return err, + }; } // 3. Write J_Victim (overwrites head of J_Patch which is fine)