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

RTEMS Run-Time Link Editor. More...

#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <rtems/rtl/rtl.h>
#include "rtl-elf.h"
#include "rtl-error.h"
#include "rtl-trace.h"
#include "rtl-unwind.h"
#include "rtl-unresolved.h"
Include dependency graph for rtl-elf.c:

Macros

#define REL_R_OFFSET   (0)
 The offsets in the unresolved array.
 
#define REL_R_INFO   (1)
 
#define REL_R_ADDEND   (2)
 

Functions

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_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_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 Link Editor.

This is the RTL implementation.

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