PROPHET/OS

NAME

relocate: the table of absolute places behind the kernel image

SYNOPSIS

relocate <kernel.elf> <kernel.bin>|selbsttest

DESCRIPTION

The table of absolute places behind the kernel image

Reads the relocations the linker left in the object and keeps the places of the kinds 64 and 32S: those carry an address and have to be corrected when the kernel is moved. Distances (PC32, PLT32) are right after a move by themselves, and a place against an absolute symbol carries a number. The flat image is cut at the end of its loaded sections and the table goes behind it: PROPHREL, version, the two counts, the run size __bss_end - __text_start, the offsets four bytes each, and the length of the table. A kind it does not know and a place outside the image are refused, and the image stays as it was.

It is what tools/relocate.py did, and the build holds the two against each other byte for byte on every run (R10-SELF-07).

selbsttest builds an object of five sections by hand under /temp, with a place twice, a distance and an absolute symbol, then a kind 32 and a place past the end. It is what shell.the_absolute_places_are_tabled_once_and_sorted drives.

EXAMPLE

$ relocate --help
relocate <kernel.elf> <kernel.bin>|selbsttest
  cuts the flat image at its loaded end and appends the table of
  its absolute places and the size it takes while it runs