Changes

118 bytes added ,  25 September
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).
 +
 
 +
= NroHeader =
 +
This is "nn::ro::detail::NroHeader".
   −
= Start =
   
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 11: Line 13:  
|-
 
|-
 
| 0x0
 
| 0x0
 +
| 0x10
 +
| [[#RocrtHeader|Rocrt]]
 +
|-
 +
| 0x10
 
| 0x4
 
| 0x4
| Unused. Originally 0x0, with [17.0.0+] this is set to value 0x1.
+
| Signature ("NRO0")
 
|-
 
|-
 +
| 0x14
 
| 0x4
 
| 0x4
 +
| Version
 +
|-
 +
| 0x18
 
| 0x4
 
| 0x4
| [[NSO|MOD0]] offset
+
| Size (total NRO file size)
 
|-
 
|-
| 0x8
+
| 0x1C
 
| 0x4
 
| 0x4
| [1.0.0-16.1.0] Padding. [17.0.0+] [[NSO|nnSdk version]] offset
+
| Flags
 
|-
 
|-
| 0xC
+
| 0x20
 
| 0x4
 
| 0x4
| Padding
+
| TextMemoryOffset
|}
  −
 
  −
= Header =
  −
{| class="wikitable" border="1"
   
|-
 
|-
! Offset
+
| 0x24
! Size
+
| 0x4
! Description
+
| TextSize
 
|-
 
|-
| 0x0
+
| 0x28
 
| 0x4
 
| 0x4
| Magic "NRO0"
+
| RoMemoryOffset
 
|-
 
|-
 +
| 0x2C
 
| 0x4
 
| 0x4
 +
| RoSize
 +
|-
 +
| 0x30
 
| 0x4
 
| 0x4
| Version (always 0)
+
| DataMemoryOffset
|-
  −
| 0x8
  −
| 4
  −
| Size (total NRO file size)
   
|-
 
|-
| 0xC
+
| 0x34
 
| 0x4
 
| 0x4
| Flags (unused)
+
| DataSize
 
|-
 
|-
| 0x10
+
| 0x38
| 0x8 * 3
  −
| [[#SegmentHeader|SegmentHeader]][3] {.text, .ro, .data}
  −
|-
  −
| 0x28
   
| 0x4
 
| 0x4
 
| BssSize
 
| BssSize
 
|-
 
|-
| 0x2C
+
| 0x3C
 
| 0x4
 
| 0x4
 
| Reserved
 
| Reserved
 
|-
 
|-
| 0x30
+
| 0x40
 
| 0x20
 
| 0x20
 
| [[#ModuleId|ModuleId]]
 
| [[#ModuleId|ModuleId]]
 
|-
 
|-
| 0x50
+
| 0x60
| 0x04
+
| 0x4
| DsoHandleOffset (unused)
+
| DsoHandleOffset
 
|-
 
|-
| 0x54
+
| 0x64
| 0x04
+
| 0x4
| Reserved (unused)
+
| Reserved
 +
|-
 +
| 0x68
 +
| 0x4
 +
| EmbeddedOffset
 +
|-
 +
| 0x6C
 +
| 0x4
 +
| EmbeddedSize
 
|-
 
|-
| 0x58
+
| 0x70
| 0x8 * 3
+
| 0x4
| [[#SegmentHeader|SegmentHeader]][3] {.apiInfo, .dynstr, .dynsym}
+
| DynStrOffset
 +
|-
 +
| 0x74
 +
| 0x4
 +
| DynStrSize
 +
|-
 +
| 0x78
 +
| 0x4
 +
| DynSymOffset
 +
|-
 +
| 0x7C
 +
| 0x4
 +
| DynSymSize
 
|}
 
|}
   −
== SegmentHeader ==
+
== RocrtHeader ==
 +
This is "nn::ro::detail::RocrtHeader".
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 87: Line 111:  
|-
 
|-
 
| 0x0
 
| 0x0
| 0x4
+
| [17.0.0+] 0xC ([1.0.0-16.1.0] 0x8)
| MemoryOffset
+
| [[MOD#ModuleHeaderLocation|ModuleHeaderLocation]]
 
|-
 
|-
 +
| 0xC
 
| 0x4
 
| 0x4
| 0x4
+
| Reserved
| Size
   
|}
 
|}
    
== ModuleId ==
 
== ModuleId ==
 +
This is "nn::ro::detail::ModuleId".
 +
 
Value of "build id" from ELF's GNU .note section. Contains variable sized digest, up to 32bytes.
 
Value of "build id" from ELF's GNU .note section. Contains variable sized digest, up to 32bytes.
   −
= Assets =
+
= 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 131: Line 158:  
|}
 
|}
   −
== AssetSection ==
+
=== AssetSection ===
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-