ld_so/dso: don't use object's private ReadError; panic on unsupported reloc
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) <noreply@anthropic.com>
This commit is contained in:
+8
-5
@@ -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::<usize>(), 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)"
|
||||
))?;
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user