diff options
author | Chris Johns <chrisj@rtems.org> | 2019-01-09 22:14:11 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2019-01-09 22:33:23 +1100 |
commit | a87356db51791224ca525d248804a81d2e89d7c9 (patch) | |
tree | c17638a3314af9712f6f3fa9c898be6af5cde631 /cpukit/libdl/rtl-elf.c | |
parent | b1212a5cfe48dbf5ec30120d21a724cfe0647e90 (diff) |
libdl: Fix the support for constructors and desctructors.rtl-ctor-dtor
- Fix the handling of pending objects.
- Add a constructor flags in objects to track then being called.
Diffstat (limited to 'cpukit/libdl/rtl-elf.c')
-rw-r--r-- | cpukit/libdl/rtl-elf.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cpukit/libdl/rtl-elf.c b/cpukit/libdl/rtl-elf.c index caa37e6bab..63242acaae 100644 --- a/cpukit/libdl/rtl-elf.c +++ b/cpukit/libdl/rtl-elf.c @@ -993,6 +993,24 @@ rtems_rtl_elf_parse_sections (rtems_rtl_obj* obj, int fd, Elf_Ehdr* ehdr) flags = RTEMS_RTL_OBJ_SECT_STR; break; + case SHT_INIT_ARRAY: + /* + * Constructors are text and need to be loaded. + */ + flags = (RTEMS_RTL_OBJ_SECT_CTOR | + RTEMS_RTL_OBJ_SECT_TEXT | + RTEMS_RTL_OBJ_SECT_LOAD); + break; + + case SHT_FINI_ARRAY: + /* + * Destructors are text and need to be loaded. + */ + flags = (RTEMS_RTL_OBJ_SECT_DTOR | + RTEMS_RTL_OBJ_SECT_TEXT | + RTEMS_RTL_OBJ_SECT_LOAD); + break; + default: /* * See if there are architecture specific flags? @@ -1019,6 +1037,9 @@ rtems_rtl_elf_parse_sections (rtems_rtl_obj* obj, int fd, Elf_Ehdr* ehdr) if ((shdr.sh_flags & SHF_LINK_ORDER) != 0) flags |= RTEMS_RTL_OBJ_SECT_LINK; + /* + * Some architexctures support a named PROGBIT section for INIT/FINI. + */ len = RTEMS_RTL_ELF_STRING_MAX; if (!rtems_rtl_obj_cache_read (strings, fd, sectstroff + shdr.sh_name, |