diff options
author | Chris Johns <chrisj@rtems.org> | 2019-01-22 08:48:19 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2019-02-09 10:06:34 +1100 |
commit | 194eb403c39f5ad346e63dc3352e29570857fd93 (patch) | |
tree | 3ef4976810a6e4545a0d4c68138c270ed3abd22c /cpukit/include/rtems/rtl | |
parent | libdl: Add support for trampolines (diff) | |
download | rtems-194eb403c39f5ad346e63dc3352e29570857fd93.tar.bz2 |
libdl: Add support for large memory programs
- Add trampolines to support relocs that are out of range on
support architectures.
- Support not loading separate text/data sections in an object
file if the symbol provided in the section is a duplicate.
A base image may have pulled in part of an object and another
part needs to be dynamically loaded.
- Refactor the unresolved handling to scale to hundreds of
unresolved symbols when loading large number of files.
Updates #3685
Diffstat (limited to 'cpukit/include/rtems/rtl')
-rw-r--r-- | cpukit/include/rtems/rtl/rtl-obj.h | 30 | ||||
-rw-r--r-- | cpukit/include/rtems/rtl/rtl-trace.h | 7 | ||||
-rw-r--r-- | cpukit/include/rtems/rtl/rtl-unresolved.h | 13 | ||||
-rw-r--r-- | cpukit/include/rtems/rtl/rtl.h | 9 |
4 files changed, 39 insertions, 20 deletions
diff --git a/cpukit/include/rtems/rtl/rtl-obj.h b/cpukit/include/rtems/rtl/rtl-obj.h index 4ce356015c..e01af20957 100644 --- a/cpukit/include/rtems/rtl/rtl-obj.h +++ b/cpukit/include/rtems/rtl/rtl-obj.h @@ -92,19 +92,20 @@ typedef struct rtems_rtl_loader_table #define RTEMS_RTL_OBJ_SECT_DATA (1 << 2) /**< Section holds program data. */ #define RTEMS_RTL_OBJ_SECT_BSS (1 << 3) /**< Section holds program bss. */ #define RTEMS_RTL_OBJ_SECT_EH (1 << 4) /**< Section holds exception data. */ -#define RTEMS_RTL_OBJ_SECT_REL (1 << 5) /**< Section holds relocation recs. */ -#define RTEMS_RTL_OBJ_SECT_RELA (1 << 6) /**< Section holds reloc addend recs. */ -#define RTEMS_RTL_OBJ_SECT_SYM (1 << 7) /**< Section holds symbols. */ -#define RTEMS_RTL_OBJ_SECT_STR (1 << 8) /**< Section holds strings. */ -#define RTEMS_RTL_OBJ_SECT_ALLOC (1 << 9) /**< Section allocates runtime memory. */ -#define RTEMS_RTL_OBJ_SECT_LOAD (1 << 10) /**< Section is loaded from object file. */ -#define RTEMS_RTL_OBJ_SECT_WRITE (1 << 11) /**< Section is writable, ie data. */ -#define RTEMS_RTL_OBJ_SECT_EXEC (1 << 12) /**< Section is executable. */ -#define RTEMS_RTL_OBJ_SECT_ZERO (1 << 13) /**< Section is preset to zero. */ -#define RTEMS_RTL_OBJ_SECT_LINK (1 << 14) /**< Section is link-ordered. */ -#define RTEMS_RTL_OBJ_SECT_CTOR (1 << 15) /**< Section contains constructors. */ -#define RTEMS_RTL_OBJ_SECT_DTOR (1 << 16) /**< Section contains destructors. */ -#define RTEMS_RTL_OBJ_SECT_LOCD (1 << 17) /**< Section has been located. */ +#define RTEMS_RTL_OBJ_SECT_TLS (1 << 5) /**< Section holds TLS data. */ +#define RTEMS_RTL_OBJ_SECT_REL (1 << 6) /**< Section holds relocation recs. */ +#define RTEMS_RTL_OBJ_SECT_RELA (1 << 7) /**< Section holds reloc addend recs. */ +#define RTEMS_RTL_OBJ_SECT_SYM (1 << 8) /**< Section holds symbols. */ +#define RTEMS_RTL_OBJ_SECT_STR (1 << 9) /**< Section holds strings. */ +#define RTEMS_RTL_OBJ_SECT_ALLOC (1 << 10 /**< Section allocates runtime memory. */ +#define RTEMS_RTL_OBJ_SECT_LOAD (1 << 11) /**< Section is loaded from object file. */ +#define RTEMS_RTL_OBJ_SECT_WRITE (1 << 12) /**< Section is writable, ie data. */ +#define RTEMS_RTL_OBJ_SECT_EXEC (1 << 13) /**< Section is executable. */ +#define RTEMS_RTL_OBJ_SECT_ZERO (1 << 14) /**< Section is preset to zero. */ +#define RTEMS_RTL_OBJ_SECT_LINK (1 << 15) /**< Section is link-ordered. */ +#define RTEMS_RTL_OBJ_SECT_CTOR (1 << 16) /**< Section contains constructors. */ +#define RTEMS_RTL_OBJ_SECT_DTOR (1 << 17) /**< Section contains destructors. */ +#define RTEMS_RTL_OBJ_SECT_LOCD (1 << 18) /**< Section has been located. */ /** * Section types mask. @@ -113,6 +114,7 @@ typedef struct rtems_rtl_loader_table RTEMS_RTL_OBJ_SECT_CONST | \ RTEMS_RTL_OBJ_SECT_DATA | \ RTEMS_RTL_OBJ_SECT_BSS | \ + RTEMS_RTL_OBJ_SECT_TLS | \ RTEMS_RTL_OBJ_SECT_EH) /** @@ -204,11 +206,13 @@ 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. */ void* eh_base; /**< The base address of the eh section in * memory. */ size_t eh_size; /**< The size of the eh section. */ void* data_base; /**< The base address of the data section * in memory. */ + size_t data_size; /**< The size of the data section. */ void* bss_base; /**< The base address of the bss section in * memory. */ size_t bss_size; /**< The size of the bss section. */ diff --git a/cpukit/include/rtems/rtl/rtl-trace.h b/cpukit/include/rtems/rtl/rtl-trace.h index 84e81d5344..6905e02245 100644 --- a/cpukit/include/rtems/rtl/rtl-trace.h +++ b/cpukit/include/rtems/rtl/rtl-trace.h @@ -49,8 +49,11 @@ typedef uint32_t rtems_rtl_trace_mask; #define RTEMS_RTL_TRACE_UNRESOLVED (1UL << 10) #define RTEMS_RTL_TRACE_CACHE (1UL << 11) #define RTEMS_RTL_TRACE_ARCHIVES (1UL << 12) -#define RTEMS_RTL_TRACE_DEPENDENCY (1UL << 13) -#define RTEMS_RTL_TRACE_ALL (0xffffffffUL & ~(RTEMS_RTL_TRACE_CACHE)) +#define RTEMS_RTL_TRACE_ARCHIVE_SYMS (1UL << 13) +#define RTEMS_RTL_TRACE_DEPENDENCY (1UL << 14) +#define RTEMS_RTL_TRACE_ALL (0xffffffffUL & ~(RTEMS_RTL_TRACE_CACHE | \ + RTEMS_RTL_TRACE_GLOBAL_SYM | \ + RTEMS_RTL_TRACE_ARCHIVE_SYMS)) /** * Call to check if this part is bring traced. If RTEMS_RTL_TRACE is defined to diff --git a/cpukit/include/rtems/rtl/rtl-unresolved.h b/cpukit/include/rtems/rtl/rtl-unresolved.h index a425384370..efc9ce220f 100644 --- a/cpukit/include/rtems/rtl/rtl-unresolved.h +++ b/cpukit/include/rtems/rtl/rtl-unresolved.h @@ -53,6 +53,7 @@ #define _RTEMS_RTL_UNRESOLVED_H_ #include <rtems.h> +#include <rtems/chain.h> #include "rtl-obj-fwd.h" #ifdef __cplusplus @@ -79,6 +80,8 @@ typedef enum rtems_rtl_unresolved_rtype * Unresolved external symbol flags. */ #define RTEMS_RTL_UNRESOLV_SYM_SEARCH_ARCHIVE (1 << 0) /**< Search the archive. */ +#define RTEMS_RTL_UNRESOLV_SYM_HAS_ERROR (1 << 1) /**< The symbol load + * has an error. */ /** * Unresolved externals symbols. The symbols are reference counted and separate @@ -93,7 +96,7 @@ typedef struct rtems_rtl_unresolv_symbol uint16_t refs; /**< The number of references to this name. */ uint16_t flags; /**< Flags to manage the symbol. */ uint16_t length; /**< The length of this name. */ - const char name[10]; /**< The symbol name. */ + const char name[]; /**< The symbol name. */ } rtems_rtl_unresolv_symbol; /** @@ -117,7 +120,7 @@ typedef struct rtems_rtl_unresolv_rec rtems_rtl_unresolved_rtype type; union { - rtems_rtl_unresolv_symbol name; /**< The symnbol, or */ + rtems_rtl_unresolv_symbol name; /**< The symbol, or */ rtems_rtl_unresolv_reloc reloc; /**< the relocation record. */ } rec; } rtems_rtl_unresolv_rec; @@ -127,9 +130,9 @@ typedef struct rtems_rtl_unresolv_rec */ typedef struct rtems_rtl_unresolv_block { - rtems_chain_node link; /**< Blocks are chained. */ - uint32_t recs; /**< The number of records in the block. */ - rtems_rtl_unresolv_rec rec; /**< The records. More follow. */ + rtems_chain_node link; /**< Blocks are chained. */ + uint32_t recs; /**< The number of records in the block. */ + rtems_rtl_unresolv_rec rec[]; /**< The records. More follow. */ } rtems_rtl_unresolv_block; /** diff --git a/cpukit/include/rtems/rtl/rtl.h b/cpukit/include/rtems/rtl/rtl.h index debf17cd44..044aa2a332 100644 --- a/cpukit/include/rtems/rtl/rtl.h +++ b/cpukit/include/rtems/rtl/rtl.h @@ -138,6 +138,15 @@ rtems_rtl_data* rtems_rtl_data_unprotected (void); rtems_rtl_symbols* rtems_rtl_global_symbols (void); /** + * Get the RTL last error string with out locking. This call assumes the RTL is + * locked. + * + * @return const char* The RTL's laste error. + * @retval NULL The RTL data is not initialised. + */ +const char* rtems_rtl_last_error_unprotected (void); + +/** * Get the RTL objects table with out locking. This call assumes the RTL * is locked. * |