summaryrefslogtreecommitdiffstats
path: root/cpukit/libdl/rtl-elf.c
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2019-02-18 11:46:22 +1100
committerChris Johns <chrisj@rtems.org>2019-02-20 09:08:14 +1100
commit22afb03411133bcf928aeb85233648a94f259b44 (patch)
treee03f9e303646d3efbbce250db37d9566d50ec1c6 /cpukit/libdl/rtl-elf.c
parentbsps/arm: Move device tree copy (diff)
downloadrtems-22afb03411133bcf928aeb85233648a94f259b44.tar.bz2
libdl/alloc: Add a locking interface to the allocator.
- Allow an allocator to lock the allocations. This is needed to lock the heap allocator so the text and trampoline table are as close together as possible to allow for the largest possible object file size. - Update the default heap allocator to lock the heap allocator. - Update ELF loading to lock the allocator. Updates #3685
Diffstat (limited to 'cpukit/libdl/rtl-elf.c')
-rw-r--r--cpukit/libdl/rtl-elf.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/cpukit/libdl/rtl-elf.c b/cpukit/libdl/rtl-elf.c
index 54ea1464cc..963cb4b2f4 100644
--- a/cpukit/libdl/rtl-elf.c
+++ b/cpukit/libdl/rtl-elf.c
@@ -1457,6 +1457,12 @@ rtems_rtl_elf_file_load (rtems_rtl_obj* obj, int fd)
obj->entry = (void*)(uintptr_t) ehdr.e_entry;
/*
+ * Lock the allocator so the section memory and the trampoline memory are as
+ * clock as possible.
+ */
+ rtems_rtl_alloc_lock ();
+
+ /*
* Allocate the sections.
*/
if (!rtems_rtl_obj_alloc_sections (obj, fd, rtems_rtl_elf_arch_alloc, &ehdr))
@@ -1481,6 +1487,11 @@ rtems_rtl_elf_file_load (rtems_rtl_obj* obj, int fd)
if (!rtems_rtl_elf_alloc_trampoline (obj, relocs.unresolved))
return false;
+ /*
+ * Unlock the allocator.
+ */
+ rtems_rtl_alloc_unlock ();
+
if (!rtems_rtl_obj_load_symbols (obj, fd, rtems_rtl_elf_symbols, &ehdr))
return false;