RTEMS: cpukit/libdl/rtl-elf.h File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
rtl-elf.h File Reference
API » RTEMS Runtime Link Editor

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_format * | rtems_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

typedef enum rtems_rtl_elf_rel_status rtems_rtl_elf_rel_status

Imported NetBSD ELF Specifics End. ELF Relocation status codes.

## ◆ rtems_rtl_mdreloc_tramp

typedef struct rtems_rtl_mdreloc_trmap rtems_rtl_mdreloc_tramp

Relocation trampoline relocation data.

## Enumeration Type Documentation

## ◆ rtems_rtl_elf_rel_status

enum 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

  obj | The object file being relocated.
  seciton | The section index.
  name | The name of the section
  shdr | The ELF section header.
  flags | The standard ELF parsed flags.

Return values

  uint32_t | Extra 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

  obj | The object file being relocated.
  sect | The section data.

Return values

  true | The 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

  obj | The object file being relocated.
  sect | The section data.

Return values

  true | The 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

  obj | The object being checked.
  fd | The 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

  obj | The object to load.
  fd | The 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

  obj | The 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

  type | The type field in the relocation record.

Return values

  true | The relocation record require symbol resolution.
  false | The 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

  obj | The object file being relocated.
  rel | The ELF relocation record.
  sect | The section of the object file the relocation is for.
  symname | The symbol's name.
  syminfo | The ELF symbol info field.
  symvalue | If a symbol is referenced, this is the symbols value.

Return values

  rtems_rtl_elf_rel_status | The 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

  obj | The object file being relocated.
  rela | The ELF relocation record.
  sect | The section of the object file the relocation is for.
  symname | The symbol's name.
  syminfo | The ELF symbol info field.
  symvalue | If a symbol is referenced, this is the symbols value.

Return values

  rtems_rtl_elf_rel_status | The 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

  obj | The object file being relocated.
  rela | The ELF addend relocation record.
  sect | The section of the object file the relocation is for.
  symname | The symbol's name.
  syminfo | The ELF symbol info field.
  symvalue | If a symbol is referenced, this is the symbols value.

Return values

  rtems_rtl_elf_rel_status | The 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

  obj | The object file being relocated.
  rela | The ELF addend relocation record.
  sect | The section of the object file the relocation is for.
  symname | The symbol's name.
  syminfo | The ELF symbol info field.
  symvalue | If a symbol is referenced, this is the symbols value.

Return values

  rtems_rtl_elf_rel_status | The 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

  obj | The object file being relocated.
  shdr | The ELF section header.

Return values

  0 | Unknown or unsupported flags.
  uint32_t | RTL object file flags.