Unwind glue: Fix dl_unwind_find_exidx implementation #193

Merged
sb10q merged 1 commits from occheung/artiq-zynq:fix-find-exidx into master 2024-08-17 17:37:22 +08:00
2 changed files with 7 additions and 7 deletions

View File

@ -138,7 +138,7 @@ impl Library {
reloc::rebind(self.arch, self, name, addr as Elf32_Word) reloc::rebind(self.arch, self, name, addr as Elf32_Word)
} }
pub fn exidx(&self) -> &[u32] { pub fn exidx(&self) -> &[EXIDX_Entry] {
self.image.get_ref_slice_unchecked(&self.exidx) self.image.get_ref_slice_unchecked(&self.exidx)
} }
} }

View File

@ -13,7 +13,7 @@ use libcortex_a9::{
}; };
use libboard_zynq::{mpcore, gic}; use libboard_zynq::{mpcore, gic};
use libsupport_zynq::ram; use libsupport_zynq::ram;
use dyld::{self, Library}; use dyld::{self, Library, elf::EXIDX_Entry};
use crate::{eh_artiq, get_async_errors, rtio}; use crate::{eh_artiq, get_async_errors, rtio};
use super::{ use super::{
api::resolve, api::resolve,
@ -31,8 +31,8 @@ use super::{
extern "C" { extern "C" {
static __text_start: u32; static __text_start: u32;
static __text_end: u32; static __text_end: u32;
static __exidx_start: u32; static __exidx_start: EXIDX_Entry;
static __exidx_end: u32; static __exidx_end: EXIDX_Entry;
} }
unsafe fn attribute_writeback(typeinfo: *const ()) { unsafe fn attribute_writeback(typeinfo: *const ()) {
@ -217,10 +217,10 @@ pub fn terminate(exceptions: &'static [Option<eh_artiq::Exception<'static>>],
#[no_mangle] #[no_mangle]
extern fn dl_unwind_find_exidx(pc: *const u32, len_ptr: *mut u32) -> *const u32 { extern fn dl_unwind_find_exidx(pc: *const u32, len_ptr: *mut u32) -> *const u32 {
let length; let length;
let start: *const u32; let start: *const EXIDX_Entry;
unsafe { unsafe {
if &__text_start as *const u32 <= pc && pc < &__text_end as *const u32 { if &__text_start as *const u32 <= pc && pc < &__text_end as *const u32 {
length = (&__exidx_end as *const u32).offset_from(&__exidx_start) as u32; length = (&__exidx_end as *const EXIDX_Entry).offset_from(&__exidx_start) as u32;
start = &__exidx_start; start = &__exidx_start;
} else { } else {
let exidx = KERNEL_IMAGE.as_ref() let exidx = KERNEL_IMAGE.as_ref()
@ -231,7 +231,7 @@ extern fn dl_unwind_find_exidx(pc: *const u32, len_ptr: *mut u32) -> *const u32
} }
*len_ptr = length; *len_ptr = length;
} }
start start as *const u32
} }
pub extern fn rtio_get_destination_status(destination: i32) -> bool { pub extern fn rtio_get_destination_status(destination: i32) -> bool {