From b36c52097f52012f9a52dff6fc8393d63805158b Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Fri, 3 May 2019 10:15:20 +1000 Subject: libdl: Do not access the ELF file while the allocator is locked. - Load symbols before allocation. - Parse reloc records and place any reloc recs in a cache to use while the allocator is locked. - Relocate symbols after section allocation. - Split section loading into allocation/locating and loading. - Update all arch back-ends with a new reloc interface to control tramp handling. - Add `-a` and `-t` to the object list shell command. Closes #3741 --- cpukit/libdl/rtl-mdreloc-arm.c | 122 +++++++++++++++++++++++++---------------- 1 file changed, 76 insertions(+), 46 deletions(-) (limited to 'cpukit/libdl/rtl-mdreloc-arm.c') diff --git a/cpukit/libdl/rtl-mdreloc-arm.c b/cpukit/libdl/rtl-mdreloc-arm.c index b0c55c257a..4d5a2456a7 100644 --- a/cpukit/libdl/rtl-mdreloc-arm.c +++ b/cpukit/libdl/rtl-mdreloc-arm.c @@ -147,7 +147,7 @@ rtems_rtl_elf_rel_resolve_sym (Elf_Word type) return true; } -bool +rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rela_tramp (rtems_rtl_obj* obj, const Elf_Rela* rela, const rtems_rtl_obj_sect* sect, @@ -162,10 +162,10 @@ rtems_rtl_elf_relocate_rela_tramp (rtems_rtl_obj* obj, (void) syminfo; (void) symvalue; rtems_rtl_set_error (EINVAL, "rela type record not supported"); - return false; + return rtems_rtl_elf_rel_failure; } -bool +rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rela (rtems_rtl_obj* obj, const Elf_Rela* rela, const rtems_rtl_obj_sect* sect, @@ -180,10 +180,10 @@ rtems_rtl_elf_relocate_rela (rtems_rtl_obj* obj, (void) syminfo; (void) symvalue; rtems_rtl_set_error (EINVAL, "rela type record not supported"); - return false; + return rtems_rtl_elf_rel_failure; } -static bool +static rtems_rtl_elf_rel_status rtems_rtl_elf_reloc_rel (rtems_rtl_obj* obj, const Elf_Rel* rel, const rtems_rtl_obj_sect* sect, @@ -209,24 +209,37 @@ rtems_rtl_elf_reloc_rel (rtems_rtl_obj* obj, case R_TYPE(CALL): /* BL/BLX */ case R_TYPE(JUMP24): /* B/BL */ - insn = *where; - - if (insn & 0x00800000) - addend = insn | 0xff000000; - else addend = insn & 0x00ffffff; - - if (isThumb(symvalue)) { - if ((insn & 0xfe000000) == 0xfa000000); /* Already blx */ - else { - if ((insn & 0xff000000) == 0xeb000000) { /* BL