RSO (File Format): Difference between revisions
Jump to navigation
Jump to search
m
→Relocation Table
>Aruki |
>Aruki |
||
Line 199: | Line 199: | ||
=== Relocation Table === | === Relocation Table === | ||
Since modules have space allocated at runtime and therefore do not have a fixed memory address, the relocations table is needed to ensure all data and function addresses are correct; this includes both symbols within the RSO itself, which don't have a fixed address until the RSO is linked in, and symbols within the DOL, which need corrections due to the usage of relative offsets in branch instructions. The relocation table describes the location of every instruction that needs to be patched, and how to patch it. | Since modules have space allocated at runtime and therefore do not have a fixed memory address, the relocations table is needed to ensure all data and function addresses in the RSO are correct; this includes both symbols within the RSO itself, which don't have a fixed address until the RSO is linked in, and symbols within the DOL, which need corrections due to the usage of relative offsets in branch instructions. The relocation table describes the location of every instruction that needs to be patched, and how to patch it. | ||
There are two relocation tables in the file; one for internal relocations (relocations for addresses pointing to symbols within this RSO), and one for external relocations (relocations for addresses pointing to symbols within the main [[DOL (File Format)|DOL executable]]). These tables are pointed to by the ''Internal Relocation Table Offset'' and ''External Relocation Table Offset'' values in the header. You can calculate the number of relocation entries by dividing the size of the table by 0xC (the size of one relocation entry). | There are two relocation tables in the file; one for internal relocations (relocations for addresses pointing to symbols within this RSO), and one for external relocations (relocations for addresses pointing to symbols within the main [[DOL (File Format)|DOL executable]]). These tables are pointed to by the ''Internal Relocation Table Offset'' and ''External Relocation Table Offset'' values in the header. You can calculate the number of relocation entries by dividing the size of the table by 0xC (the size of one relocation entry). |