summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/rtl/rtl-obj.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2018-11-13 17:26:17 +1100
committerChris Johns <chrisj@rtems.org>2018-11-22 12:43:21 +1100
commit803eac954ed7a3481c6af9b020d5d25419d3a19d (patch)
tree03f0a06f907a5dd5e26a68c8b3c67c6722300833 /cpukit/include/rtems/rtl/rtl-obj.h
parentpsxtmbarrierattr01: Added new POSIX timing suite (GCI 2018) (diff)
downloadrtems-803eac954ed7a3481c6af9b020d5d25419d3a19d.tar.bz2
libdl: Manage the allocation of common uninitialised variables.
The use of separate text and data results in uninitialised variables being placed in the common section. There is no section in ELF for the common variables so the loader needs to create the section and allocate the variables in that section. This patch does that. The patch adds a second pass over the symbols. The issue can also be seen as a section 65522 error. Updates #3604
Diffstat (limited to '')
-rw-r--r--cpukit/include/rtems/rtl/rtl-obj.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/cpukit/include/rtems/rtl/rtl-obj.h b/cpukit/include/rtems/rtl/rtl-obj.h
index ff7b2a197d..be77a81c9d 100644
--- a/cpukit/include/rtems/rtl/rtl-obj.h
+++ b/cpukit/include/rtems/rtl/rtl-obj.h
@@ -294,6 +294,23 @@ static inline bool rtems_rtl_obj_text_inside (const rtems_rtl_obj* obj,
}
/**
+ * Align the size to the next alignment point. Assume the alignment is a
+ * positive integral power of 2 if not 0 or 1. If 0 or 1 then there is no
+ * alignment.
+ *
+ * @param offset Offset to align up from.
+ * @param alignment The alignment.
+ * @return size_t Aligned offset.
+ */
+static inline size_t rtems_rtl_obj_align (size_t offset,
+ uint32_t alignment)
+{
+ if ((alignment > 1) && ((offset & (alignment - 1)) != 0))
+ offset = (offset + alignment) & ~(alignment - 1);
+ return offset;
+}
+
+/**
* Allocate an object structure on the heap.
*
* @retval NULL No memory for the object.
@@ -410,6 +427,22 @@ rtems_rtl_obj_sect* rtems_rtl_obj_find_section_by_index (const rtems_rtl_obj* ob
int index);
/**
+ * Find a section given a section's mask. The index is the section after which
+ * the mask is matched. An index of -1 starts the search from the beginning of
+ * the section list. You can find multiple matches for a mask by passing the
+ * index of the last section that matched the mask on a subsequent call.
+ *
+ * @param obj The object file's descriptor.
+ * @param index The section's index to start searching from, -1 for the start.
+ * @param mask The section's mask to match against the section's flags.
+ * @retval NULL The section was not found.
+ * @return rtems_rtl_obj_sect_t* The found section.
+ */
+rtems_rtl_obj_sect* rtems_rtl_obj_find_section_by_mask (const rtems_rtl_obj* obj,
+ int index,
+ uint32_t mask);
+
+/**
* The text section size. Only use once all the sections has been added. It
* includes alignments between sections that are part of the object's text
* area. The consts sections are included in this section.