RTEMS 6.1-rc5
Loading...
Searching...
No Matches
Macros | Functions
rtl-mdreloc-powerpc.c File Reference
#include <sys/cdefs.h>
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <rtems/rtl/rtl.h>
#include "rtl-bit-alloc.h"
#include "rtl-elf.h"
#include "rtl-error.h"
#include <rtems/rtl/rtl-trace.h>
#include "rtl-unwind.h"
#include "rtl-unwind-dw2.h"

Macros

#define ha(x)
 
#define l(x)   ((u_int32_t)(x) & 0xffff)
 
#define GET_ADDR(_l, _v)
 
#define SEPARATED_PREFIX(_p)   { _p, sizeof (_p) - 1 }
 
#define REL_R_OFFSET   (0)
 
#define REL_R_INFO   (1)
 
#define REL_R_ADDEND   (2)
 

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)
 
uint32_t rtems_rtl_obj_tramp_alignment (const rtems_rtl_obj *obj)
 
size_t rtems_rtl_elf_relocate_tramp_max_size (void)
 
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_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)
 
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_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)
 
bool rtems_rtl_elf_unwind_parse (const rtems_rtl_obj *obj, const char *name, uint32_t flags)
 
bool rtems_rtl_elf_unwind_register (rtems_rtl_obj *obj)
 
bool rtems_rtl_elf_unwind_deregister (rtems_rtl_obj *obj)
 

Macro Definition Documentation

◆ GET_ADDR

#define GET_ADDR (   _l,
  _v 
)
Value:
__asm__ volatile (" lis %0, " #_l "@h\n" \
" ori %0, %0, " #_l "@l\n" : "=r" (_v))

◆ ha

#define ha (   x)
Value:
((((u_int32_t)(x) & 0x8000) ? \
((u_int32_t)(x) + 0x10000) : (u_int32_t)(x)) >> 16)

◆ REL_R_OFFSET

#define REL_R_OFFSET   (0)

The offsets in the reloc words.

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

◆ rtems_rtl_elf_unwind_deregister()

bool rtems_rtl_elf_unwind_deregister ( rtems_rtl_obj obj)

Architecture specific handler to remove an object file's unwind information from the base image.

Parameters
objThe object file.
Return values
trueThe unwind information has been deregistered.
falseThe unwind information could not be deregistered.

◆ rtems_rtl_elf_unwind_parse()

bool rtems_rtl_elf_unwind_parse ( const rtems_rtl_obj obj,
const char *  name,
uint32_t  flags 
)

Architecture specific handler to check if a section contains exception handler data..

Parameters
objThe object file.
nameThe section's name.
uint32flags The object file's flags.
Return values
trueThe section contains unwind information.
falseThe section does not contain unwind information.

◆ rtems_rtl_elf_unwind_register()

bool rtems_rtl_elf_unwind_register ( rtems_rtl_obj obj)

Architecture specific handler to add an object file's unwind information to the base image.

Parameters
objThe object file.
Return values
trueThe unwind information has been registered.
falseThe unwind information could not be registered.

◆ rtems_rtl_obj_tramp_alignment()

uint32_t rtems_rtl_obj_tramp_alignment ( const rtems_rtl_obj obj)

The trampolinme alignment for the architecture.

This is implemented and set in the architecture backend.

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