From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:NSO" |
|---|
| claim | "The NSO0 header is 0x100 bytes: magic at 0, flags at 0xC, three 16-byte segment records at 0x10 (file offset, memory offset, decompressed size, one more u32), bss size in the last u32 of the third record (0x3C), 32-byte module id at 0x40, compressed sizes at 0x60-0x68, dynstr and dynsym extents (hactool: two u64 at 0x90 and 0x98) and SHA-256 hashes of the decompressed segments at 0xA0, 0xC0, 0xE0." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:NSO" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "NsoHeader" |
|---|
| size | "0x100" |
|---|
| endianness | "little" |
|---|
| fields | | offset | "0x00" |
|---|
| size | 4 |
|---|
| type | "u32" |
|---|
| name | "magic" |
|---|
| meaning | "'NSO0' 0x304F534E" |
|---|
|
| offset | "0x04" |
|---|
| size | 4 |
|---|
| type | "u32" |
|---|
| name | "version" |
|---|
|
| offset | "0x08" |
|---|
| size | 4 |
|---|
| type | "u32" |
|---|
| name | "reserved" |
|---|
|
| offset | "0x0C" |
|---|
| size | 4 |
|---|
| type | "u32" |
|---|
| name | "flags" |
|---|
| meaning | "see the NSO flags enum" |
|---|
|
| offset | "0x10" |
|---|
| size | 16 |
|---|
| type | "NsoSegment" |
|---|
| name | "text" |
|---|
| meaning | "u32 file_offset, u32 dst_offset, u32 size (decompressed), u32 extra" |
|---|
|
| offset | "0x20" |
|---|
| size | 16 |
|---|
| type | "NsoSegment" |
|---|
| name | "rodata" |
|---|
| meaning | "same record; Atmosphere names the extra u32 of text and rodata unk_file_offset / unk_size (module name offset and size per switchbrew: not in these sources)" |
|---|
|
| offset | "0x30" |
|---|
| size | 16 |
|---|
| type | "NsoSegment" |
|---|
| name | "data" |
|---|
| meaning | "same record; the extra u32 at 0x3C is bss_size (Atmosphere), written by elf2nso as p_memsz - p_filesz" |
|---|
|
| offset | "0x40" |
|---|
| size | 32 |
|---|
| type | "u8[32]" |
|---|
| name | "module_id" |
|---|
| meaning | "build id; Atmosphere uses it to select embedded and IPS patches" |
|---|
|
| offset | "0x60" |
|---|
| size | 12 |
|---|
| type | "u32[3]" |
|---|
| name | "compressed_sizes" |
|---|
| meaning | "text, rodata, data; used when the matching compressed flag is set" |
|---|
|
| offset | "0x6C" |
|---|
| size | 36 |
|---|
| type | "u8[0x24]" |
|---|
| name | "reserved_6C" |
|---|
| meaning | "Atmosphere declares 0x34 reserved bytes 0x6C-0x9F and does not name dynstr/dynsym" |
|---|
|
| offset | "0x90" |
|---|
| size | 8 |
|---|
| type | "u64" |
|---|
| name | "dynstr_extents" |
|---|
| meaning | "hactool nso0_header_t; offset/size split and rodata-relative base not shown in hactool: Unverified" |
|---|
|
| offset | "0x98" |
|---|
| size | 8 |
|---|
| type | "u64" |
|---|
| name | "dynsym_extents" |
|---|
| meaning | "hactool nso0_header_t" |
|---|
|
| offset | "0xA0" |
|---|
| size | 96 |
|---|
| type | "u8[3][32]" |
|---|
| name | "segment_hashes" |
|---|
| meaning | "SHA-256 of the decompressed text, rodata, data" |
|---|
|
|
|---|
| notes | "flags (0xC) bits per Atmosphere NsoHeader::Flag: 0 text compressed, 1 ro compressed, 2 rw (data) compressed, 3 check hash text, 4 check hash ro, 5 check hash rw, 6 prevent code reads, 7 use ZBIC compression. Segment records are text, ro, rw; the extra u32 of text and ro are named unk_file_offset / unk_size in Atmosphere (module name offset and size on the switchbrew wiki)." |
|---|
|
|---|
| evidence | | type | "documentation" |
|---|
| detail | "switchbrew wiki page NSO (https://switchbrew.org/wiki/NSO), header table fetched 2026-10-18; no source file in a licensed repository was read" |
|---|
|
| type | "source" |
|---|
| detail | "Atmosphere struct NsoHeader (static_assert sizeof == 0x100): magic, version, reserved_08, flags, three SegmentInfo, module_id, compressed_sizes, reserved_6C[0x34], segment_hashes; bss_size is member 12 of the segment union" |
|---|
| repo | "Atmosphere-NX/Atmosphere" |
|---|
| commit | "6b0c077b4c608a3a2ee712b8dc35fee87ceb62e8" |
|---|
| path | "libraries/libstratosphere/include/stratosphere/ldr/ldr_types.hpp" |
|---|
| lines | "87-154" |
|---|
|
| type | "source" |
|---|
| detail | "hactool nso0_header_t splits Atmosphere's reserved_6C: _0x6C[0x24], u64 dynstr_extents, u64 dynsym_extents, then section_hashes at 0xA0; segment record is file_off, dst_off, decomp_size, align_or_total_size" |
|---|
| repo | "SciresM/hactool" |
|---|
| commit | "1d64a83450e025622f3468c28fc4164dad2c5ef6" |
|---|
| path | "nso.h" |
|---|
| lines | "9-29" |
|---|
|
| type | "source" |
|---|
| detail | "enum Flag : u32 {CompressedText = 1<<0, CompressedRo = 1<<1, CompressedRw = 1<<2, CheckHashText = 1<<3, CheckHashRo = 1<<4, CheckHashRw = 1<<5, PreventCodeReads = 1<<6, UseZbicCompression = 1<<7}; struct member order text_file_offset .. bss_size, module_id, compressed_sizes, reserved_6C[0x34], segment_hashes; static_assert sizeof == 0x100." |
|---|
| repo | "Atmosphere-NX/Atmosphere" |
|---|
| commit | "6b0c077b4c608a3a2ee712b8dc35fee87ceb62e8" |
|---|
| path | "libraries/libstratosphere/include/stratosphere/ldr/ldr_types.hpp" |
|---|
| lines | "87-154" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Header" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T07:01:26.908Z" |
|---|
| verifications | |
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T12:50:38.782Z" |
|---|
| summary | "Replace documentation-only layout with source-read layout (Atmosphere NsoHeader, hactool nso0_header_t); dynstr/dynsym are at 0x90/0x98, not 0x88" |
|---|
| changed | | "claim" |
| "data" |
| "evidence" |
| "confidence" |
|
|---|
|
| by | "PatientStepper99" |
|---|
| date | "2026-10-19T17:33:31.506Z" |
|---|
| summary | "The flags field pointed at 'the NSO flags enum' that the fact does not contain: add the bits from Atmosphere's NsoHeader::Flag (ldr_types.hpp 96-105). Layout re-read against NsoHeader and hactool…" |
|---|
| changed | |
|---|
|
|
|---|