Changeset 5500232 in rtems for cpukit/libdl/rtl-mdreloc-arm.c


Ignore:
Timestamp:
08/08/22 14:23:48 (4 months ago)
Author:
Ryan Long <ryan.long@…>
Branches:
master
Children:
7219d3c
Parents:
c3c4525
git-author:
Ryan Long <ryan.long@…> (08/08/22 14:23:48)
git-committer:
Joel Sherrill <joel@…> (08/08/22 17:02:03)
Message:

libdl: Refactor shared code in ARM and AArch64

rtl-mdreloc-arm.c was used as the basis for rtl-mdreloc-aarch64.c. This lead
to some code being shared by the two files. The code was consolidated into
rtl-unwind-arm.c.

Closes #4686

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libdl/rtl-mdreloc-arm.c

    rc3c4525 r5500232  
    1313#include <sys/types.h>
    1414#include <sys/stat.h>
    15 #include <unwind.h>
    16 #include <unwind-arm-common.h>
    1715
    1816#include <rtems/rtl/rtl.h>
     
    2018#include "rtl-error.h"
    2119#include <rtems/rtl/rtl-trace.h>
    22 #include "rtl-unwind.h"
     20#include "rtl-unwind-arm.h"
    2321
    2422/*
     
    598596                                  false);
    599597}
    600 
    601 bool
    602 rtems_rtl_elf_unwind_parse (const rtems_rtl_obj* obj,
    603                             const char*          name,
    604                             uint32_t             flags)
    605 {
    606   /*
    607    * We location the EH sections in section flags.
    608    */
    609   return false;
    610 }
    611 
    612 bool
    613 rtems_rtl_elf_unwind_register (rtems_rtl_obj* obj)
    614 {
    615   return true;
    616 }
    617 
    618 bool
    619 rtems_rtl_elf_unwind_deregister (rtems_rtl_obj* obj)
    620 {
    621   obj->loader = NULL;
    622   return true;
    623 }
    624 
    625 /* An exception index table entry.  */
    626 typedef struct __EIT_entry
    627 {
    628   _uw fnoffset;
    629   _uw content;
    630 } __EIT_entry;
    631 
    632 /* The exception index table location in the base module */
    633 extern __EIT_entry __exidx_start;
    634 extern __EIT_entry __exidx_end;
    635 
    636 /*
    637  * A weak reference is in libgcc, provide a real version and provide a way to
    638  * manage loaded modules.
    639  *
    640  * Passed in the return address and a reference to the number of records
    641  * found. We set the start of the exidx data and the number of records.
    642  */
    643 _Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address,
    644                                      int*        nrec) __attribute__ ((__noinline__,
    645                                                                        __used__,
    646                                                                        __noclone__));
    647 
    648 _Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address,
    649                                      int*        nrec)
    650 {
    651   rtems_rtl_data*   rtl;
    652   rtems_chain_node* node;
    653   __EIT_entry*      exidx_start = &__exidx_start;
    654   __EIT_entry*      exidx_end = &__exidx_end;
    655 
    656   rtl = rtems_rtl_lock ();
    657 
    658   node = rtems_chain_first (&rtl->objects);
    659   while (!rtems_chain_is_tail (&rtl->objects, node)) {
    660     rtems_rtl_obj* obj = (rtems_rtl_obj*) node;
    661     if (rtems_rtl_obj_text_inside (obj, (void*) return_address)) {
    662       exidx_start = (__EIT_entry*) obj->eh_base;
    663       exidx_end = (__EIT_entry*) (obj->eh_base + obj->eh_size);
    664       break;
    665     }
    666     node = rtems_chain_next (node);
    667   }
    668 
    669   rtems_rtl_unlock ();
    670 
    671   *nrec = exidx_end - exidx_start;
    672 
    673   return (_Unwind_Ptr) exidx_start;
    674 }
Note: See TracChangeset for help on using the changeset viewer.