[PATCH v1 3/5] cpukit/libdl: Add support for AArch64

Chris Johns chrisj at rtems.org
Thu Jul 21 22:33:16 UTC 2022


On 22/7/2022 1:11 am, Ryan Long wrote:
> On 7/20/2022 11:39 PM, Chris Johns wrote:
>> On 21/7/2022 7:36 am, Ryan Long wrote:
>>> rtl-mdreloc-aarch64.c and elf_machdep.h came from NetBSD.
>>> +bool
>>> +rtems_rtl_elf_unwind_deregister (rtems_rtl_obj* obj)
>>> +{
>>> +  obj->loader = NULL;
>> You cannot touch this field. It belongs to the format loader.
> I copied this method from rtl-mdreloc-arm.c, and it's the same way there.

I think it is wrong in both places.

Should these calls also be moved to rtl-unwind-arm.[ch]?

>>> +_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address,
>>> +                                     int*        nrec)
>>> +{
>>> +  rtems_rtl_data*   rtl;
>>> +  rtems_chain_node* node;
>>> +  __EIT_entry*      exidx_start = &__exidx_start;
>>> +  __EIT_entry*      exidx_end = &__exidx_end;
>>> +
>>> +  rtl = rtems_rtl_lock ();
>>> +
>>> +  node = rtems_chain_first (&rtl->objects);
>>> +  while (!rtems_chain_is_tail (&rtl->objects, node)) {
>>> +    rtems_rtl_obj* obj = (rtems_rtl_obj*) node;
>>> +    if (rtems_rtl_obj_text_inside (obj, (void*) return_address)) {
>>> +      exidx_start = (__EIT_entry*) obj->eh_base;
>>> +      exidx_end = (__EIT_entry*) (obj->eh_base + obj->eh_size);
>>> +      break;
>>> +    }
>>> +    node = rtems_chain_next (node);
>>> +  }
>> Can the RTL chain iterator be used here?
> I got this from rtl-mdreloc-arm.c.

I think using the iterator would a good change once the code moves.

>>> +
>>> +  rtems_rtl_unlock ();
>>> +
>>> +  *nrec = exidx_end - exidx_start;
>>> +
>>> +  return (_Unwind_Ptr) exidx_start;
>>> +}
>> Can this exception unwind support be placed in rtl-unwind-arm.[ch]?
>>
>> I suppose you will need to reference the call from here to bring the symbol into
>> the link and override the weak version in gcc?
>>
>> Chris
> Is it alright if I implement this and take it out of rtl-mdreloc-aarch64.c and
> rtl-mdreloc-arm.c in a follow up patch?

Of course and thanks.

Chris


More information about the devel mailing list