summaryrefslogtreecommitdiff
path: root/rtl-obj.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2012-07-16 15:07:54 +1000
committerChris Johns <chrisj@rtems.org>2012-07-16 15:07:54 +1000
commit5d126da01db7c0e140ca35389dfe8f7227f10622 (patch)
treeec501af328f2fd23a4ae7cdd53991fb8743b831d /rtl-obj.h
parent8f06d01b2c6e051d9b6f733f6673b796490983f9 (diff)
Resolve unresolved externals when loading object files.
Object files that depend on each other will cause an unresolved external. The change lets object files load with unresolved externals and will resolve them when the object file with the external is loaded. A common table of symbol strings and relocation records is maintained. The symbol string is shared by each object file that is unresolved. Each relocation record that references the symbol is held. The table is a series of small blocks that compact as symbols are resolved. The number of symbols left unresolved is typically small this design avoids fragmentation of the heap memory.
Diffstat (limited to 'rtl-obj.h')
-rw-r--r--rtl-obj.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/rtl-obj.h b/rtl-obj.h
index 8440078..00803c5 100644
--- a/rtl-obj.h
+++ b/rtl-obj.h
@@ -18,8 +18,8 @@
#include <rtems.h>
#include <rtems/chain.h>
-#include <rtl-indirect-ptr.h>
#include <rtl-sym.h>
+#include <rtl-unresolved.h>
#ifdef __cplusplus
extern "C" {
@@ -96,6 +96,8 @@ struct rtems_rtl_obj_s
rtems_rtl_obj_sym_t* global_table; /**< Global symbol table. */
size_t global_syms; /**< Global symbol count. */
size_t global_size; /**< Global symbol memory usage. */
+ rtems_chain_control externals; /**< Unresolved externals. */
+ uint32_t unresolved; /**< The number of unresolved relocations. */
void* text_base; /**< The base address of the text section
* in memory. */
void* const_base; /**< The base address of the const section
@@ -265,7 +267,7 @@ bool rtems_rtl_obj_find_file (rtems_rtl_obj_t* obj, const char* name);
* @param info The section's info field (from the ELF format).
* @param flags The section's flags.
* @retval true The section has been added.
- * @retval false The section has not been added. See the RTL error.
+ * @retval false The section has not been added. See the RTL error.
*/
bool rtems_rtl_obj_add_section (rtems_rtl_obj_t* obj,
int section,
@@ -384,7 +386,7 @@ uint32_t rtems_rtl_obj_data_alignment (rtems_rtl_obj_t* obj);
* @return size_t The size of the bss area of the object file.
*/
size_t rtems_rtl_obj_bss_size (rtems_rtl_obj_t* obj);
-
+
/**
* The bss section alignment of the object file. Only use once all the
* sections has been added. The section alignment is the alignment of the first
@@ -415,6 +417,17 @@ bool rtems_rtl_obj_relocate (rtems_rtl_obj_t* obj,
void* data);
/**
+ * Relocate an object file's unresolved reference.
+ *
+ * @param rec The unresolved relocation record.
+ * @param sym The unresolved relocation's referenced symbol.
+ * @retval true The object file record was relocated.
+ * @retval false The relocation failed. The RTL error is set.
+ */
+bool rtems_rtl_obj_relocate_unresolved (rtems_rtl_unresolv_reloc_t* reloc,
+ rtems_rtl_obj_sym_t* sym);
+
+/**
* Load the symbols from the object file. Only the exported or public symbols
* are read into memory and held in the global symbol table.
*