From 41483c5ae3da877690c5207c0dc0d54026261cc1 Mon Sep 17 00:00:00 2001 From: mahaloz Date: Mon, 26 Oct 2026 00:13:33 +0000 Subject: [PATCH] [AUTOMATED] Pin the fatstr-records witness to a runtime-indexed table (rustc 1.99 emits no record for println pieces) CI runs rustc 1.99.1, whose format lowering no longer materializes a (ptr,len) record for a println literal piece - no relocation and no pointer word reference the piece anywhere in the image (measured against 1.90.0, where the pieces record carries the relocated slot the e2e was pinned to). A bare static &str is likewise const-folded into code at -O. The witness is now a runtime-indexed [&str; 3] table, which cannot fold and emits three records in .data.rel.ro under both toolchains (verified: RELATIVE slot with the 21-byte length companion on 1.90.0 and 1.99.1); it is also the shape the record pass most often feeds on in real binaries. Test-only change. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01WoTv7T2Ep5hmbZcyYSMk1g --- .../kuna-console/tests/verify_fatstr_records.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/decompiler/crates/kuna-console/tests/verify_fatstr_records.rs b/decompiler/crates/kuna-console/tests/verify_fatstr_records.rs index c9b885422..1c2753f25 100644 --- a/decompiler/crates/kuna-console/tests/verify_fatstr_records.rs +++ b/decompiler/crates/kuna-console/tests/verify_fatstr_records.rs @@ -24,12 +24,21 @@ use kuna_base::address::Address; use kuna_console::engine::{bootstrap_from_object, ConsoleProgram}; use object::read::{Object, ObjectSection}; -/// The first format piece of the fixture's `println!` — 21 bytes, no NUL. +/// The first entry of the fixture's runtime-indexed table — 21 bytes, no NUL. const WITNESS: &[u8] = b"kuna fatstr witness, "; -const MAIN_RS: &str = r#"fn main() { - let who = std::env::args().nth(1).unwrap_or_default(); - println!("kuna fatstr witness, {who}!"); +/// A RUNTIME-INDEXED `&str` table, not a `println!` piece: rustc 1.99 lowered +/// the format machinery so a literal piece no longer materializes a +/// `(ptr, len)` record anywhere in the image (no relocation, no pointer word — +/// measured on 1.99.1 vs 1.90.0), and a bare `static &str` is const-folded +/// into code at `-O`. An index only the arguments decide forces the table — +/// three records in `.data.rel.ro` under every rustc this test has met — which +/// is also the real-world shape the record pass most often feeds on. +const MAIN_RS: &str = r#"static TABLE: [&str; 3] = + ["kuna fatstr witness, ", "kuna second piece", "kuna third piece"]; +fn main() { + let i = std::env::args().len() % 3; + println!("{}!", TABLE[i]); } "#;