Line 1: |
Line 1: |
| NSO is the main executable format. | | NSO is the main executable format. |
| | | |
− | It starts with a header: | + | It starts with the "NSO" header and mainly describes .text, .rodata, and .data segments (like a short-form of ELF program headers): |
| + | |
| + | === SegmentHeader === |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
| |- | | |- |
Line 10: |
Line 12: |
| | 0x0 | | | 0x0 |
| | 4 | | | 4 |
− | | Magic "NSO0" | + | | file offset of data |
| |- | | |- |
| | 0x4 | | | 0x4 |
| | 4 | | | 4 |
− | | | + | | memory offset loaded to |
| |- | | |- |
| | 0x8 | | | 0x8 |
| | 4 | | | 4 |
− | | | + | | size of data copied to memory offset (i.e. size after decompression) |
| |- | | |- |
| | 0xC | | | 0xC |
| | 4 | | | 4 |
− | | | + | | alignment used on memory size / size of .bss in the case of .data segment |
| + | |} |
| + | |
| + | === .rodata-relative extent === |
| + | {| class="wikitable" border="1" |
| |- | | |- |
− | | 0x10
| + | ! Offset |
− | | 4
| + | ! Size |
− | | .text LZ4-compressed data start offset (0x101)
| + | ! Description |
| |- | | |- |
− | | 0x14 | + | | 0x0 |
| | 4 | | | 4 |
− | | .text offset? (0) | + | | offset (relative to .rodata) |
| |- | | |- |
− | | 0x18 | + | | 0x4 |
| | 4 | | | 4 |
− | | .text size | + | | size of region |
| + | |} |
| + | |
| + | === NSO Header === |
| + | {| class="wikitable" border="1" |
| |- | | |- |
− | | 0x1C
| + | ! Offset |
− | | 4
| + | ! Size |
− | | .text required align? (0x1000)
| + | ! Description |
| |- | | |- |
− | | 0x20 | + | | 0x0 |
| | 4 | | | 4 |
− | | .rodata LZ4-compressed data start offset | + | | Magic "NSO0" |
| |- | | |- |
− | | 0x24 | + | | 0x4 |
| | 4 | | | 4 |
− | | .rodata offset | + | | |
| |- | | |- |
− | | 0x28 | + | | 0x8 |
| | 4 | | | 4 |
− | | .rodata size | + | | |
| |- | | |- |
− | | 0x2C | + | | 0xC |
| | 4 | | | 4 |
− | | .rodata required align? (1) | + | | |
| |- | | |- |
− | | 0x30 | + | | 0x10 |
− | | 4 | + | | 0x10 * 3 |
− | | .data LZ4-compressed data start offset | + | | SegmentHeader for each segment |
− | |-
| |
− | | 0x34
| |
− | | 4
| |
− | | .data offset
| |
− | |-
| |
− | | 0x38
| |
− | | 4
| |
− | | .data size
| |
− | |-
| |
− | | 0x3C
| |
− | | 4
| |
− | | .bss size
| |
| |- | | |- |
| | 0x40 | | | 0x40 |
| | 0x14 | | | 0x14 |
− | | SHA1? | + | | Value of "build id" from ELF's GNU .note section |
| |- | | |- |
| | 0x54 | | | 0x54 |
Line 81: |
Line 79: |
| |- | | |- |
| | 0x60 | | | 0x60 |
− | | 4 | + | | 0x4 * 3 |
− | | .rel.dyn compression offset? | + | | file size of each segment (i.e. LZ4-compressed size) |
| + | |- |
| + | | 0x6c |
| + | | 0x24 |
| + | | Padding |
| + | |- |
| + | | 0x90 |
| + | | 8 |
| + | | .rodata-relative extents of .dynstr |
| + | |- |
| + | | 0x98 |
| + | | 8 |
| + | | .rodata-relative extents of .dynsym |
| |- | | |- |
| | 0xA0 | | | 0xA0 |
− | | 0x60 | + | | 0x20 * 3 |
| | SHA256 hashes over the decompressed sections using the above byte-sizes: .text, .rodata, and .data. | | | SHA256 hashes over the decompressed sections using the above byte-sizes: .text, .rodata, and .data. |
| |- | | |- |