RTEMS CPU Kit with SuperCore  4.11.3
Data Structures | Macros | Typedefs | Functions
rtl-obj.h File Reference

RTEMS Run-Time Linker Object Support. More...

#include <rtems.h>
#include <rtems/chain.h>
#include <rtems/rtl/rtl-sym.h>
#include <rtems/rtl/rtl-unresolved.h>
Include dependency graph for rtl-obj.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rtems_rtl_loader_format_s
 Loader format definition. More...
 
struct  rtems_rtl_loader_table_s
 Table for supported loadable formats. More...
 
struct  rtems_rtl_obj_sect_s
 An object file is made up of sections and the can be more than one of a specific type of sections. More...
 
struct  rtems_rtl_obj_s
 RTL Object. More...
 

Macros

#define RTEMS_RTL_FMT_ELF   (1 << 0)
 Loader format flags.
 
#define RTEMS_RTL_FMT_COMP   (1 << 1)
 
#define RTEMS_RTL_FMT_PRIVATE   (1 << 16)
 
#define RTEMS_RTL_OBJ_SECT_TEXT   (1 << 0)
 Flags for the various section types. More...
 
#define RTEMS_RTL_OBJ_SECT_CONST   (1 << 1)
 Section holds program text. More...
 
#define RTEMS_RTL_OBJ_SECT_DATA   (1 << 2)
 Section holds program data. More...
 
#define RTEMS_RTL_OBJ_SECT_BSS   (1 << 3)
 Section holds program bss. More...
 
#define RTEMS_RTL_OBJ_SECT_EH   (1 << 4)
 Section holds exception data. More...
 
#define RTEMS_RTL_OBJ_SECT_REL   (1 << 5)
 Section holds relocation records. More...
 
#define RTEMS_RTL_OBJ_SECT_RELA   (1 << 6)
 Section holds relocation addend records. More...
 
#define RTEMS_RTL_OBJ_SECT_SYM   (1 << 7)
 Section holds symbols. More...
 
#define RTEMS_RTL_OBJ_SECT_STR   (1 << 8)
 Section holds strings. More...
 
#define RTEMS_RTL_OBJ_SECT_ALLOC   (1 << 9)
 Section allocates runtime memory. More...
 
#define RTEMS_RTL_OBJ_SECT_LOAD   (1 << 10)
 Section is loaded from object file. More...
 
#define RTEMS_RTL_OBJ_SECT_WRITE   (1 << 11)
 Section is writable, ie data. More...
 
#define RTEMS_RTL_OBJ_SECT_EXEC   (1 << 12)
 Section is executable. More...
 
#define RTEMS_RTL_OBJ_SECT_ZERO   (1 << 13)
 Section is preset to zero. More...
 
#define RTEMS_RTL_OBJ_SECT_LINK   (1 << 14)
 Section is link-ordered. More...
 
#define RTEMS_RTL_OBJ_SECT_CTOR   (1 << 15)
 Section contains constructors. More...
 
#define RTEMS_RTL_OBJ_SECT_DTOR   (1 << 16)
 Section contains destructors. More...
 
#define RTEMS_RTL_OBJ_SECT_LOCD   (1 << 17)
 Section has been located. More...
 
#define RTEMS_RTL_OBJ_SECT_TYPES
 Section types mask. More...
 
#define RTEMS_RTL_OBJ_LOCKED   (1 << 0)
 Object file descriptor flags. More...
 
#define RTEMS_RTL_OBJ_UNRESOLVED   (1 << 1)
 The object file has unresolved external symbols. More...
 

Typedefs

typedef struct rtems_rtl_loader_format_s rtems_rtl_loader_format_t
 Loader format definition.
 
typedef bool(* rtems_rtl_loader_check) (rtems_rtl_obj_t *obj, int fd)
 The type of the format loader check handler. More...
 
typedef bool(* rtems_rtl_loader_load) (rtems_rtl_obj_t *obj, int fd)
 The type of the format loader load handler. More...
 
typedef bool(* rtems_rtl_loader_unload) (rtems_rtl_obj_t *obj)
 The type of the format loader unload handler. More...
 
typedef rtems_rtl_loader_format_t *(* rtems_rtl_loader_sig) (void)
 The type of the format loader signature handler. More...
 
typedef struct rtems_rtl_loader_table_s rtems_rtl_loader_table_t
 Table for supported loadable formats.
 
typedef bool(* rtems_rtl_obj_sect_handler_t) (rtems_rtl_obj_t *obj, int fd, rtems_rtl_obj_sect_t *sect, void *data)
 A section handler is called once for each section that needs to be processed by this handler. More...
 

Functions

rtems_rtl_obj_trtems_rtl_obj_alloc (void)
 Allocate an object structure on the heap. More...
 
bool rtems_rtl_obj_free (rtems_rtl_obj_t *obj)
 Free the object structure and related resources. More...
 
bool rtems_rtl_obj_unresolved (rtems_rtl_obj_t *obj)
 Does the object file have unresolved external references ? If it does the results of executing code is unpredictable. More...
 
bool rtems_rtl_parse_name (const char *name, const char **aname, const char **oname, off_t *ooffset)
 Parses a filename and returns newly allocated strings with the archive name, object name, and the object's offset. More...
 
bool rtems_rtl_match_name (rtems_rtl_obj_t *obj, const char *name)
 Check of the name matches the object file's object name. More...
 
bool rtems_rtl_obj_find_file (rtems_rtl_obj_t *obj, const char *name)
 Find an object file on disk that matches the name. More...
 
bool rtems_rtl_obj_add_section (rtems_rtl_obj_t *obj, int section, const char *name, size_t size, off_t offset, uint32_t alignment, int link, int info, uint32_t flags)
 Add a section to the object descriptor. More...
 
void rtems_rtl_obj_erase_sections (rtems_rtl_obj_t *obj)
 Erase the object file descriptor's sections. More...
 
rtems_rtl_obj_sect_trtems_rtl_obj_find_section (const rtems_rtl_obj_t *obj, const char *name)
 Find the section given a name. More...
 
rtems_rtl_obj_sect_trtems_rtl_obj_find_section_by_index (const rtems_rtl_obj_t *obj, int index)
 Find a section given a section's index number. More...
 
size_t rtems_rtl_obj_text_size (const rtems_rtl_obj_t *obj)
 The text section size. More...
 
uint32_t rtems_rtl_obj_text_alignment (const rtems_rtl_obj_t *obj)
 The text section alignment for the object file. More...
 
size_t rtems_rtl_obj_const_size (const rtems_rtl_obj_t *obj)
 The const section size. More...
 
uint32_t rtems_rtl_obj_const_alignment (const rtems_rtl_obj_t *obj)
 The const section alignment for the object file. More...
 
size_t rtems_rtl_obj_eh_size (const rtems_rtl_obj_t *obj)
 The eh section size. More...
 
uint32_t rtems_rtl_obj_eh_alignment (const rtems_rtl_obj_t *obj)
 The eh section alignment for the object file. More...
 
size_t rtems_rtl_obj_data_size (const rtems_rtl_obj_t *obj)
 The data section size. More...
 
uint32_t rtems_rtl_obj_data_alignment (const rtems_rtl_obj_t *obj)
 The data section alignment for the object file. More...
 
size_t rtems_rtl_obj_bss_size (const rtems_rtl_obj_t *obj)
 The bss section size. More...
 
uint32_t rtems_rtl_obj_bss_alignment (const rtems_rtl_obj_t *obj)
 The bss section alignment for the object file. More...
 
bool rtems_rtl_obj_relocate (rtems_rtl_obj_t *obj, int fd, rtems_rtl_obj_sect_handler_t handler, void *data)
 Relocate the object file. More...
 
void rtems_rtl_obj_synchronize_cache (rtems_rtl_obj_t *obj)
 Synchronize caches to make code visible to CPU(s) More...
 
bool rtems_rtl_obj_relocate_unresolved (rtems_rtl_unresolv_reloc_t *reloc, rtems_rtl_obj_sym_t *sym)
 Relocate an object file's unresolved reference. More...
 
bool rtems_rtl_obj_load_symbols (rtems_rtl_obj_t *obj, int fd, rtems_rtl_obj_sect_handler_t handler, void *data)
 Load the symbols from the object file. More...
 
bool rtems_rtl_obj_load_sections (rtems_rtl_obj_t *obj, int fd, rtems_rtl_obj_sect_handler_t handler, void *data)
 Load the sections that have been allocated memory in the target. More...
 
void rtems_rtl_obj_run_ctors (rtems_rtl_obj_t *obj)
 Invoke the constructors the object has. More...
 
void rtems_rtl_obj_run_dtors (rtems_rtl_obj_t *obj)
 Invoke the destructors the object has. More...
 
bool rtems_rtl_obj_load (rtems_rtl_obj_t *obj)
 Load the object file, reading all sections into memory, symbols and performing any relocation fixups. More...
 
bool rtems_rtl_obj_unload (rtems_rtl_obj_t *obj)
 Unload the object file, erasing all symbols and releasing all memory. More...
 

Detailed Description

RTEMS Run-Time Linker Object Support.

Macro Definition Documentation

◆ RTEMS_RTL_OBJ_LOCKED

#define RTEMS_RTL_OBJ_LOCKED   (1 << 0)

Object file descriptor flags.

Lock the object file so it cannot be unloaded.

Referenced by rtems_rtl_obj_free().

◆ RTEMS_RTL_OBJ_SECT_ALLOC

#define RTEMS_RTL_OBJ_SECT_ALLOC   (1 << 9)

Section allocates runtime memory.

◆ RTEMS_RTL_OBJ_SECT_BSS

#define RTEMS_RTL_OBJ_SECT_BSS   (1 << 3)

Section holds program bss.

Referenced by rtems_rtl_obj_synchronize_cache().

◆ RTEMS_RTL_OBJ_SECT_CONST

#define RTEMS_RTL_OBJ_SECT_CONST   (1 << 1)

Section holds program text.

Referenced by rtems_rtl_elf_unwind_dw2_parse(), and rtems_rtl_obj_synchronize_cache().

◆ RTEMS_RTL_OBJ_SECT_CTOR

#define RTEMS_RTL_OBJ_SECT_CTOR   (1 << 15)

Section contains constructors.

◆ RTEMS_RTL_OBJ_SECT_DATA

#define RTEMS_RTL_OBJ_SECT_DATA   (1 << 2)

Section holds program data.

Referenced by rtems_rtl_obj_synchronize_cache().

◆ RTEMS_RTL_OBJ_SECT_DTOR

#define RTEMS_RTL_OBJ_SECT_DTOR   (1 << 16)

Section contains destructors.

◆ RTEMS_RTL_OBJ_SECT_EH

#define RTEMS_RTL_OBJ_SECT_EH   (1 << 4)

Section holds exception data.

Referenced by rtems_rtl_obj_synchronize_cache().

◆ RTEMS_RTL_OBJ_SECT_EXEC

#define RTEMS_RTL_OBJ_SECT_EXEC   (1 << 12)

Section is executable.

Referenced by rtems_rtl_obj_synchronize_cache().

◆ RTEMS_RTL_OBJ_SECT_LINK

#define RTEMS_RTL_OBJ_SECT_LINK   (1 << 14)

Section is link-ordered.

◆ RTEMS_RTL_OBJ_SECT_LOAD

#define RTEMS_RTL_OBJ_SECT_LOAD   (1 << 10)

Section is loaded from object file.

◆ RTEMS_RTL_OBJ_SECT_LOCD

#define RTEMS_RTL_OBJ_SECT_LOCD   (1 << 17)

Section has been located.

◆ RTEMS_RTL_OBJ_SECT_REL

#define RTEMS_RTL_OBJ_SECT_REL   (1 << 5)

Section holds relocation records.

◆ RTEMS_RTL_OBJ_SECT_RELA

#define RTEMS_RTL_OBJ_SECT_RELA   (1 << 6)

Section holds relocation addend records.

◆ RTEMS_RTL_OBJ_SECT_STR

#define RTEMS_RTL_OBJ_SECT_STR   (1 << 8)

Section holds strings.

◆ RTEMS_RTL_OBJ_SECT_SYM

#define RTEMS_RTL_OBJ_SECT_SYM   (1 << 7)

Section holds symbols.

◆ RTEMS_RTL_OBJ_SECT_TEXT

#define RTEMS_RTL_OBJ_SECT_TEXT   (1 << 0)

Flags for the various section types.

Section holds program text.

Referenced by rtems_rtl_obj_synchronize_cache().

◆ RTEMS_RTL_OBJ_SECT_TYPES

#define RTEMS_RTL_OBJ_SECT_TYPES
Value:
RTEMS_RTL_OBJ_SECT_CONST | \
RTEMS_RTL_OBJ_SECT_DATA | \
RTEMS_RTL_OBJ_SECT_BSS | \
RTEMS_RTL_OBJ_SECT_EH)
#define RTEMS_RTL_OBJ_SECT_TEXT
Flags for the various section types.
Definition: rtl-obj.h:90

Section types mask.

◆ RTEMS_RTL_OBJ_SECT_WRITE

#define RTEMS_RTL_OBJ_SECT_WRITE   (1 << 11)

Section is writable, ie data.

◆ RTEMS_RTL_OBJ_SECT_ZERO

#define RTEMS_RTL_OBJ_SECT_ZERO   (1 << 13)

Section is preset to zero.

◆ RTEMS_RTL_OBJ_UNRESOLVED

#define RTEMS_RTL_OBJ_UNRESOLVED   (1 << 1)

The object file has unresolved external symbols.

Referenced by rtems_rtl_obj_unresolved().

Typedef Documentation

◆ rtems_rtl_loader_check

typedef bool(* rtems_rtl_loader_check) (rtems_rtl_obj_t *obj, int fd)

The type of the format loader check handler.

This handler checks the format and if it is detected as suitable it returns true.

◆ rtems_rtl_loader_load

typedef bool(* rtems_rtl_loader_load) (rtems_rtl_obj_t *obj, int fd)

The type of the format loader load handler.

This handler loads the specific format.

◆ rtems_rtl_loader_sig

typedef rtems_rtl_loader_format_t*(* rtems_rtl_loader_sig) (void)

The type of the format loader signature handler.

This handler checks the format signature.

◆ rtems_rtl_loader_unload

typedef bool(* rtems_rtl_loader_unload) (rtems_rtl_obj_t *obj)

The type of the format loader unload handler.

This handler unloads the specific format.

◆ rtems_rtl_obj_sect_handler_t

typedef bool(* rtems_rtl_obj_sect_handler_t) (rtems_rtl_obj_t *obj, int fd, rtems_rtl_obj_sect_t *sect, void *data)

A section handler is called once for each section that needs to be processed by this handler.

Parameters
objThe object file's descriptor the section belongs too.
fdThe file descriptor of the object file beling loaded.
sectThe section the handler is being invoked to handle.
dataA user supplied data variable.
Return values
trueThe operation was successful.
falseThe operation failed and the RTL has been set.

Function Documentation

◆ rtems_rtl_match_name()

bool rtems_rtl_match_name ( rtems_rtl_obj_t obj,
const char *  name 
)

Check of the name matches the object file's object name.

Parameters
objThe object file's descriptor.
nameThe name to match.

References rtems_rtl_obj_s::oname.

◆ rtems_rtl_obj_add_section()

bool rtems_rtl_obj_add_section ( rtems_rtl_obj_t obj,
int  section,
const char *  name,
size_t  size,
off_t  offset,
uint32_t  alignment,
int  link,
int  info,
uint32_t  flags 
)

Add a section to the object descriptor.

Parameters
objThe object file's descriptor.
sectionThe section's index number.
nameThe name of the section.
sizeThe size of the section in memory.
offsetThe offset of the section in the object file.
alignmentThe alignment of the section in memory.
linkThe section's link field (from the ELF format).
infoThe section's info field (from the ELF format).
flagsThe section's flags.
Return values
trueThe section has been added.
falseThe section has not been added. See the RTL error.

◆ rtems_rtl_obj_alloc()

rtems_rtl_obj_t* rtems_rtl_obj_alloc ( void  )

Allocate an object structure on the heap.

Return values
NULLNo memory for the object.

References rtems_rtl_obj_s::format, rtems_chain_initialize_empty(), rtems_rtl_alloc_new(), RTEMS_RTL_ALLOC_OBJECT, and rtems_rtl_obj_s::sections.

◆ rtems_rtl_obj_bss_alignment()

uint32_t rtems_rtl_obj_bss_alignment ( const rtems_rtl_obj_t obj)

The bss section alignment for the object file.

Only use once all the sections has been added. The section alignment is the alignment of the first bss type section loaded the bss section.

You can assume the alignment is a positive integral power of 2 if not 0 or

  1. If 0 or 1 then there is no alignment.
Parameters
objThe object file's descriptor.
Returns
uint32_t The alignment. Can be 0 or 1 for not aligned or the alignment.

Referenced by rtems_rtl_obj_load_sections().

◆ rtems_rtl_obj_bss_size()

size_t rtems_rtl_obj_bss_size ( const rtems_rtl_obj_t obj)

The bss section size.

Only use once all the sections has been added. It includes alignments between sections that are part of the object's bss area.

Parameters
objThe object file's descriptor.
Returns
size_t The size of the bss area of the object file.

Referenced by rtems_rtl_obj_load_sections().

◆ rtems_rtl_obj_const_alignment()

uint32_t rtems_rtl_obj_const_alignment ( const rtems_rtl_obj_t obj)

The const section alignment for the object file.

Only use once all the sections has been added. The section alignment is the alignment of the first const type section loaded the const section.

You can assume the alignment is a positive integral power of 2 if not 0 or

  1. If 0 or 1 then there is no alignment.
Parameters
objThe object file's descriptor.
Returns
uint32_t The alignment. Can be 0 or 1 for not aligned or the alignment.

Referenced by rtems_rtl_obj_load_sections().

◆ rtems_rtl_obj_const_size()

size_t rtems_rtl_obj_const_size ( const rtems_rtl_obj_t obj)

The const section size.

Only use once all the sections has been added. It includes alignments between sections that are part of the object's const area. The consts sections are included in this section.

Parameters
objThe object file's descriptor.
Returns
size_t The size of the const area of the object file.

Referenced by rtems_rtl_obj_load_sections().

◆ rtems_rtl_obj_data_alignment()

uint32_t rtems_rtl_obj_data_alignment ( const rtems_rtl_obj_t obj)

The data section alignment for the object file.

Only use once all the sections has been added. The section alignment is the alignment of the first data type section loaded the data section.

You can assume the alignment is a positive integral power of 2 if not 0 or

  1. If 0 or 1 then there is no alignment.
Parameters
objThe object file's descriptor.
Returns
uint32_t The alignment. Can be 0 or 1 for not aligned or the alignment.

Referenced by rtems_rtl_obj_load_sections().

◆ rtems_rtl_obj_data_size()

size_t rtems_rtl_obj_data_size ( const rtems_rtl_obj_t obj)

The data section size.

Only use once all the sections has been added. It includes alignments between sections that are part of the object's data area.

Parameters
objThe object file's descriptor.
Returns
size_t The size of the data area of the object file.

Referenced by rtems_rtl_obj_load_sections().

◆ rtems_rtl_obj_eh_alignment()

uint32_t rtems_rtl_obj_eh_alignment ( const rtems_rtl_obj_t obj)

The eh section alignment for the object file.

Only use once all the sections has been added. The section alignment is the alignment of the first bss type section loaded the bss section.

You can assume the alignment is a positive integral power of 2 if not 0 or

  1. If 0 or 1 then there is no alignment.
Parameters
objThe object file's descriptor.
Returns
uint32_t The alignment. Can be 0 or 1 for not aligned or the alignment.

Referenced by rtems_rtl_obj_load_sections().

◆ rtems_rtl_obj_eh_size()

size_t rtems_rtl_obj_eh_size ( const rtems_rtl_obj_t obj)

The eh section size.

Only use once all the sections has been added. It includes alignments between sections that are part of the object's bss area.

Parameters
objThe object file's descriptor.
Returns
size_t The size of the bss area of the object file.

Referenced by rtems_rtl_obj_load_sections().

◆ rtems_rtl_obj_erase_sections()

void rtems_rtl_obj_erase_sections ( rtems_rtl_obj_t obj)

Erase the object file descriptor's sections.

Parameters
objThe object file's descriptor.

References rtems_rtl_obj_sect_s::name, rtems_chain_extract(), rtems_chain_first(), rtems_chain_is_tail(), rtems_chain_next(), rtems_rtl_alloc_del(), RTEMS_RTL_ALLOC_OBJECT, and rtems_rtl_obj_s::sections.

◆ rtems_rtl_obj_find_file()

bool rtems_rtl_obj_find_file ( rtems_rtl_obj_t obj,
const char *  name 
)

Find an object file on disk that matches the name.

The object descriptor is fill in with the various parts of a name. A name can have archive, object file and offset components. The search path in the RTL is searched.

Parameters
objThe object file's descriptor.
nameThe name to locate on disk.
Return values
trueThe file has been found.
falseThe file could not be located. The RTL error has been set.

◆ rtems_rtl_obj_find_section()

rtems_rtl_obj_sect_t* rtems_rtl_obj_find_section ( const rtems_rtl_obj_t obj,
const char *  name 
)

Find the section given a name.

Parameters
objThe object file's descriptor.
nameThe name of the section to find.
Return values
NULLThe section was not found.
Returns
rtems_rtl_obj_sect_t* The named section.

References rtems_rtl_obj_sect_finder_t::name, and rtems_rtl_obj_sect_finder_t::sect.

Referenced by rtems_rtl_elf_unwind_dw2_deregister(), and rtems_rtl_elf_unwind_dw2_register().

◆ rtems_rtl_obj_find_section_by_index()

rtems_rtl_obj_sect_t* rtems_rtl_obj_find_section_by_index ( const rtems_rtl_obj_t obj,
int  index 
)

Find a section given a section's index number.

Parameters
objThe object file's descriptor.
indexThe section's index to find.
Return values
NULLThe section was not found.
Returns
rtems_rtl_obj_sect_t* The found section.

Referenced by rtems_rtl_obj_relocate_unresolved().

◆ rtems_rtl_obj_free()

bool rtems_rtl_obj_free ( rtems_rtl_obj_t obj)

◆ rtems_rtl_obj_load()

bool rtems_rtl_obj_load ( rtems_rtl_obj_t obj)

Load the object file, reading all sections into memory, symbols and performing any relocation fixups.

Parameters
objThe object file's descriptor.
Return values
trueThe object file has been loaded.
falseThe load failed. The RTL error has been set.

◆ rtems_rtl_obj_load_sections()

bool rtems_rtl_obj_load_sections ( rtems_rtl_obj_t obj,
int  fd,
rtems_rtl_obj_sect_handler_t  handler,
void *  data 
)

Load the sections that have been allocated memory in the target.

The bss type section does not load any data, it is set to 0. The text and data sections read the detault data from the object file into the target memory.

Parameters
objThe object file's descriptor.
fdThe object file's file descriptor.
handlerThe object file's format specific load handler.
dataUser specific data handle.
Return values
trueThe object has been sucessfully loaded.
falseThe load failed. The RTL error has been set.

References rtems_rtl_obj_s::bss_base, rtems_rtl_obj_s::bss_size, rtems_rtl_obj_s::const_base, rtems_rtl_obj_s::data_base, rtems_rtl_obj_s::eh_base, rtems_rtl_obj_s::eh_size, rtems_rtl_obj_s::exec_size, rtems_rtl_alloc_module_new(), rtems_rtl_obj_bss_alignment(), rtems_rtl_obj_bss_size(), rtems_rtl_obj_const_alignment(), rtems_rtl_obj_const_size(), rtems_rtl_obj_data_alignment(), rtems_rtl_obj_data_size(), rtems_rtl_obj_eh_alignment(), rtems_rtl_obj_eh_size(), rtems_rtl_obj_text_size(), rtems_rtl_set_error(), rtems_rtl_trace(), rtems_rtl_obj_s::text_base, and rtems_rtl_obj_s::text_size.

◆ rtems_rtl_obj_load_symbols()

bool rtems_rtl_obj_load_symbols ( rtems_rtl_obj_t obj,
int  fd,
rtems_rtl_obj_sect_handler_t  handler,
void *  data 
)

Load the symbols from the object file.

Only the exported or public symbols are read into memory and held in the global symbol table.

Parameters
objThe object file's descriptor.
fdThe object file's file descriptor.
handlerThe object file's format specific symbol handler.
dataUser specific data handle.
Return values
trueThe object file's symbol where loaded.
falseThe symbol loading failed. The RTL error is set.

◆ rtems_rtl_obj_relocate()

bool rtems_rtl_obj_relocate ( rtems_rtl_obj_t obj,
int  fd,
rtems_rtl_obj_sect_handler_t  handler,
void *  data 
)

Relocate the object file.

The object file's section are parsed for any relocation type sections.

Parameters
objThe object file's descriptor.
fdThe object file's file descriptor.
handlerThe object file's format specific relocation handler.
dataUser specific data handle.
Return values
trueThe object file was relocated.
falseThe relocation failed. The RTL error is set.

◆ rtems_rtl_obj_relocate_unresolved()

bool rtems_rtl_obj_relocate_unresolved ( rtems_rtl_unresolv_reloc_t reloc,
rtems_rtl_obj_sym_t sym 
)

Relocate an object file's unresolved reference.

Parameters
recThe unresolved relocation record.
symThe unresolved relocation's referenced symbol.
Return values
trueThe object file record was relocated.
falseThe relocation failed. The RTL error is set.

References rtems_rtl_unresolv_reloc_s::flags, rtems_rtl_unresolv_reloc_s::obj, rtems_rtl_unresolv_reloc_s::rel, REL_R_OFFSET, rtems_rtl_obj_find_section_by_index(), rtems_rtl_set_error(), rtems_rtl_unresolv_reloc_s::sect, and rtems_rtl_obj_sym_s::value.

◆ rtems_rtl_obj_run_ctors()

void rtems_rtl_obj_run_ctors ( rtems_rtl_obj_t obj)

Invoke the constructors the object has.

Constructors are a table of pointers to "void (*)(void);" where NULL pointers are skipped. The table's size is taken from the section's size. The objet ELF specific code is responisble for flagging which sections contain constructors.

Parameters
objThe object file's descriptor.

Referenced by rtems_rtl_run_ctors().

◆ rtems_rtl_obj_run_dtors()

void rtems_rtl_obj_run_dtors ( rtems_rtl_obj_t obj)

Invoke the destructors the object has.

Destructors are a table of pointers to "void (*)(void);" where NULL pointers are skipped. The table's size is taken from the section's size. The objet ELF specific code is responisble for flagging which sections contain destructors.

Parameters
objThe object file's descriptor.

◆ rtems_rtl_obj_synchronize_cache()

void rtems_rtl_obj_synchronize_cache ( rtems_rtl_obj_t obj)

◆ rtems_rtl_obj_text_alignment()

uint32_t rtems_rtl_obj_text_alignment ( const rtems_rtl_obj_t obj)

The text section alignment for the object file.

Only use once all the sections has been added. The section alignment is the alignment of the first text type section loaded the text section.

You can assume the alignment is a positive integral power of 2 if not 0 or

  1. If 0 or 1 then there is no alignment.
Parameters
objThe object file's descriptor.
Returns
uint32_t The alignment. Can be 0 or 1 for not aligned or the alignment.

◆ rtems_rtl_obj_text_size()

size_t rtems_rtl_obj_text_size ( const rtems_rtl_obj_t obj)

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.

Parameters
objThe object file's descriptor.
Returns
size_t The size of the text area of the object file.

Referenced by rtems_rtl_obj_load_sections().

◆ rtems_rtl_obj_unload()

bool rtems_rtl_obj_unload ( rtems_rtl_obj_t obj)

Unload the object file, erasing all symbols and releasing all memory.

Parameters
objThe object file's descriptor.
Return values
trueThe object file has been unloaded.
falseThe unload failed. The RTL error has been set.

◆ rtems_rtl_obj_unresolved()

bool rtems_rtl_obj_unresolved ( rtems_rtl_obj_t obj)

Does the object file have unresolved external references ? If it does the results of executing code is unpredictable.

Parameters
objThe object file's descriptor.
Return values
trueThe object file has unresolved externals.
falseThe object file has all external references resolved.

References rtems_rtl_obj_s::flags, and RTEMS_RTL_OBJ_UNRESOLVED.

◆ rtems_rtl_parse_name()

bool rtems_rtl_parse_name ( const char *  name,
const char **  aname,
const char **  oname,
off_t *  ooffset 
)

Parses a filename and returns newly allocated strings with the archive name, object name, and the object's offset.

Parameters
nameThe filename of the object
anameAddress of a string pointer that holds the archive name
onameAddress of a string pointer that holds the object name
ooffsetAddress of an int that holds the object offset
Return values
trueThe parsing was successful
falseThe parsing was unsuccessful

Referenced by rtems_rtl_find_obj().