summaryrefslogtreecommitdiffstats
path: root/cpukit/libdl/rtl-elf.c
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2019-01-09 22:14:11 +1100
committerChris Johns <chrisj@rtems.org>2019-02-09 10:06:34 +1100
commit4408603e27d028c5c735cf5d9d8160807ce1d591 (patch)
treec27bef5ceb630e13724bd11791659c0fae3e0543 /cpukit/libdl/rtl-elf.c
parentlibtest/dl08: Add a test for archives. (diff)
downloadrtems-4408603e27d028c5c735cf5d9d8160807ce1d591.tar.bz2
libdl: Fix the support for constructors and desctructors.
- Fix the handling of pending objects. - Add a constructor flags in objects to track then being called. Closes #2921
Diffstat (limited to 'cpukit/libdl/rtl-elf.c')
-rw-r--r--cpukit/libdl/rtl-elf.c21
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,