summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/rtl/rtl-obj.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2019-05-03 10:15:20 +1000
committerChris Johns <chrisj@rtems.org>2019-05-03 10:15:20 +1000
commitb36c52097f52012f9a52dff6fc8393d63805158b (patch)
tree011b4cb678d343e0e6422d36bbcce982fdf48e30 /cpukit/include/rtems/rtl/rtl-obj.h
parentbsp/motorola_powerpc: Fix debug output (diff)
downloadrtems-b36c52097f52012f9a52dff6fc8393d63805158b.tar.bz2
libdl: Do not access the ELF file while the allocator is locked.
- Load symbols before allocation. - Parse reloc records and place any reloc recs in a cache to use while the allocator is locked. - Relocate symbols after section allocation. - Split section loading into allocation/locating and loading. - Update all arch back-ends with a new reloc interface to control tramp handling. - Add `-a` and `-t` to the object list shell command. Closes #3741
Diffstat (limited to 'cpukit/include/rtems/rtl/rtl-obj.h')
-rw-r--r--cpukit/include/rtems/rtl/rtl-obj.h38
1 files changed, 33 insertions, 5 deletions
diff --git a/cpukit/include/rtems/rtl/rtl-obj.h b/cpukit/include/rtems/rtl/rtl-obj.h
index 9c2b4f0300..f27ae3259d 100644
--- a/cpukit/include/rtems/rtl/rtl-obj.h
+++ b/cpukit/include/rtems/rtl/rtl-obj.h
@@ -207,7 +207,7 @@ struct rtems_rtl_obj
size_t text_size; /**< The size of the text section. */
void* const_base; /**< The base address of the const section
* in memory. */
- size_t const_size; /**< The size of the const section. */
+ size_t const_size; /**< The size of the const section. */
void* eh_base; /**< The base address of the eh section in
* memory. */
size_t eh_size; /**< The size of the eh section. */
@@ -227,10 +227,14 @@ struct rtems_rtl_obj
* obj. */
void* trampoline; /**< Trampoline memory. Used for fixups or
* veneers */
- size_t tramp_size; /**< Size of the tramopline memory. */
+ size_t tramp_size; /**< Size of a tramopline slot. */
+ size_t tramps_size; /**< Size of the trampoline memory. */
void* tramp_brk; /**< Trampoline memory allocator. MD
* relocators can take memory from the
* break upto the size. */
+ size_t tramp_relocs; /**< Number of slots reserved for
+ * relocs. The remainder are for
+ * unresolved symbols. */
struct link_map* linkmap; /**< For GDB. */
void* loader; /**< The file details specific to a
* loader. */
@@ -370,11 +374,35 @@ static inline bool rtems_rtl_obj_has_symbol (const rtems_rtl_obj* obj,
* @param size The size to be allocated.
* @retval bool Returns @true if the space is available.
*/
-static inline bool rtems_rtl_obj_has_ramp_space (const rtems_rtl_obj* obj,
- const size_t size)
+static inline bool rtems_rtl_obj_has_tramp_space (const rtems_rtl_obj* obj,
+ const size_t size)
{
return (obj->trampoline != NULL &&
- ((obj->tramp_brk - obj->trampoline) + size) <= obj->tramp_size);
+ ((obj->tramp_brk - obj->trampoline) + size) <= obj->tramps_size);
+}
+
+/**
+ * Trampoline slots.
+ *
+ * @param obj The object file's descriptor.
+ * @retval size_t The number of trampoline slots.
+ */
+static inline size_t rtems_rtl_obj_trampoline_slots (const rtems_rtl_obj* obj)
+{
+ return obj->trampoline == NULL || obj->tramp_size == 0 ?
+ 0 : obj->tramps_size / obj->tramp_size;
+}
+
+/**
+ * Number of trampolines.
+ *
+ * @param obj The object file's descriptor.
+ * @retval size_t The number of trampolines.
+ */
+static inline size_t rtems_rtl_obj_trampolines (const rtems_rtl_obj* obj)
+{
+ return obj->trampoline == NULL || obj->tramp_size == 0 ?
+ 0 : (obj->tramp_brk - obj->trampoline) / obj->tramp_size;
}
/**