You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.
An NRO file has four sections in it: .text, .rodata, .data, and .bss.
The NRO file itself is just a concatenation of these sections, with a small header. To make things easier, we just include this header in the .text section and start .text at the beginning of the file.
The NRO header is 0x80 bytes long, which is why you see us skip 0x80 bytes at the start of .text in crt0.nro.S. The NRO header is generated by elf2nxo.pythere. Another important header is the MOD0 header. I don't think we really need to include it exactly, since I'm pretty sure it's only used by the Nintendo runtime linker (rtld), but we include it anyway. It lives near the start of .data and describes, among other things, where the linking information lives.
As such, the flat NRO file looks like this: .text
NRO header (0x80 bytes)
describes where each section is in the file and how big they all are
.text (skipping first 0x80 bytes since we overwrite them with NRO header)
.rodata
.rodata contents
.rela.dyn (concatenated by elf2nxo.py because I couldn't get the linker to put this in .rodata)
.data
MOD0 header
describes location of .dynamic
.data contents
.dynamic (again concatenated by elf2nxo.py because linker troubles)
Special care needs to be taken to ensure that elf2nxo.py places .rela.dyn and .dynamic where the linker expects. If anyone is better at link scripts than I am and can figure out how to get the linker to put those sections in .rodata and .data respectively, please so.
The NRO file on the disk is pretty much exactly the same as the NRO image that gets loaded. There's no compression, no sections get moved around, or anything. The last piece of the puzzle is to relocate all the code. This really should be done in C, but right now for us, that's part of NRO loading. You can see in Nxo.cpp in Mephisto the stupid linker I wrote, and we have a similar one written in JavaScript.
The text was updated successfully, but these errors were encountered:
Here's what misson sent me :
An NRO file has four sections in it:
.text
,.rodata
,.data
, and.bss
.The NRO file itself is just a concatenation of these sections, with a small header. To make things easier, we just include this header in the .text section and start .text at the beginning of the file.
The NRO header is 0x80 bytes long, which is why you see us skip 0x80 bytes at the start of .text in
crt0.nro.S
. The NRO header is generated byelf2nxo.py
there. Another important header is the MOD0 header. I don't think we really need to include it exactly, since I'm pretty sure it's only used by the Nintendo runtime linker (rtld
), but we include it anyway. It lives near the start of .data and describes, among other things, where the linking information lives.As such, the flat NRO file looks like this:
.text
.rodata
.data
Special care needs to be taken to ensure that
elf2nxo.py
places.rela.dyn
and.dynamic
where the linker expects. If anyone is better at link scripts than I am and can figure out how to get the linker to put those sections in.rodata
and.data
respectively, please so.The NRO file on the disk is pretty much exactly the same as the NRO image that gets loaded. There's no compression, no sections get moved around, or anything. The last piece of the puzzle is to relocate all the code. This really should be done in C, but right now for us, that's part of NRO loading. You can see in Nxo.cpp in Mephisto the stupid linker I wrote, and we have a similar one written in JavaScript.
The text was updated successfully, but these errors were encountered: