RTEMS CPU Kit with SuperCore  4.11.3
Macros | Functions
rtl-elf.h File Reference

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

#include "rtl-fwd.h"
#include "rtl-obj-fwd.h"
#include "rtl-sym.h"
#include <sys/cdefs.h>
#include <sys/exec_elf.h>
Include dependency graph for rtl-elf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ELFSIZE   32
 Imported NetBSD ELF Specifics Start.
 
#define _STANDALONE   1
 
#define RTEMS_RTL_ELF_STRING_MAX   (256)
 Imported NetBSD ELF Specifics End. More...
 

Functions

uint32_t rtems_rtl_elf_section_flags (const rtems_rtl_obj_t *obj, const Elf_Shdr *shdr)
 Architecture specific handler to translate unknown section flags to RTL section flags. More...
 
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. More...
 
bool rtems_rtl_elf_relocate_rel (const rtems_rtl_obj_t *obj, const Elf_Rel *rel, const rtems_rtl_obj_sect_t *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. More...
 
bool rtems_rtl_elf_relocate_rela (const rtems_rtl_obj_t *obj, const Elf_Rela *rela, const rtems_rtl_obj_sect_t *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. More...
 
bool rtems_rtl_elf_find_symbol (rtems_rtl_obj_t *obj, const Elf_Sym *sym, const char *symname, Elf_Word *value)
 Find the symbol. More...
 
bool rtems_rtl_elf_file_check (rtems_rtl_obj_t *obj, int fd)
 The ELF format check handler. More...
 
bool rtems_rtl_elf_file_load (rtems_rtl_obj_t *obj, int fd)
 The ELF format load handler. More...
 
bool rtems_rtl_elf_file_unload (rtems_rtl_obj_t *obj)
 The ELF format unload handler. More...
 
rtems_rtl_loader_format_trtems_rtl_elf_file_sig (void)
 The ELF format signature handler. More...
 

Detailed Description

RTEMS Run-Time Linker ELF Headers.

Macro Definition Documentation

◆ RTEMS_RTL_ELF_STRING_MAX

#define RTEMS_RTL_ELF_STRING_MAX   (256)

Imported NetBSD ELF Specifics End.

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.

Function Documentation

◆ rtems_rtl_elf_file_check()

bool rtems_rtl_elf_file_check ( rtems_rtl_obj_t obj,
int  fd 
)

The ELF format check handler.

Parameters
objThe object being checked.
fdThe file descriptor.

References rtems_rtl_obj_s::ooffset, rtems_rtl_obj_cache_read_byval(), and rtems_rtl_obj_caches().

◆ rtems_rtl_elf_file_load()

bool rtems_rtl_elf_file_load ( rtems_rtl_obj_t obj,
int  fd 
)

The ELF format load handler.

Parameters
objThe object to load.
fdThe file descriptor.

References rtems_rtl_obj_s::ooffset, rtems_rtl_obj_cache_read_byval(), and rtems_rtl_obj_caches().

◆ rtems_rtl_elf_file_sig()

rtems_rtl_loader_format_t* rtems_rtl_elf_file_sig ( void  )

The ELF format signature handler.

Returns
rtems_rtl_loader_format_t* The format's signature.

◆ rtems_rtl_elf_file_unload()

bool rtems_rtl_elf_file_unload ( rtems_rtl_obj_t obj)

The ELF format unload handler.

Parameters
objThe object to unload.

References rtems_rtl_elf_unwind_deregister().

◆ rtems_rtl_elf_find_symbol()

bool rtems_rtl_elf_find_symbol ( rtems_rtl_obj_t obj,
const Elf_Sym *  sym,
const char *  symname,
Elf_Word *  value 
)

Find the symbol.

The symbol is passed as an ELF type symbol with the name and the value returned is the absolute address of the symbol.

If the symbol type is STT_NOTYPE the symbol references a global symbol. The gobal symbol table is searched to find it and that value returned. If the symbol is local to the object module the section for the symbol is located and it's base added to the symbol's value giving an absolute location.

Parameters
objThe object the symbol is being resolved for.
symThe ELF type symbol.
symnameThe sym's name read from the symbol string table.
valueReturn the value of the symbol. Only valid if the return value is true.
Return values
trueThe symbol resolved.
falseThe symbol could not be result. The RTL error is set.

◆ 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.

References rtems_rtl_elf_relocate_rela().

Referenced by rtems_rtl_elf_section_flags().

◆ rtems_rtl_elf_relocate_rel()

bool rtems_rtl_elf_relocate_rel ( const rtems_rtl_obj_t obj,
const Elf_Rel *  rel,
const rtems_rtl_obj_sect_t 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
boolThe relocation has been applied.
boolThe relocation could not be applied.

References rtems_rtl_obj_sect_s::base, rtems_rtl_elf_unwind_parse(), and rtems_rtl_set_error().

Referenced by rtems_rtl_elf_relocate_rela().

◆ rtems_rtl_elf_relocate_rela()

bool rtems_rtl_elf_relocate_rela ( const rtems_rtl_obj_t obj,
const Elf_Rela *  rela,
const rtems_rtl_obj_sect_t 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
boolThe relocation has been applied.
boolThe relocation could not be applied.

References rtems_rtl_obj_sect_s::base, rtems_rtl_elf_relocate_rel(), rtems_rtl_set_error(), and rtems_rtl_trace().

Referenced by rtems_rtl_elf_rel_resolve_sym().

◆ rtems_rtl_elf_section_flags()

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

Architecture specific handler to translate unknown section flags to RTL section flags.

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

References rtems_rtl_elf_rel_resolve_sym().