diff options
author | Chris Johns <chrisj@rtems.org> | 2017-03-30 11:06:24 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2017-03-31 09:00:14 +1100 |
commit | bba48d90bcd343f62b368a510b67bbdb51fb6f0c (patch) | |
tree | 0f7b4fb43aa7a432228d420f7987d7dcf4c6d90c /cpukit/libdl/rtl-elf.c | |
parent | benchmarks/whetstone: Port to RTEMS (diff) | |
download | rtems-bba48d90bcd343f62b368a510b67bbdb51fb6f0c.tar.bz2 |
libdl: Support link ordered loading of ELF sections.
The ARM C++ exception ABI uses an address ordered index table to
locate the correct frame data and this requires the EXIDX sections are
loaded in the order the order the matching text is loaded.
The EXIDX sections set the SHF_LINK_ORDER flag and link field. This patch
adds support to load those flagged sections in the linked-to section
order.
Updates #2955.
Closes #2959
Diffstat (limited to 'cpukit/libdl/rtl-elf.c')
-rw-r--r-- | cpukit/libdl/rtl-elf.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cpukit/libdl/rtl-elf.c b/cpukit/libdl/rtl-elf.c index 37775ff776..be2f06a7ba 100644 --- a/cpukit/libdl/rtl-elf.c +++ b/cpukit/libdl/rtl-elf.c @@ -656,6 +656,11 @@ rtems_rtl_elf_parse_sections (rtems_rtl_obj_t* obj, int fd, Elf_Ehdr* ehdr) flags = 0; + if (rtems_rtl_trace (RTEMS_RTL_TRACE_DETAIL)) + printf ("rtl: section: %2d: type=%d flags=%08x link=%d info=%d\n", + section, (int) shdr.sh_type, (unsigned int) shdr.sh_flags, + (int) shdr.sh_link, (int) shdr.sh_info); + switch (shdr.sh_type) { case SHT_NULL: @@ -712,7 +717,7 @@ rtems_rtl_elf_parse_sections (rtems_rtl_obj_t* obj, int fd, Elf_Ehdr* ehdr) default: /* - * See there are architecture specific flags? + * See if there are architecture specific flags? */ flags = rtems_rtl_elf_section_flags (obj, &shdr); if (flags == 0) @@ -729,6 +734,13 @@ rtems_rtl_elf_parse_sections (rtems_rtl_obj_t* obj, int fd, Elf_Ehdr* ehdr) char* name; size_t len; + /* + * If link ordering this section must appear in the same order in memory + * as the linked-to section relative to the sections it loads with. + */ + if ((shdr.sh_flags & SHF_LINK_ORDER) != 0) + flags |= RTEMS_RTL_OBJ_SECT_LINK; + len = RTEMS_RTL_ELF_STRING_MAX; if (!rtems_rtl_obj_cache_read (strings, fd, sectstroff + shdr.sh_name, |