Changes

322 bytes added ,  21:32, 25 September 2024
no edit summary
Line 1: Line 1: −
[[Category:File formats]]
   
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).
 +
 
 +
= NroHeader =
 +
This is "nn::ro::detail::NroHeader".
   −
= NRO Start =
   
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 12: Line 13:  
|-
 
|-
 
| 0x0
 
| 0x0
 +
| 0x10
 +
| [[#RocrtHeader|Rocrt]]
 +
|-
 +
| 0x10
 
| 0x4
 
| 0x4
| Unused
+
| Signature ("NRO0")
 
|-
 
|-
 +
| 0x14
 
| 0x4
 
| 0x4
 +
| Version
 +
|-
 +
| 0x18
 
| 0x4
 
| 0x4
| [[NSO|MOD0]] offset
+
| Size (total NRO file size)
 
|-
 
|-
| 0x8
+
| 0x1C
| 0x8
+
| 0x4
| Padding
+
| Flags
|}
+
|-
 
+
| 0x20
= NRO Header =
+
| 0x4
{| class="wikitable" border="1"
+
| TextMemoryOffset
 +
|-
 +
| 0x24
 +
| 0x4
 +
| TextSize
 +
|-
 +
| 0x28
 +
| 0x4
 +
| RoMemoryOffset
 +
|-
 +
| 0x2C
 +
| 0x4
 +
| RoSize
 
|-
 
|-
! Offset
+
| 0x30
! Size
+
| 0x4
! Description
+
| DataMemoryOffset
 
|-
 
|-
| 0x0
+
| 0x34
 
| 0x4
 
| 0x4
| Magic "NRO0"
+
| DataSize
 
|-
 
|-
 +
| 0x38
 
| 0x4
 
| 0x4
 +
| BssSize
 +
|-
 +
| 0x3C
 
| 0x4
 
| 0x4
| NRO Format Version (Always 0)
+
| Reserved
 
|-
 
|-
| 0x8
+
| 0x40
| 4
+
| 0x20
| size (Total NRO filesize)
+
| [[#ModuleId|ModuleId]]
 
|-
 
|-
| 0xC
+
| 0x60
 
| 0x4
 
| 0x4
| Flags (Unused)
+
| DsoHandleOffset
 
|-
 
|-
| 0x10
+
| 0x64
| 0x8 * 3
+
| 0x4
| SegmentHeader[3] {.text, .ro, .data}
+
| Reserved
 
|-
 
|-
| 0x28
+
| 0x68
 
| 0x4
 
| 0x4
| bssSize
+
| EmbeddedOffset
 
|-
 
|-
| 0x2C
+
| 0x6C
 
| 0x4
 
| 0x4
| Reserved (Unused)
+
| EmbeddedSize
 
|-
 
|-
| 0x30
+
| 0x70
| 0x20
+
| 0x4
| Value of "build id" from ELF's GNU .note section. Contains variable sized digest, up to 32bytes.
+
| DynStrOffset
 
|-
 
|-
| 0x50
+
| 0x74
| 0x08
+
| 0x4
| Reserved (Unused)
+
| DynStrSize
 
|-
 
|-
| 0x58
+
| 0x78
| 0x8 * 3
+
| 0x4
| SegmentHeader[3] {.apiInfo, .dynstr, .dynsym}
+
| DynSymOffset
 
|-
 
|-
 +
| 0x7C
 +
| 0x4
 +
| DynSymSize
 
|}
 
|}
   −
== SegmentHeader ==
+
== RocrtHeader ==
 +
This is "nn::ro::detail::RocrtHeader".
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 81: Line 111:  
|-
 
|-
 
| 0x0
 
| 0x0
| 0x4
+
| [17.0.0+] 0xC ([1.0.0-16.1.0] 0x8)
| FileOffset
+
| [[MOD#ModuleHeaderLocation|ModuleHeaderLocation]]
 
|-
 
|-
 +
| 0xC
 
| 0x4
 
| 0x4
| 0x4
+
| Reserved
| Size
   
|}
 
|}
   −
=Assets=
+
== ModuleId ==
 +
This is "nn::ro::detail::ModuleId".
 +
 
 +
Value of "build id" from ELF's GNU .note section. Contains variable sized digest, up to 32bytes.
 +
 
 +
= Homebrew =
 +
== 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.
    
The below offsets are relative to the beginning of the assets section (AssetHeader).
 
The below offsets are relative to the beginning of the assets section (AssetHeader).
   −
== AssetHeader ==
+
=== AssetHeader ===
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 120: Line 156:  
| 0x10
 
| 0x10
 
| AssetSection romfs. Can be used by the application.
 
| AssetSection romfs. Can be used by the application.
|-
   
|}
 
|}
   −
== AssetSection ==
+
=== AssetSection ===
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-