RTEMS  5.1
Data Structures | Macros | Typedefs | Enumerations | Functions
rtl-elf.h File Reference

RTEMS Run-Time Linker ELF Headers. More...

#include <rtems/rtl/rtl-fwd.h>
#include <rtems/rtl/rtl-obj-fwd.h>
#include <rtems/rtl/rtl-sym.h>
#include <sys/cdefs.h>
#include <sys/exec_elf.h>

Go to the source code of this file.

Data Structures

struct  rtems_rtl_mdreloc_trmap
 

Macros

#define ELFSIZE   32
 
#define _STANDALONE   1
 
#define RTEMS_RTL_ELF_STRING_MAX   (256)
 

Typedefs

typedef enum rtems_rtl_elf_rel_status rtems_rtl_elf_rel_status
 
typedef struct rtems_rtl_mdreloc_trmap rtems_rtl_mdreloc_tramp
 

Enumerations

enum  rtems_rtl_elf_rel_status { rtems_rtl_elf_rel_no_error, rtems_rtl_elf_rel_failure, rtems_rtl_elf_rel_tramp_cache, rtems_rtl_elf_rel_tramp_add }
 

Functions

uint32_t rtems_rtl_elf_section_flags (const rtems_rtl_obj *obj, const Elf_Shdr *shdr)
 
uint32_t rtems_rtl_elf_arch_parse_section (const rtems_rtl_obj *obj, int section, const char *name, const Elf_Shdr *shdr, const uint32_t flags)
 
bool rtems_rtl_elf_arch_section_alloc (const rtems_rtl_obj *obj, rtems_rtl_obj_sect *sect)
 
bool rtems_rtl_elf_arch_section_free (const rtems_rtl_obj *obj, rtems_rtl_obj_sect *sect)
 
bool rtems_rtl_elf_rel_resolve_sym (Elf_Word type)
 
size_t rtems_rtl_elf_relocate_tramp_max_size (void)
 
rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rel_tramp (rtems_rtl_obj *obj, const Elf_Rel *rel, const rtems_rtl_obj_sect *sect, const char *symname, const Elf_Byte syminfo, const Elf_Word symvalue)
 
rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rela_tramp (rtems_rtl_obj *obj, const Elf_Rela *rela, const rtems_rtl_obj_sect *sect, const char *symname, const Elf_Byte syminfo, const Elf_Word symvalue)
 
rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rel (rtems_rtl_obj *obj, const Elf_Rel *rel, const rtems_rtl_obj_sect *sect, const char *symname, const Elf_Byte syminfo, const Elf_Word symvalue)
 
rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rela (rtems_rtl_obj *obj, const Elf_Rela *rela, const rtems_rtl_obj_sect *sect, const char *symname, const Elf_Byte syminfo, const Elf_Word symvalue)
 
bool rtems_rtl_elf_file_check (rtems_rtl_obj *obj, int fd)
 
bool rtems_rtl_elf_file_load (rtems_rtl_obj *obj, int fd)
 
bool rtems_rtl_elf_file_unload (rtems_rtl_obj *obj)
 
rtems_rtl_loader_formatrtems_rtl_elf_file_sig (void)
 

Detailed Description

RTEMS Run-Time Linker ELF Headers.

Macro Definition Documentation

◆ ELFSIZE

#define ELFSIZE   32

Imported NetBSD ELF Specifics Start.

◆ RTEMS_RTL_ELF_STRING_MAX

#define RTEMS_RTL_ELF_STRING_MAX   (256)

Maximum string length. This a read buffering limit rather than a specific ELF length. I hope this is ok as I am concerned about some C++ symbol lengths.

Typedef Documentation

◆ rtems_rtl_elf_rel_status

Imported NetBSD ELF Specifics End.ELF Relocation status codes.

◆ rtems_rtl_mdreloc_tramp

Relocation trampoline relocation data.

Enumeration Type Documentation

◆ rtems_rtl_elf_rel_status

Imported NetBSD ELF Specifics End.ELF Relocation status codes.

Enumerator
rtems_rtl_elf_rel_no_error 

There is no error processing the record.

rtems_rtl_elf_rel_failure 

There was a failure processing the record.

rtems_rtl_elf_rel_tramp_cache 

The reloc record may need a trampoliine.

rtems_rtl_elf_rel_tramp_add 

Add a trampoliine.

Function Documentation

◆ rtems_rtl_elf_arch_parse_section()

uint32_t rtems_rtl_elf_arch_parse_section ( const rtems_rtl_obj obj,
int  section,
const char *  name,
const Elf_Shdr *  shdr,
const uint32_t  flags 
)

Architecture specific handler to parse the section and add any flags that may be need to handle the section.

Parameters
objThe object file being relocated.
secitonThe section index.
nameThe name of the section
shdrThe ELF section header.
flagsThe standard ELF parsed flags.
Return values
uint32_tExtra RTL object file flags.

◆ rtems_rtl_elf_arch_section_alloc()

bool rtems_rtl_elf_arch_section_alloc ( const rtems_rtl_obj obj,
rtems_rtl_obj_sect sect 
)

Architecture specific handler to allocate a section. Some sections are specific to an architecture and need special allocators.

Parameters
objThe object file being relocated.
sectThe section data.
Return values
trueThe allocator was successful.

◆ rtems_rtl_elf_arch_section_free()

bool rtems_rtl_elf_arch_section_free ( const rtems_rtl_obj obj,
rtems_rtl_obj_sect sect 
)

Architecture specific handler to free a section. Some sections are specific to an architecture and need special allocators.

Parameters
objThe object file being relocated.
sectThe section data.
Return values
trueThe allocator was successful.

◆ rtems_rtl_elf_file_check()

bool rtems_rtl_elf_file_check ( rtems_rtl_obj obj,
int  fd 
)

The ELF format check handler.

Parameters
objThe object being checked.
fdThe file descriptor.

◆ rtems_rtl_elf_file_load()

bool rtems_rtl_elf_file_load ( rtems_rtl_obj obj,
int  fd 
)

The ELF format load handler.

Parameters
objThe object to load.
fdThe file descriptor.

◆ rtems_rtl_elf_file_sig()

rtems_rtl_loader_format* rtems_rtl_elf_file_sig ( void  )

The ELF format signature handler.

Returns
rtems_rtl_loader_format* The format's signature.

◆ rtems_rtl_elf_file_unload()

bool rtems_rtl_elf_file_unload ( rtems_rtl_obj obj)

The ELF format unload handler.

Parameters
objThe object to unload.

◆ rtems_rtl_elf_rel_resolve_sym()

bool rtems_rtl_elf_rel_resolve_sym ( Elf_Word  type)

Architecture specific handler to check is a relocation record's type is required to resolve a symbol.

Parameters
typeThe type field in the relocation record.
Return values
trueThe relocation record require symbol resolution.
falseThe relocation record does not require symbol resolution.

◆ rtems_rtl_elf_relocate_rel()

rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rel ( rtems_rtl_obj obj,
const Elf_Rel *  rel,
const rtems_rtl_obj_sect sect,
const char *  symname,
const Elf_Byte  syminfo,
const Elf_Word  symvalue 
)

Architecture specific relocation handler compiled in for a specific architecture by the build system. The handler applies the relocation to the target.

Parameters
objThe object file being relocated.
relThe ELF relocation record.
sectThe section of the object file the relocation is for.
symnameThe symbol's name.
syminfoThe ELF symbol info field.
symvalueIf a symbol is referenced, this is the symbols value.
Return values
rtems_rtl_elf_rel_statusThe result of the trampoline parsing.

◆ rtems_rtl_elf_relocate_rel_tramp()

rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rel_tramp ( rtems_rtl_obj obj,
const Elf_Rel *  rel,
const rtems_rtl_obj_sect sect,
const char *  symname,
const Elf_Byte  syminfo,
const Elf_Word  symvalue 
)

Architecture specific relocation trampoline handler compiled in for a specific architecture by the build system. The handler determines if the relocation record requires a trampoline.

Parameters
objThe object file being relocated.
relaThe ELF relocation record.
sectThe section of the object file the relocation is for.
symnameThe symbol's name.
syminfoThe ELF symbol info field.
symvalueIf a symbol is referenced, this is the symbols value.
Return values
rtems_rtl_elf_rel_statusThe result of the trampoline parsing.

◆ rtems_rtl_elf_relocate_rela()

rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rela ( rtems_rtl_obj obj,
const Elf_Rela *  rela,
const rtems_rtl_obj_sect sect,
const char *  symname,
const Elf_Byte  syminfo,
const Elf_Word  symvalue 
)

Architecture specific relocation handler compiled in for a specific architecture by the build system. The handler applies the relocation to the target.

Parameters
objThe object file being relocated.
relaThe ELF addend relocation record.
sectThe section of the object file the relocation is for.
symnameThe symbol's name.
syminfoThe ELF symbol info field.
symvalueIf a symbol is referenced, this is the symbols value.
Return values
rtems_rtl_elf_rel_statusThe result of the trampoline parsing.

◆ rtems_rtl_elf_relocate_rela_tramp()

rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rela_tramp ( rtems_rtl_obj obj,
const Elf_Rela *  rela,
const rtems_rtl_obj_sect sect,
const char *  symname,
const Elf_Byte  syminfo,
const Elf_Word  symvalue 
)

Architecture specific relocation handler compiled in for a specific architecture by the build system. The handler applies the relocation to the target.

Parameters
objThe object file being relocated.
relaThe ELF addend relocation record.
sectThe section of the object file the relocation is for.
symnameThe symbol's name.
syminfoThe ELF symbol info field.
symvalueIf a symbol is referenced, this is the symbols value.
Return values
rtems_rtl_elf_rel_statusThe result of the trampoline parsing.

◆ rtems_rtl_elf_relocate_tramp_max_size()

size_t rtems_rtl_elf_relocate_tramp_max_size ( void  )

Architecture specific relocation maximum trampoline size. A trampoline entry of this size is allocated for each unresolved external.

Returns
size_t The maximum size of a trampoline for this architecture.

◆ rtems_rtl_elf_section_flags()

uint32_t rtems_rtl_elf_section_flags ( const rtems_rtl_obj obj,
const Elf_Shdr *  shdr 
)

Architecture specific handler to translate unknown section flags to RTL section flags. If this function returns 0 an error is raised.

Parameters
objThe object file being relocated.
shdrThe ELF section header.
Return values
0Unknown or unsupported flags.
uint32_tRTL object file flags.