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
This commit is contained in:
Chris Johns
2019-02-18 11:46:22 +11:00
parent bdec62c4d5
commit 22afb03411
4 changed files with 83 additions and 5 deletions

View File

@@ -107,6 +107,40 @@ rtems_rtl_alloc_wr_enable (rtems_rtl_alloc_tag tag, void* address)
rtems_rtl_unlock ();
}
void
rtems_rtl_alloc_lock (void)
{
rtems_rtl_data* rtl = rtems_rtl_lock ();
if (rtems_rtl_trace (RTEMS_RTL_TRACE_ALLOCATOR))
printf ("rtl: alloc: lock\n");
if (rtl != NULL)
rtl->allocator.allocator (RTEMS_RTL_ALLOC_LOCK,
RTEMS_RTL_ALLOC_OBJECT, /* should be ignored */
NULL,
0);
rtems_rtl_unlock ();
}
void
rtems_rtl_alloc_unlock (void)
{
rtems_rtl_data* rtl = rtems_rtl_lock ();
if (rtems_rtl_trace (RTEMS_RTL_TRACE_ALLOCATOR))
printf ("rtl: alloc: unlock\n");
if (rtl != NULL)
rtl->allocator.allocator (RTEMS_RTL_ALLOC_UNLOCK,
RTEMS_RTL_ALLOC_OBJECT, /* should be ignored */
NULL,
0);
rtems_rtl_unlock ();
}
void
rtems_rtl_alloc_wr_disable (rtems_rtl_alloc_tag tag, void* address)
{