PROPHET/OS

NAME

flat: writes the allocated sections of the object flat

SYNOPSIS

flat <object> <file>|selbsttest

DESCRIPTION

Writes the allocated sections of the object flat

each at its own address counted from the lowest one, the gaps zero. That is what a foreign objcopy -O binary does, and the build needs it once: uefi.elf becomes uefi.flach, the image the firmware starts. As long as that call stands, ProphetOS cannot build itself (R10-SELF-06).

A section counts when it is allocated (SHF_ALLOC), carries bytes (not SHT_NOBITS, so not the bss) and is not empty. What lies between two of them stays zero.

It says what it wrote: base, size and how many sections went in. The original is silent, and the build asked stat right after it for the one number it wanted.

It reads 64 bit objects of the little end and refuses everything else by name, instead of reading nonsense out of it. An image wider than one block of a run it refuses as well, for it builds the image whole in memory.

selbsttest builds an object of two sections with a gap between them and one that takes room without carrying bytes, flattens it and holds every byte of what comes out against what has to. It is what shell.a_section_lands_at_its_address_and_the_gap_stays_zero drives.

EXAMPLE

$ flat --help
flat <object> <file>|selbsttest
  writes the allocated sections of the object flat, each at its own
  address counted from the lowest one, the gaps zero