diff options
author | Ryan Long <ryan.long@oarcorp.com> | 2022-08-08 09:23:48 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2022-08-08 12:02:03 -0500 |
commit | 5500232a8989ecad90a44a1051896ad9b53d6732 (patch) | |
tree | c62165f069aceb06590954ac14a2d347966bf562 /cpukit/libdl/rtl-unwind-arm.c | |
parent | posix: Avoid dead code in clock_nanosleep() (diff) | |
download | rtems-5500232a8989ecad90a44a1051896ad9b53d6732.tar.bz2 |
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
Diffstat (limited to 'cpukit/libdl/rtl-unwind-arm.c')
-rw-r--r-- | cpukit/libdl/rtl-unwind-arm.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/cpukit/libdl/rtl-unwind-arm.c b/cpukit/libdl/rtl-unwind-arm.c new file mode 100644 index 0000000000..35361fe8d5 --- /dev/null +++ b/cpukit/libdl/rtl-unwind-arm.c @@ -0,0 +1,65 @@ +#include "rtl-unwind-arm.h" + +bool +rtems_rtl_elf_unwind_parse (const rtems_rtl_obj* obj, + const char* name, + uint32_t flags) +{ + /* + * We location the EH sections in section flags. + */ + return false; +} + +bool +rtems_rtl_elf_unwind_register (rtems_rtl_obj* obj) +{ + return true; +} + +bool +rtems_rtl_elf_unwind_deregister (rtems_rtl_obj* obj) +{ + obj->loader = NULL; + return true; +} + +/* + * A weak reference is in libgcc, provide a real version and provide a way to + * manage loaded modules. + * + * Passed in the return address and a reference to the number of records + * found. We set the start of the exidx data and the number of records. + */ +_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr return_address, + int* nrec) __attribute__ ((__noinline__, + __used__, + __noclone__)); + +_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); + } + + rtems_rtl_unlock (); + + *nrec = exidx_end - exidx_start; + + return (_Unwind_Ptr) exidx_start; +} |