unwrap_self refused a container when a non-load segment with no file data
sat exactly at the end of a PT_LOAD, as an empty PT_TLS does in Sifu
(PPSA03001): "segment 6 vaddr 0x88cb7a0 is in no PT_LOAD". The eboot and
36 of its 37 bundled modules carry such a segment. A segment of size zero
now matches the load segment it ends, so it is placed at that segment's end.
The relinker reads a plain ELF executable and skips SELF containers with a
warning, so an eboot.bin or a *.prx taken from a title cannot be relinked
before it is unwrapped, and the repository has no tool for that.
The inner ELF program headers of a container carry stale offsets: a SELF
inserts its own metadata blocks between the segments, so the data sits at the
offsets of the SELF segment-record table at file offset 0x40. The segments are
also packed without honouring p_align, while ELF requires p_offset % p_align
== p_vaddr % p_align, which the relinker enforces on guest modules. The tool
places the segments from the records, falls back to the vaddr to file mapping
of the containing PT_LOAD for segments the table does not cover, copies every
region to an offset satisfying the alignment, and refuses a container whose
load segments all look encrypted.