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-aarch64.c

    rc3c4525 r5500232  
    7474#include <sys/stat.h>
    7575#include <sys/endian.h>
    76 #include <unwind.h>
    7776
    7877#include <rtems/rtl/rtl.h>
     
    8079#include "rtl-error.h"
    8180#include <rtems/rtl/rtl-trace.h>
    82 #include "rtl-unwind.h"
    83 
    84 typedef unsigned _Unwind_Word __attribute__((__mode__(__word__)));
    85 typedef _Unwind_Word _uw;
     81#include "rtl-unwind-arm.h"
    8682
    8783struct tls_data {
     
    523519  return rtems_rtl_elf_rel_failure;
    524520}
    525 
    526 bool
    527 rtems_rtl_elf_unwind_parse (const rtems_rtl_obj* obj,
    528                             const char*          name,
    529                             uint32_t             flags)
    530 {
    531   /*
    532    * We location the EH sections in section flags.
    533    */
    534   return false;
    535 }
    536 
    537 bool
    538 rtems_rtl_elf_unwind_register (rtems_rtl_obj* obj)
    539 {
    540   return true;
    541 }
    542 
    543 bool
    544 rtems_rtl_elf_unwind_deregister (rtems_rtl_obj* obj)
    545 {
    546   obj->loader = NULL;
    547   return true;
    548 }
    549 
    550 /* An exception index table entry.  */
    551 typedef struct __EIT_entry
    552 {
    553   _uw fnoffset;
    554   _uw content;
    555 } __EIT_entry;
    556 
    557 /* The exception index table location in the base module */
    558 extern __EIT_entry __exidx_start;
    559 extern __EIT_entry __exidx_end;
    560 
    561 /*
    562  * A weak reference is in libgcc, provide a real version and provide a way to
    563  * manage loaded modules.
    564  *
    565  * Passed in the return address and a reference to the number of records
    566  * found. We set the start of the exidx data and the number of records.
    567  */
    568 _Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address,
    569                                      int*        nrec) __attribute__ ((__noinline__,
    570                                                                        __used__,
    571                                                                        __noclone__));
    572 
    573 _Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address,
    574                                      int*        nrec)
    575 {
    576   rtems_rtl_data*   rtl;
    577   rtems_chain_node* node;
    578   __EIT_entry*      exidx_start = &__exidx_start;
    579   __EIT_entry*      exidx_end = &__exidx_end;
    580 
    581   rtl = rtems_rtl_lock ();
    582 
    583   node = rtems_chain_first (&rtl->objects);
    584   while (!rtems_chain_is_tail (&rtl->objects, node)) {
    585     rtems_rtl_obj* obj = (rtems_rtl_obj*) node;
    586     if (rtems_rtl_obj_text_inside (obj, (void*) return_address)) {
    587       exidx_start = (__EIT_entry*) obj->eh_base;
    588       exidx_end = (__EIT_entry*) (obj->eh_base + obj->eh_size);
    589       break;
    590     }
    591     node = rtems_chain_next (node);
    592   }
    593 
    594   rtems_rtl_unlock ();
    595 
    596   *nrec = exidx_end - exidx_start;
    597 
    598   return (_Unwind_Ptr) exidx_start;
    599 }
Note: See TracChangeset for help on using the changeset viewer.