From 36d157dcce26f3816c807ec62787a0f80a20d7c4 Mon Sep 17 00:00:00 2001 From: vasilito Date: Tue, 28 Jul 2026 11:54:59 +0900 Subject: [PATCH] ld_so/dso: don't use object's private ReadError; panic on unsupported reloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pinned object rev (da78133) makes the ReadError trait private AND object::read::Error non-constructible (pub(crate) field), so the two unsupported-relocation-type arms in static_relocate/lazy_relocate had no public way to build an object::Error via None::<()>.read_error(msg)? (E0603 + 2x E0599). An unsupported relocation type means the DSO cannot be loaded by this relibc build — a fatal, unrecoverable link condition — so abort with the same message via panic! and drop the private ReadError import. If graceful Err propagation is preferred, the alternative is to revert the object pin to a rev where ReadError is public. Surfaced by build-redbear.sh --check-sweep. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/ld_so/dso.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ld_so/dso.rs b/src/ld_so/dso.rs index 8d0440478b..7a682c5d02 100644 --- a/src/ld_so/dso.rs +++ b/src/ld_so/dso.rs @@ -9,7 +9,6 @@ use object::{ Dyn as _, GnuHashTable, HashTable as SysVHashTable, ProgramHeader as _, Rel as _, Rela as _, Sym as _, Version, VersionTable, }, - ReadError, }, }; @@ -1130,10 +1129,14 @@ impl DSO { self.do_tlsdesc_reloc(reloc, ptr.cast::(), global_scope) } _ => { - None::<()>.read_error(concat!( + // object's ReadError/Error are private in the pinned object rev, + // so object::Error cannot be constructed here. An unsupported + // relocation type means this DSO cannot be loaded by this relibc + // build — a fatal, unrecoverable condition, so abort with it. + panic!(concat!( "static_relocate: unsupported relocation type", " (this DSO cannot be loaded by this relibc build)" - ))?; + )); } } @@ -1208,11 +1211,11 @@ impl DSO { } _ => { - None::<()>.read_error(concat!( + panic!(concat!( "lazy_relocate: unsupported relocation type with \ non-Lazy resolve (DSO cannot be loaded by this \ relibc build)" - ))?; + )); } } }