NRO: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
NRO is the executable format for non-[[ExeFS]] binaries. | NRO is the executable format for non-[[ExeFS]] binaries. | ||
It starts with the NRO-start structure then the "NRO" header and mainly describes .text, .rodata, and .data segments (like a short-form of ELF program headers): | It starts with the NRO-start structure then the "NRO" header and mainly describes .text, .rodata, and .data segments (like a short-form of ELF program headers): | ||
= | = Start = | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 24: | Line 23: | ||
|} | |} | ||
= | = Header = | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 37: | Line 36: | ||
| 0x4 | | 0x4 | ||
| 0x4 | | 0x4 | ||
| | | Version (always 0) | ||
|- | |- | ||
| 0x8 | | 0x8 | ||
| 4 | | 4 | ||
| | | Size (total NRO file size) | ||
|- | |- | ||
| 0xC | | 0xC | ||
| 0x4 | | 0x4 | ||
| Flags ( | | Flags (unused) | ||
|- | |- | ||
| 0x10 | | 0x10 | ||
| 0x8 * 3 | | 0x8 * 3 | ||
| SegmentHeader[3] {.text, .ro, .data} | | [[#SegmentHeader|SegmentHeader]][3] {.text, .ro, .data} | ||
|- | |- | ||
| 0x28 | | 0x28 | ||
| 0x4 | | 0x4 | ||
| | | BssSize | ||
|- | |- | ||
| 0x2C | | 0x2C | ||
| 0x4 | | 0x4 | ||
| Reserved | | Reserved | ||
|- | |- | ||
| 0x30 | | 0x30 | ||
| 0x20 | | 0x20 | ||
| | | [[#ModuleId]] | ||
|- | |- | ||
| 0x50 | | 0x50 | ||
| | | 0x04 | ||
| Reserved ( | | DsoHandleOffset (unused) | ||
|- | |||
| 0x54 | |||
| 0x04 | |||
| Reserved (unused) | |||
|- | |- | ||
| 0x58 | | 0x58 | ||
| 0x8 * 3 | | 0x8 * 3 | ||
| SegmentHeader[3] {.apiInfo, .dynstr, .dynsym} | | [[#SegmentHeader|SegmentHeader]][3] {.apiInfo, .dynstr, .dynsym} | ||
|} | |} | ||
Line 82: | Line 84: | ||
| 0x0 | | 0x0 | ||
| 0x4 | | 0x4 | ||
| | | MemoryOffset | ||
|- | |- | ||
| 0x4 | | 0x4 | ||
Line 89: | Line 91: | ||
|} | |} | ||
=Assets= | == ModuleId == | ||
Value of "build id" from ELF's GNU .note section. Contains variable sized digest, up to 32bytes. | |||
= Assets = | |||
This is an optional custom assets section for homebrew, this is located at file offset {NroHeader.size}. See also [https://github.com/switchbrew/switch-tools switch-tools] for implementation. | This is an optional custom assets section for homebrew, this is located at file offset {NroHeader.size}. See also [https://github.com/switchbrew/switch-tools switch-tools] for implementation. | ||
Line 120: | Line 125: | ||
| 0x10 | | 0x10 | ||
| AssetSection romfs. Can be used by the application. | | AssetSection romfs. Can be used by the application. | ||
|} | |} | ||