mirror of
https://github.com/HeyPuter/gex.git
synced 2026-11-13 20:12:43 -10:00
fjit (page): PLT stubs are entries, not inside a function
.plt has one FDE for all its stubs; declining them sent unit calls through the fallback (hp9 died in p_memcpy). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_1896c5b302a54696aaa92c5f4047f20b
This commit is contained in:
1 parent
eaf4aa1ddb
commit
6bc615693e
1 file changed
+12
-1
@@ -256,7 +256,18 @@ fn mid_function(addr: u64) -> bool {
|
||||
Some(o) => o,
|
||||
None => {
|
||||
let bytes = crate::with_host(|h| h.kernel.read_file(&path)).unwrap_or_default();
|
||||
let mut f: Vec<(u64, u64)> = gex_xlate::ehframe::fdes(&bytes, 0).into_iter().map(|f| (f.start, f.end)).collect();
|
||||
// Not the PLT's: one FDE covers all of `.plt`, whose stubs are
|
||||
// each an entry (hp9 left them to the fallback, and died).
|
||||
let plt: Vec<(u64, u64)> = gex_xlate::ehframe::sections(&bytes)
|
||||
.into_iter()
|
||||
.filter(|s| s.name.starts_with(".plt"))
|
||||
.map(|s| (s.addr, s.addr + s.size))
|
||||
.collect();
|
||||
let mut f: Vec<(u64, u64)> = gex_xlate::ehframe::fdes(&bytes, 0)
|
||||
.into_iter()
|
||||
.filter(|f| !plt.iter().any(|&(lo, hi)| f.start >= lo && f.start < hi))
|
||||
.map(|f| (f.start, f.end))
|
||||
.collect();
|
||||
f.sort_unstable();
|
||||
let o = std::sync::Arc::new((f, loads(&bytes)));
|
||||
lock(&FDES).get_or_insert_with(Default::default).insert(path.clone(), o.clone());
|
||||
|
||||
Reference in new issue
Block a user